Releases: YahnisElsts/plugin-update-checker
Releases · YahnisElsts/plugin-update-checker
5.5
- Removed information about plugins and themes that manage updates via PUC from data that WordPress core sends to
api.wordpress.org
when it checks for updates. Props to @DavidAnderson684 (#578).- You can turn this off and restore the default WP behaviour by using the new
remove_from_default_update_checks
filter. Example:$updateChecker->addFilter('remove_from_default_update_checks', '__return_false');
- You can turn this off and restore the default WP behaviour by using the new
- Improved handling of incorrect ZIP directory structure where plugin/theme files are at the root instead of in a subdirectory. The update checker will now attempt to automatically create a new subdirectory that matches the slug and move all the files into that subdirectory. Props to @MehbubRashid (#574).
- Improved Debug Bar integration: The "Check Now" and "Request Info" buttons in the "PUC (your-slug)" panel are now also visible in the site front end. Previously, they only showed up if you opened the Debug Bar while on an admin page.
- Added Greek translation (@theo-gk).
- Updated Simplified Chinese translation (@seatonjiang).
5.4
- 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.
5.3
5.2
- Fixed a few PHP 8.2 deprecation notices like
Creation of dynamic property YahnisElsts\PluginUpdateChecker\vXpY\Plugin\PluginInfo::$example is deprecated
.
5.1
- 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 useApi::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.
- Example of filtering releases by the version number:
- 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 ofstrip_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 tomaster
).
5.0
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:
If you want to use version 5.0 specifically instead of "latest loaded 5.x version", replace
use YahnisElsts\PluginUpdateChecker\v5\PucFactory; $myUpdateChecker = PucFactory::buildUpdateChecker( 'https://example.com/info.json', __FILE__, 'my-slug' );
v5
in the namespace withv5p0
.
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 aStable 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:Different APIs support different strategies. Currently implemented strategies include: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; });
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.
4.13
- 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.
4.12
- 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 tomaster
). - 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)
4.11
- 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.
4.10
- 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.