Plugin Update Checker Versions Save

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.

v5.4

2 months ago
  • Added automatic update checks before certain WP-CLI commands that read plugin/theme update status, such as wp plugin status, wp theme update, and so on. This just triggers the existing scheduling logic, so if you run multiple commands in very quick succession, PUC won't check for updates every time. See #558.
  • Fixed an autoloading failure where the Ui class (YahnisElsts\PluginUpdateChecker\v5p3\Plugin\Ui) sometimes did not load correctly if multiple active plugins/themes were using different versions of PUC.
  • Fixed a conflict with "WP Last Modified Info" 1.8.8 that could cause a fatal error when updating a plugin. This should also improve compatibility with any other plugins that try to access update-related data inside an upgrader_process_complete callback.
  • Removed dev files like phpcs.xml from exported archives. Props to @szepeviktor.

v5.3

6 months ago
  • Fixed a fatal error that could happen in the unusual situation where the Debug_Bar class exists but Debug_Bar_Panel does not. See #543.
  • Fixed PUC intermittently detecting an invalid "update" when using a GitHub branch and hitting the GitHub API rate limit. See #526.

v5.2

8 months ago
  • Fixed a few PHP 8.2 deprecation notices like Creation of dynamic property YahnisElsts\PluginUpdateChecker\vXpY\Plugin\PluginInfo::$example is deprecated.

v5.1

11 months ago
  • Added a way to filter GitHub and GitLab releases.
    • Example of filtering releases by the version number:
      //Allow only beta versions (e.g. for testing).
      $updateChecker->getVcsApi()->setReleaseVersionFilter(
          '/beta/i', //Regex for the version number.
          Api::RELEASE_FILTER_ALL, //Disables the default filter(s).
          30 //Max number of recent releases to scan for matches.
      );
      
    • Alternatively, you can use a callback to implement custom filtering rules.
      //Set an arbitrary custom filter.
      $updateChecker->getVcsApi()->setReleaseFilter(
          function($versionNumber, $releaseObject) {
              /* 
              Put your custom logic here. The $releaseObject variable contains
              the release data returned by the GitHub/GitLab API. The format
              will vary depending on which service you're using.
              */
              return true;
          },
          Api::RELEASE_FILTER_ALL
      );
      
    • Aside from Api::RELEASE_FILTER_ALL, you can also use Api::RELEASE_FILTER_SKIP_PRERELEASE to filter out pre-releases.
    • Setting a new filter will override any previous filters, so you can't add a regex-based version filter and a custom callback at the same time.
  • Fixed a release asset filtering bug where an asset that matches the filter could be ignored if it was not the first in the list. Props to @liedekef.
  • Changed the readme parser to use wp_strip_all_tags() instead of strip_tags() when available. Supposedly, it's better at stripping the contents of <script> and <style> tags.
  • The main branch is now treated as a default branch (in addition to master).

v5.0

1 year ago

Breaking Changes

  • Minimum required PHP version increased from 5.2 to 5.6.20.
  • All classes have been moved into namespaces. Code written for older versions will need to be updated to work with this version. In most cases, you will only need import the factory class and change the factory class name. Example:
    use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
    $myUpdateChecker = PucFactory::buildUpdateChecker(
    	'https://example.com/info.json',
    	__FILE__,
    	'my-slug'
    );
    
    If you want to use version 5.0 specifically instead of "latest loaded 5.x version", replace v5 in the namespace with v5p0.

Other Changes

  • Added a way to filter VCS update detection strategies. For example, you could use it to stop PUC from looking for GitHub releases if you don't use those, or you could prevent it from loading the readme.txt from a remote BitBucket remote repository to see if it has a Stable tag header that points to a valid tag. This makes it possible to avoid some unnecessary HTTP requests and may improve performance for your users. Example:
    use YahnisElsts\PluginUpdateChecker\v5p0\Vcs\BitBucketApi;
    $bitbucketPluginChecker->addFilter('vcs_update_detection_strategies', function($strategies) {
     	//Don't look for a "Stable tag" header in readme.txt.
     	unset($strategies[BitBucketApi::STRATEGY_STABLE_TAG]);
     	return $strategies;
    });
    
    Different APIs support different strategies. Currently implemented strategies include:
    • STRATEGY_LATEST_RELEASE
    • STRATEGY_LATEST_TAG
    • STRATEGY_STABLE_TAG
    • STRATEGY_BRANCH
  • Fixed a PHP deprecation notice: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated. It could be triggered if the update metadata URL did not include a path.
  • Fixed many (but not all) warnings that were reported when running PHP_CodeSniffer with the basic WordPress Coding Standards (WPCS) ruleset and the WordPress-VIP ruleset. This does not affect PUC directly, but it might save you some time if you need your plugin or theme that uses PUC to meet those standards.

