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 hidden (Show)
Published by YahnisElsts almost 7 years ago
puc_view_details_link-$slug
filter. Return an empty string to remove the link.puc_view_details_link_position-$slug
filter. Valid return values are "before", "after", "replace", and "append".readme.txt
capitalisations. Most plugins use a lowercase name, but there are some that call this file README.txt
or README.TXT
. This was an issue when trying to retrieve the readme from a VCS repository.register_uninstall_hook()
.Published by YahnisElsts about 7 years ago
Vcs_Reference
instance as an $apiResponse
property.wp_remote_get()
.
request_metadata_http_result
add_filter()
: puc_request_metadata_http_result-$slug
or puc_request_metadata_http_result_theme-$slug
.$updateChecker->addFilter('request_metadata_http_result', function($response) {
return $response;
});
set_time_limit()
being disabled. Changing the limit can be useful when you're on a slow network connection, but normally the library works fine with the default limits.Published by YahnisElsts over 7 years ago
php
(PHP version) and locale
(WordPress locale) to query parameters that are sent when checking for updates. This only applies to projects using JSON metadata.Published by YahnisElsts over 7 years ago
Published by YahnisElsts almost 8 years ago
Published by YahnisElsts almost 8 years ago
1.0.2
or v0.0.1
).Published by YahnisElsts almost 8 years ago
New features
Breaking changes
Renamed PucFactory
to Puc_v4_Factory
. Use Puc_v4_Factory::buildUpdateChecker()
to initialize the update checker.
Renamed all classes to comply with the PSR-0 autoloading standard.
Changed how the factory deals with multiple versions of the library being loaded at the same time. Instead of simply choosing the highest available version, it now uses the highest minor version. For example, version 4.0 of the factory class can build version 4.5 or 4.9.1 instances, but not version 5.0. The goal of this change is to reduce the risk that future releases could accidentally break plugins that are using old versions of the library.
GitHub support: The class PucGitHubChecker_x_y
was removed. Use Puc_v4_Factory::buildUpdateChecker()
instead and pass the repository URL as the first argument. Example:
$updateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://github.com/username/repository',
__FILE__
);
GitHub support: The setAccessToken()
method was deprecated. Use setAuthentication('token_here')
instead.
As part of theme support, the plugin info and update container classes were refactored and two base classes (Puc_v4_Metadata
, Puc_v4_Update
) were introduced. If your plugin extends the update class, review the changes to see if you need to update your code.
Minor changes
require
.examples
directory.add_filter()
or add_action()
. I recommend using the $updateChecker->addFilter()
method instead which will automatically append the right suffix and slug.
puc_something-$slug
.puc_something_theme-$slug
.Published by YahnisElsts almost 8 years ago
WP_DEBUG
is enabled. To prevent that, specify a unique slug when calling PucFactory::buildUpdateChecker
or creating a PluginUpdateChecker
instance.Published by YahnisElsts over 8 years ago
tested
field to 4.5
or above.Published by YahnisElsts over 8 years ago
Breaking changes
This release includes a few changes that break backwards compatibility. In practice, most plugins will not be affected.
PluginUpdateChecker
, PluginUpdate
and PluginInfo
. Use the versioned class names instead, e.g. PluginUpdateChecker_3_0
.$checkPeriod
, $throttleRedundantChecks
, $throttledCheckPeriod
fields and the maybeCheckForUpdates()
method from PluginUpdateChecker
to a new class called PucScheduler
.$triggerErrors
parameter from the fromJson()
method. Now the update checker will always trigger a PHP notice if your metadata file does not contain valid JSON or is missing a required key.Other changes
isPluginBeingUpgraded()
method. It returns true
if the plugin is being updated right now. This can be useful for plugins that hook into WordPress core to change how WordPress installs updates. Caution: The method is not guaranteed to be accurate.admin_url()
/network_admin_url()
with self_admin_url()
.debug-bar-plugin.php
file is now optional. If you're not using Debug Bar, you can remove the file and the library will keep working. Previously it would crash if the file was missing.Published by YahnisElsts about 9 years ago
Published by YahnisElsts over 9 years ago
active_installs
field. This should be an positive integer that indicates how many sites use your plugin. WordPress will show it in the "view version 1.2.3 details" pop-up. For example, if you set it to 10000, users will see "Active Installs: 10,000+".class_exists()
. Apparently, some autoloader implementations will throw warnings or even crash if they get a class name that they can't load.Published by YahnisElsts over 9 years ago
Added experimental GitHub support. You can use the new PucGitHubChecker
class to retrieve plugin updates from a GitHub repository. It can be configured to check either the latest release, the latest tag, or a specific branch. It will automagically extract version details (description, changelog, etc) from a number of different locations - release description, plugin headers, readme.txt
, changelog.md
and more.
Added support for plugin banners. To use it, add a new key named "banners" to the metadata file. It should be a JSON object with two string properties: "low" and "high". "low" must be a fully qualified URL pointing to a 772x250 image (PNG or JPG). "high" must point to a 1544x500 image. Only one of "low" or "high" is required.
Example:
{
"banners" : {
"low" : "//example.com/assets/banner-772x250.png",
"high" : "//example.com/assets/banner-1544x500.png"
}
}
Fixed some duplicate HTML ids. See #26.
Added a workaround for situations where the currently installed version and the update package have different directory names. This can happen if you serve updates from a source like GitHub that generates different directory names for each branch/tag/etc.
The "slug" field of the metadata file is no longer used. The update checker will now ignore it and use the slug passed to the class constructor instead. If no slug is specified, it will generate a slug based on the plugin file name.
Published by YahnisElsts almost 10 years ago
Published by YahnisElsts almost 10 years ago
filename
property to the PluginInfo
and PluginUpdate
classes. It contains the plugin file name relative to the plugins directory (equivalent to PluginUpdateChecker::pluginFile
).WordPress has supported background plugin updates since WP 3.7. Previously automatic updates didn't work with PUC even if explicitly enabled. This release adds basic support for that WP feature.
Published by YahnisElsts about 10 years ago
Published by YahnisElsts over 11 years ago
Version 1.3