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
Bot releases are visible (Hide)
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.Ui
class (YahnisElsts\PluginUpdateChecker\v5p3\Plugin\Ui
) sometimes did not load correctly if multiple active plugins/themes were using different versions of PUC.upgrader_process_complete
callback.phpcs.xml
from exported archives. Props to @szepeviktor.Published by YahnisElsts 12 months ago
Debug_Bar
class exists but Debug_Bar_Panel
does not. See #543.Published by YahnisElsts about 1 year ago
Creation of dynamic property YahnisElsts\PluginUpdateChecker\vXpY\Plugin\PluginInfo::$example is deprecated
.Published by YahnisElsts over 1 year ago
//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.
);
//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
);
Api::RELEASE_FILTER_ALL
, you can also use Api::RELEASE_FILTER_SKIP_PRERELEASE
to filter out pre-releases.wp_strip_all_tags()
instead of strip_tags()
when available. Supposedly, it's better at stripping the contents of <script>
and <style>
tags.main
branch is now treated as a default branch (in addition to master
).Published by YahnisElsts almost 2 years ago
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
.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
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.Published by YahnisElsts about 2 years ago
Published by YahnisElsts about 2 years ago
assets
subdirectory. Props to @timwiel for the initial implementation._
).main
branch will now be treated as a default branch (in addition to master
).Published by YahnisElsts over 3 years ago
lastRequestApiErrors
property that could prevent certain update errors from being reported.Published by YahnisElsts about 4 years ago
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',
)
);
.999
.Published by YahnisElsts over 4 years ago
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.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;
});
Published by YahnisElsts about 5 years ago
Fixed a fatal error that could happen when loading the Puc_v4_Factory
class with the Composer-generated autoloader.
Published by YahnisElsts about 5 years ago
major.minor
(e.g. 5.2
) and the site was running version major.minor.patch
(e.g. 5.2.1
). This complements an earlier patch where a similar warning was show on the "Updates" page.Published by YahnisElsts about 5 years ago
Another test release.
Published by YahnisElsts about 5 years ago
Testing a different Composer autoloading mechanism.
Published by YahnisElsts over 5 years ago
Published by YahnisElsts over 5 years ago
puc_get_vcs_service
filter that lets users add their self-hosted GitLab or BitBucket instance as a recognised service. Props to @Tofandel.Puc_v4pX_Factory
) wouldn't be able to instantiate any classes.Published by YahnisElsts over 5 years ago
Fixed a PHP notice that was triggered in PHP 7.3 when the path to the mu-plugins
directory could not be resolved for some reason: "Deprecated: strpos(): Non-string needles will be interpreted as strings in the future".
Published by YahnisElsts almost 6 years ago
readme-parser.php
. Props to @Tofandel for one of the fixes.readme.txt
section when it's empty.Published by YahnisElsts almost 7 years ago
"icons" : {
"1x" : "http://example.com/assets/icon-128x128.png",
"2x" : "http://example.com/assets/icon-256x256.png",
"svg": "http://example.com/assets/icon.svg"
}
See supported icon sizes and image formats.enableReleaseAssets()
method of the GitHub API class.
$gitHubUpdateChecker->getVcsApi()->enableReleaseAssets();
You can make PUC look for a specific asset by passing a regular expression to enableReleaseAssets()
. For example, $api->enableReleaseAssets('/custom-asset/')
will make PUC use the first asset where the file name contains the string "custom-asset".Published by YahnisElsts almost 7 years ago
This is a hotfix to remove some debug logging code that was accidentally left in the 4.3 release.