v4.13

1 year ago
  • Fixed a PHP warning when trying to load update details that were saved by a different version of PUC that had a custom namespace. This was a pre-existing PHP Scoper compatibility issue that was exposed by the recent 4.12 release.

v4.12

1 year ago
  • Added the ability to automatically load plugin banners from a local assets subdirectory. Props to @timwiel for the initial implementation.
  • Fixed a PHP Scoper compatibility issue where autoloading didn't work if the custom namespace contained underscores (_).
  • BitBucket: Fixed a bug where branch names that contain slashes would not work.
  • BitBucket: The main branch will now be treated as a default branch (in addition to master).
  • GitLab: Added support for GitLab releases. Props to @timwiel.
  • Added and updated translations:
    • Turkish (Igor Funa)
    • Russian and Ukrainian (@wpdew)
    • Simplified Chinese (@seatonjiang)
    • Italian (@d79)

v4.11

3 years ago
  • Fixed a call to a non-existent lastRequestApiErrors property that could prevent certain update errors from being reported.
  • Fixed a few warnings about deprecated jQuery features.
  • Improved compatibility with PHP Scoper and other tools that add custom namespaces to third-party libraries.

v4.10

3 years ago
  • Added support for the new auto-update feature introduced in WordPress 5.5.
  • Added support for the "Requires PHP" header field.
  • Added a new factory method buildFromHeader($filePath, $args) that lets you specify the repository URL in the plugin header and set other update checker arguments using an associative array. Example:
    /*
    Plugin Name: Example Plugin
    Description: Lorem ipsum 
    Version: 1.0
    GitHub URI: https://github.com/foo/bar/
    */
    //...
    $updateChecker = Puc_v4p10_Factory::buildFromHeader(
    	__FILE__,
    	array(
    		'slug'         => 'plugin-slug-here',
    		'checkPeriod'  => 12,
    		'optionName'   => 'abc-custom-option',
    	)
    );
    
  • Fixed several fatal errors that could happen when the update checker itself was upgraded to a different version during a plugin or theme update. These errors only showed up when installing an update and typically didn't prevent the update from being installed.
  • Fixed a bug where the hostname used in the metadata URL sometimes wasn't correctly whitelisted if there were at least two active plugins using the same version of PUC.
  • Improved the way the update checker determines the patch number to add to the "Tested up to" value. Now it's even more likely to find the real patch version number for the specified WordPress version and less likely to fall back to using .999.
  • Added Simplified Chinese translation. Props to @seatonjiang.
  • Updated Spanish translations. Props to @YordanSoares.

v4.9

4 years ago
  • Switched from a deprecated GitHub API authentication mechanism that used the access_token query parameter to using the Authorization HTTP header. This should stop GitHub sending you email notices about authentication via URL query parameters. Props to @jccit for the initial implementation.
  • Fixed a fatal error "Call to a member function isMuPlugin() on null" that could affect some Multisite installations.
  • Added a random offset to the update check schedule to help prevent daily traffic spikes. This doesn't change how often PUC checks for updates, but it spreads the checks more evenly throughout the day. Props to @DavidAnderson684 for the initial suggestion and feedback.
  • Added a new filter: first_check_time (full name: puc_first_check_time-$slug). It's passed one argument that is the calculated Unix timestamp of the first update check. Return a new timestamp to make the first check happen at a different time.
    //Usage example:
    $updateChecker->addFilter('first_check_time', function($unusedTimestamp) {
        //Always check for updates 1 hour after the first activation.
        return time() + 3600;
    });