YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.21k stars 403 forks source link

Using PUC on an external server #542

Closed crftwrk closed 10 months ago

crftwrk commented 10 months ago

First, thank you very much for this amazing plugin!

I'm trying to get library work on an external url, but failed. The case is that I have a couple of plugins and themes and do not want to include PUC in each plugin/theme. The plan is to install PUC once somewhere in the web and each plugin uses the plugin-update-checker.php from there.

For example roughly changing:

require 'plugin-update-checker/plugin-update-checker.php';

to

require 'https://update.mydomain.com/plugin-update-checker/plugin-update-checker.php';

Is something like this possible?

Thanks in advance

YahnisElsts commented 10 months ago

I think that technically this can be done if you enable both allow_url_fopen and allow_url_include in your PHP configuration.

However, I recommend against doing that. It's a security risk. Even if you're sure that nobody can access your server and edit that one file, there's still the problem that enabling those two PHP options allows all other code to load remote PHP files. Also, loading a file from an external URL for every admin page load will have significant performance overhead.

crftwrk commented 10 months ago

Thank you, this makes sense.