Skip to content

5.0

Compare
Choose a tag to compare
@YahnisElsts YahnisElsts released this 02 Nov 16:47
· 56 commits to master since this release

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.