From 8125be8df71f4a9d3ad9d4217f68d3f527610944 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Mon, 5 Oct 2020 16:45:03 +0300 Subject: [PATCH 01/10] Improve compatibility with PHP Scoper and other tools that add namespaces to third-party libraries. See #394 for discussion. --- Puc/v4p10/DebugBar/Extension.php | 4 ++++ Puc/v4p10/Factory.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Puc/v4p10/DebugBar/Extension.php b/Puc/v4p10/DebugBar/Extension.php index deba8c2..cb601e5 100644 --- a/Puc/v4p10/DebugBar/Extension.php +++ b/Puc/v4p10/DebugBar/Extension.php @@ -14,6 +14,10 @@ if ( !class_exists('Puc_v4p10_DebugBar_Extension', false) ): $this->panelClass = $panelClass; } + if ( defined('__NAMESPACE__') && version_compare(PHP_VERSION, '5.3', '>=') ) { + $this->panelClass = __NAMESPACE__ . '\\' . $this->panelClass; + } + add_filter('debug_bar_panels', array($this, 'addDebugBarPanel')); add_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies')); diff --git a/Puc/v4p10/Factory.php b/Puc/v4p10/Factory.php index 28d69ee..e61ee28 100644 --- a/Puc/v4p10/Factory.php +++ b/Puc/v4p10/Factory.php @@ -111,6 +111,14 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): return null; } + //Add the current namespace to the class name(s). + if ( defined('__NAMESPACE__') && version_compare(PHP_VERSION, '5.3', '>=') ) { + $checkerClass = __NAMESPACE__ . '\\' . $checkerClass; + if ( isset($apiClass) ) { + $apiClass = __NAMESPACE__ . '\\' . $apiClass; + } + } + if ( !isset($apiClass) ) { //Plain old update checker. return new $checkerClass($metadataUrl, $id, $slug, $checkPeriod, $optionName, $muPluginFile); From 3c5565863820d0d47057e24b06d96ee98a717268 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Mon, 5 Oct 2020 16:51:09 +0300 Subject: [PATCH 02/10] Don't change the Debug Bar panel class name if it already includes a namespace. --- Puc/v4p10/DebugBar/Extension.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Puc/v4p10/DebugBar/Extension.php b/Puc/v4p10/DebugBar/Extension.php index cb601e5..e67460b 100644 --- a/Puc/v4p10/DebugBar/Extension.php +++ b/Puc/v4p10/DebugBar/Extension.php @@ -14,7 +14,11 @@ if ( !class_exists('Puc_v4p10_DebugBar_Extension', false) ): $this->panelClass = $panelClass; } - if ( defined('__NAMESPACE__') && version_compare(PHP_VERSION, '5.3', '>=') ) { + if ( + defined('__NAMESPACE__') + && version_compare(PHP_VERSION, '5.3', '>=') + && (strpos($this->panelClass, '\\') === false) + ) { $this->panelClass = __NAMESPACE__ . '\\' . $this->panelClass; } From dee87bbfe621fb79df6eb0195c7ff8b94bdb8126 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Tue, 6 Oct 2020 13:01:30 +0300 Subject: [PATCH 03/10] Remove defined('__NAMESPACE__') checks since that apparently doesn't work --- Puc/v4p10/DebugBar/Extension.php | 6 +----- Puc/v4p10/Factory.php | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Puc/v4p10/DebugBar/Extension.php b/Puc/v4p10/DebugBar/Extension.php index e67460b..e3e6db7 100644 --- a/Puc/v4p10/DebugBar/Extension.php +++ b/Puc/v4p10/DebugBar/Extension.php @@ -14,11 +14,7 @@ if ( !class_exists('Puc_v4p10_DebugBar_Extension', false) ): $this->panelClass = $panelClass; } - if ( - defined('__NAMESPACE__') - && version_compare(PHP_VERSION, '5.3', '>=') - && (strpos($this->panelClass, '\\') === false) - ) { + if ( version_compare(PHP_VERSION, '5.3', '>=') && (strpos($this->panelClass, '\\') === false) ) { $this->panelClass = __NAMESPACE__ . '\\' . $this->panelClass; } diff --git a/Puc/v4p10/Factory.php b/Puc/v4p10/Factory.php index e61ee28..01ed848 100644 --- a/Puc/v4p10/Factory.php +++ b/Puc/v4p10/Factory.php @@ -112,7 +112,7 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): } //Add the current namespace to the class name(s). - if ( defined('__NAMESPACE__') && version_compare(PHP_VERSION, '5.3', '>=') ) { + if ( version_compare(PHP_VERSION, '5.3', '>=') ) { $checkerClass = __NAMESPACE__ . '\\' . $checkerClass; if ( isset($apiClass) ) { $apiClass = __NAMESPACE__ . '\\' . $apiClass; From 4778dd3eb4efa6c31a28c154940b1c5474eef056 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Wed, 7 Oct 2020 18:51:24 +0300 Subject: [PATCH 04/10] Add the current namespace to metadata class names --- Puc/v4p10/UpdateChecker.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Puc/v4p10/UpdateChecker.php b/Puc/v4p10/UpdateChecker.php index 838f5d2..789cf6c 100644 --- a/Puc/v4p10/UpdateChecker.php +++ b/Puc/v4p10/UpdateChecker.php @@ -675,6 +675,9 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): $status = $this->validateApiResponse($result); $metadata = null; if ( !is_wp_error($status) ){ + if ( version_compare(PHP_VERSION, '5.3', '>=') && (strpos($metaClass, '\\') === false) ) { + $metaClass = __NAMESPACE__ . '\\' . $metaClass; + } $metadata = call_user_func(array($metaClass, 'fromJson'), $result['body']); } else { do_action('puc_api_error', $status, $result, $url, $this->slug); From 4bd0a820d1ed1f8713be141ad56cf5362f83a524 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Wed, 14 Oct 2020 19:13:02 +0300 Subject: [PATCH 05/10] Move code that prefixes the API class with the current namespace so that getCompatibleClassVersion() gets the unprefixed name. Alternative fix for the problem described in #396. --- Puc/v4p10/Factory.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Puc/v4p10/Factory.php b/Puc/v4p10/Factory.php index 01ed848..2168ea7 100644 --- a/Puc/v4p10/Factory.php +++ b/Puc/v4p10/Factory.php @@ -114,9 +114,6 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): //Add the current namespace to the class name(s). if ( version_compare(PHP_VERSION, '5.3', '>=') ) { $checkerClass = __NAMESPACE__ . '\\' . $checkerClass; - if ( isset($apiClass) ) { - $apiClass = __NAMESPACE__ . '\\' . $apiClass; - } } if ( !isset($apiClass) ) { @@ -134,6 +131,10 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): return null; } + if ( version_compare(PHP_VERSION, '5.3', '>=') && (strpos($apiClass, '\\') === false) ) { + $apiClass = __NAMESPACE__ . '\\' . $apiClass; + } + return new $checkerClass( new $apiClass($metadataUrl), $id, From 4e59df1958b3ebc854a7808c8a8fc2ec80598ed1 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Wed, 9 Dec 2020 17:07:15 +0200 Subject: [PATCH 06/10] Fixed a few warnings about deprecated jQuery features --- Puc/v4p10/DebugBar/Extension.php | 2 +- js/debug-bar.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Puc/v4p10/DebugBar/Extension.php b/Puc/v4p10/DebugBar/Extension.php index e3e6db7..18c484e 100644 --- a/Puc/v4p10/DebugBar/Extension.php +++ b/Puc/v4p10/DebugBar/Extension.php @@ -52,7 +52,7 @@ if ( !class_exists('Puc_v4p10_DebugBar_Extension', false) ): 'puc-debug-bar-js-v4', $this->getLibraryUrl("/js/debug-bar.js"), array('jquery'), - '20170516' + '20201209' ); } diff --git a/js/debug-bar.js b/js/debug-bar.js index b8435db..2452c02 100644 --- a/js/debug-bar.js +++ b/js/debug-bar.js @@ -20,12 +20,12 @@ jQuery(function($) { ); } - $('.puc-debug-bar-panel-v4 input[name="puc-check-now-button"]').click(function() { + $('.puc-debug-bar-panel-v4 input[name="puc-check-now-button"]').on('click', function() { runAjaxAction(this, 'puc_v4_debug_check_now'); return false; }); - $('.puc-debug-bar-panel-v4 input[name="puc-request-info-button"]').click(function() { + $('.puc-debug-bar-panel-v4 input[name="puc-request-info-button"]').on('click', function() { runAjaxAction(this, 'puc_v4_debug_request_info'); return false; }); From 8a1a779f00ebc47a1054c81f9bf67441cbc5d93e Mon Sep 17 00:00:00 2001 From: Marco Rocca Date: Fri, 12 Mar 2021 00:10:50 +0100 Subject: [PATCH 07/10] Fixed wrong call to inexistent property --- Puc/v4p10/Plugin/Ui.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Puc/v4p10/Plugin/Ui.php b/Puc/v4p10/Plugin/Ui.php index 1ff18d6..1e8de2b 100644 --- a/Puc/v4p10/Plugin/Ui.php +++ b/Puc/v4p10/Plugin/Ui.php @@ -156,8 +156,9 @@ if ( !class_exists('Puc_v4p10_Plugin_Ui', false) ): if ( $shouldCheck ) { $update = $this->updateChecker->checkForUpdates(); $status = ($update === null) ? 'no_update' : 'update_available'; + $lastRequestApiErrors = $this->updateChecker->getLastRequestApiErrors(); - if ( ($update === null) && !empty($this->lastRequestApiErrors) ) { + if ( ($update === null) && !empty($lastRequestApiErrors) ) { //Some errors are not critical. For example, if PUC tries to retrieve the readme.txt //file from GitHub and gets a 404, that's an API error, but it doesn't prevent updates //from working. Maybe the plugin simply doesn't have a readme. @@ -169,7 +170,7 @@ if ( !class_exists('Puc_v4p10_Plugin_Ui', false) ): 'puc-bitbucket-http-error', ); - foreach ($this->lastRequestApiErrors as $item) { + foreach ($lastRequestApiErrors as $item) { $wpError = $item['error']; /** @var WP_Error $wpError */ if ( !in_array($wpError->get_error_code(), $questionableErrorCodes) ) { @@ -180,7 +181,7 @@ if ( !class_exists('Puc_v4p10_Plugin_Ui', false) ): if ( $foundCriticalErrors ) { $status = 'error'; - set_site_transient($this->manualCheckErrorTransient, $this->lastRequestApiErrors, 60); + set_site_transient($this->manualCheckErrorTransient, $lastRequestApiErrors, 60); } } From 06bc75f9af0bbfa0786ee09f5c5fb05ea89b0d8d Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Mon, 15 Mar 2021 18:02:04 +0200 Subject: [PATCH 08/10] Change version infix from v4p10 to v4p11 Step 1 of version bump --- Puc/v4/Factory.php | 2 +- Puc/v4p10/Autoloader.php | 4 +-- Puc/v4p10/DebugBar/Extension.php | 16 ++++----- Puc/v4p10/DebugBar/Panel.php | 6 ++-- Puc/v4p10/DebugBar/PluginExtension.php | 8 ++--- Puc/v4p10/DebugBar/PluginPanel.php | 6 ++-- Puc/v4p10/DebugBar/ThemePanel.php | 6 ++-- Puc/v4p10/Factory.php | 10 +++--- Puc/v4p10/InstalledPackage.php | 6 ++-- Puc/v4p10/Metadata.php | 4 +-- Puc/v4p10/OAuthSignature.php | 4 +-- Puc/v4p10/Plugin/Info.php | 4 +-- Puc/v4p10/Plugin/Package.php | 10 +++--- Puc/v4p10/Plugin/Ui.php | 6 ++-- Puc/v4p10/Plugin/Update.php | 16 ++++----- Puc/v4p10/Plugin/UpdateChecker.php | 34 +++++++++---------- Puc/v4p10/Scheduler.php | 14 ++++---- Puc/v4p10/StateStore.php | 18 +++++----- Puc/v4p10/Theme/Package.php | 4 +-- Puc/v4p10/Theme/Update.php | 8 ++--- Puc/v4p10/Theme/UpdateChecker.php | 20 +++++------ Puc/v4p10/Update.php | 4 +-- Puc/v4p10/UpdateChecker.php | 46 +++++++++++++------------- Puc/v4p10/UpgraderStatus.php | 4 +-- Puc/v4p10/Utils.php | 4 +-- Puc/v4p10/Vcs/Api.php | 14 ++++---- Puc/v4p10/Vcs/BaseChecker.php | 6 ++-- Puc/v4p10/Vcs/BitBucketApi.php | 24 +++++++------- Puc/v4p10/Vcs/GitHubApi.php | 18 +++++----- Puc/v4p10/Vcs/GitLabApi.php | 16 ++++----- Puc/v4p10/Vcs/PluginUpdateChecker.php | 16 ++++----- Puc/v4p10/Vcs/Reference.php | 4 +-- Puc/v4p10/Vcs/ThemeUpdateChecker.php | 18 +++++----- README.md | 8 ++--- composer.json | 2 +- languages/plugin-update-checker.pot | 12 +++---- load-v4p10.php | 24 +++++++------- plugin-update-checker.php | 6 ++-- 38 files changed, 216 insertions(+), 216 deletions(-) diff --git a/Puc/v4/Factory.php b/Puc/v4/Factory.php index 32673c9..ac21a55 100644 --- a/Puc/v4/Factory.php +++ b/Puc/v4/Factory.php @@ -1,6 +1,6 @@ updateChecker = $updateChecker; @@ -163,11 +163,11 @@ if ( !class_exists('Puc_v4p10_DebugBar_Extension', false) ): $absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/')); //Where is the library located inside the WordPress directory structure? - $absolutePath = Puc_v4p10_Factory::normalizePath($absolutePath); + $absolutePath = Puc_v4p11_Factory::normalizePath($absolutePath); - $pluginDir = Puc_v4p10_Factory::normalizePath(WP_PLUGIN_DIR); - $muPluginDir = Puc_v4p10_Factory::normalizePath(WPMU_PLUGIN_DIR); - $themeDir = Puc_v4p10_Factory::normalizePath(get_theme_root()); + $pluginDir = Puc_v4p11_Factory::normalizePath(WP_PLUGIN_DIR); + $muPluginDir = Puc_v4p11_Factory::normalizePath(WPMU_PLUGIN_DIR); + $themeDir = Puc_v4p11_Factory::normalizePath(get_theme_root()); if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) { //It's part of a plugin. diff --git a/Puc/v4p10/DebugBar/Panel.php b/Puc/v4p10/DebugBar/Panel.php index ecd0641..666cdf4 100644 --- a/Puc/v4p10/DebugBar/Panel.php +++ b/Puc/v4p10/DebugBar/Panel.php @@ -1,9 +1,9 @@ '; diff --git a/Puc/v4p10/DebugBar/PluginExtension.php b/Puc/v4p10/DebugBar/PluginExtension.php index 863ed73..edc4a2f 100644 --- a/Puc/v4p10/DebugBar/PluginExtension.php +++ b/Puc/v4p10/DebugBar/PluginExtension.php @@ -1,12 +1,12 @@ pluginAbsolutePath); //If realpath() fails, just normalize the syntax instead. if (($muPluginDir === false) || ($pluginPath === false)) { - $muPluginDir = Puc_v4p10_Factory::normalizePath(WPMU_PLUGIN_DIR); - $pluginPath = Puc_v4p10_Factory::normalizePath($this->pluginAbsolutePath); + $muPluginDir = Puc_v4p11_Factory::normalizePath(WPMU_PLUGIN_DIR); + $pluginPath = Puc_v4p11_Factory::normalizePath($this->pluginAbsolutePath); } $cachedResult = (strpos($pluginPath, $muPluginDir) === 0); diff --git a/Puc/v4p10/Plugin/Ui.php b/Puc/v4p10/Plugin/Ui.php index 1e8de2b..8aa4b35 100644 --- a/Puc/v4p10/Plugin/Ui.php +++ b/Puc/v4p10/Plugin/Ui.php @@ -1,14 +1,14 @@ updateChecker = $updateChecker; diff --git a/Puc/v4p10/Plugin/Update.php b/Puc/v4p10/Plugin/Update.php index 89293c5..a5ebd4d 100644 --- a/Puc/v4p10/Plugin/Update.php +++ b/Puc/v4p10/Plugin/Update.php @@ -1,5 +1,5 @@ pluginFile, array($this, 'removeHooks')); - $this->extraUi = new Puc_v4p10_Plugin_Ui($this); + $this->extraUi = new Puc_v4p11_Plugin_Ui($this); } /** * Create an instance of the scheduler. * * @param int $checkPeriod - * @return Puc_v4p10_Scheduler + * @return Puc_v4p11_Scheduler */ protected function createScheduler($checkPeriod) { - $scheduler = new Puc_v4p10_Scheduler($this, $checkPeriod, array('load-plugins.php')); + $scheduler = new Puc_v4p11_Scheduler($this, $checkPeriod, array('load-plugins.php')); register_deactivation_hook($this->pluginFile, array($scheduler, 'removeUpdaterCron')); return $scheduler; } @@ -124,13 +124,13 @@ if ( !class_exists('Puc_v4p10_Plugin_UpdateChecker', false) ): * @uses wp_remote_get() * * @param array $queryArgs Additional query arguments to append to the request. Optional. - * @return Puc_v4p10_Plugin_Info + * @return Puc_v4p11_Plugin_Info */ public function requestInfo($queryArgs = array()) { - list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p10_Plugin_Info', 'request_info', $queryArgs); + list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p11_Plugin_Info', 'request_info', $queryArgs); if ( $pluginInfo !== null ) { - /** @var Puc_v4p10_Plugin_Info $pluginInfo */ + /** @var Puc_v4p11_Plugin_Info $pluginInfo */ $pluginInfo->filename = $this->pluginFile; $pluginInfo->slug = $this->slug; } @@ -144,7 +144,7 @@ if ( !class_exists('Puc_v4p10_Plugin_UpdateChecker', false) ): * * @uses PluginUpdateChecker::requestInfo() * - * @return Puc_v4p10_Update|null An instance of Plugin_Update, or NULL when no updates are available. + * @return Puc_v4p11_Update|null An instance of Plugin_Update, or NULL when no updates are available. */ public function requestUpdate() { //For the sake of simplicity, this function just calls requestInfo() @@ -153,7 +153,7 @@ if ( !class_exists('Puc_v4p10_Plugin_UpdateChecker', false) ): if ( $pluginInfo === null ){ return null; } - $update = Puc_v4p10_Plugin_Update::fromPluginInfo($pluginInfo); + $update = Puc_v4p11_Plugin_Update::fromPluginInfo($pluginInfo); $update = $this->filterUpdateResult($update); @@ -281,12 +281,12 @@ if ( !class_exists('Puc_v4p10_Plugin_UpdateChecker', false) ): * Uses cached update data. To retrieve update information straight from * the metadata URL, call requestUpdate() instead. * - * @return Puc_v4p10_Plugin_Update|null + * @return Puc_v4p11_Plugin_Update|null */ public function getUpdate() { $update = parent::getUpdate(); if ( isset($update) ) { - /** @var Puc_v4p10_Plugin_Update $update */ + /** @var Puc_v4p11_Plugin_Update $update */ $update->filename = $this->pluginFile; } return $update; @@ -391,20 +391,20 @@ if ( !class_exists('Puc_v4p10_Plugin_UpdateChecker', false) ): } protected function createDebugBarExtension() { - return new Puc_v4p10_DebugBar_PluginExtension($this); + return new Puc_v4p11_DebugBar_PluginExtension($this); } /** * Create a package instance that represents this plugin or theme. * - * @return Puc_v4p10_InstalledPackage + * @return Puc_v4p11_InstalledPackage */ protected function createInstalledPackage() { - return new Puc_v4p10_Plugin_Package($this->pluginAbsolutePath, $this); + return new Puc_v4p11_Plugin_Package($this->pluginAbsolutePath, $this); } /** - * @return Puc_v4p10_Plugin_Package + * @return Puc_v4p11_Plugin_Package */ public function getInstalledPackage() { return $this->package; diff --git a/Puc/v4p10/Scheduler.php b/Puc/v4p10/Scheduler.php index 3e9857b..dd3c3c3 100644 --- a/Puc/v4p10/Scheduler.php +++ b/Puc/v4p10/Scheduler.php @@ -1,11 +1,11 @@ updateChecker, 'Puc_v4p10_Theme_UpdateChecker') ) { + if ( is_a($this->updateChecker, 'Puc_v4p11_Theme_UpdateChecker') ) { if ( 'theme' !== $upgradeInfo['type'] || !isset($upgradeInfo['themes']) ) { return; } @@ -130,7 +130,7 @@ if ( !class_exists('Puc_v4p10_Scheduler', false) ): } } - if ( is_a($this->updateChecker, 'Puc_v4p10_Plugin_UpdateChecker') ) { + if ( is_a($this->updateChecker, 'Puc_v4p11_Plugin_UpdateChecker') ) { if ( 'plugin' !== $upgradeInfo['type'] || !isset($upgradeInfo['plugins']) ) { return; } diff --git a/Puc/v4p10/StateStore.php b/Puc/v4p10/StateStore.php index 903fee1..01abcc9 100644 --- a/Puc/v4p10/StateStore.php +++ b/Puc/v4p10/StateStore.php @@ -1,8 +1,8 @@ lazyLoad(); @@ -73,10 +73,10 @@ if ( !class_exists('Puc_v4p10_StateStore', false) ): } /** - * @param Puc_v4p10_Update|null $update + * @param Puc_v4p11_Update|null $update * @return $this */ - public function setUpdate(Puc_v4p10_Update $update = null) { + public function setUpdate(Puc_v4p11_Update $update = null) { $this->lazyLoad(); $this->update = $update; return $this; @@ -138,7 +138,7 @@ if ( !class_exists('Puc_v4p10_StateStore', false) ): $updateClass = get_class($this->update); $state->updateClass = $updateClass; $prefix = $this->getLibPrefix(); - if ( Puc_v4p10_Utils::startsWith($updateClass, $prefix) ) { + if ( Puc_v4p11_Utils::startsWith($updateClass, $prefix) ) { $state->updateBaseClass = substr($updateClass, strlen($prefix)); } } @@ -169,8 +169,8 @@ if ( !class_exists('Puc_v4p10_StateStore', false) ): return; } - $this->lastCheck = intval(Puc_v4p10_Utils::get($state, 'lastCheck', 0)); - $this->checkedVersion = Puc_v4p10_Utils::get($state, 'checkedVersion', ''); + $this->lastCheck = intval(Puc_v4p11_Utils::get($state, 'lastCheck', 0)); + $this->checkedVersion = Puc_v4p11_Utils::get($state, 'checkedVersion', ''); $this->update = null; if ( isset($state->update) ) { diff --git a/Puc/v4p10/Theme/Package.php b/Puc/v4p10/Theme/Package.php index 5d9243b..3cfbce9 100644 --- a/Puc/v4p10/Theme/Package.php +++ b/Puc/v4p10/Theme/Package.php @@ -1,7 +1,7 @@ requestMetadata('Puc_v4p10_Theme_Update', 'request_update'); + list($themeUpdate, $result) = $this->requestMetadata('Puc_v4p11_Theme_Update', 'request_update'); if ( $themeUpdate !== null ) { - /** @var Puc_v4p10_Theme_Update $themeUpdate */ + /** @var Puc_v4p11_Theme_Update $themeUpdate */ $themeUpdate->slug = $this->slug; } @@ -71,10 +71,10 @@ if ( !class_exists('Puc_v4p10_Theme_UpdateChecker', false) ): * Create an instance of the scheduler. * * @param int $checkPeriod - * @return Puc_v4p10_Scheduler + * @return Puc_v4p11_Scheduler */ protected function createScheduler($checkPeriod) { - return new Puc_v4p10_Scheduler($this, $checkPeriod, array('load-themes.php')); + return new Puc_v4p11_Scheduler($this, $checkPeriod, array('load-themes.php')); } /** @@ -88,7 +88,7 @@ if ( !class_exists('Puc_v4p10_Theme_UpdateChecker', false) ): } protected function createDebugBarExtension() { - return new Puc_v4p10_DebugBar_Extension($this, 'Puc_v4p10_DebugBar_ThemePanel'); + return new Puc_v4p11_DebugBar_Extension($this, 'Puc_v4p11_DebugBar_ThemePanel'); } /** @@ -142,10 +142,10 @@ if ( !class_exists('Puc_v4p10_Theme_UpdateChecker', false) ): /** * Create a package instance that represents this plugin or theme. * - * @return Puc_v4p10_InstalledPackage + * @return Puc_v4p11_InstalledPackage */ protected function createInstalledPackage() { - return new Puc_v4p10_Theme_Package($this->stylesheet, $this); + return new Puc_v4p11_Theme_Package($this->stylesheet, $this); } } diff --git a/Puc/v4p10/Update.php b/Puc/v4p10/Update.php index b36b18b..82c048a 100644 --- a/Puc/v4p10/Update.php +++ b/Puc/v4p10/Update.php @@ -1,5 +1,5 @@ package = $this->createInstalledPackage(); $this->scheduler = $this->createScheduler($checkPeriod); - $this->upgraderStatus = new Puc_v4p10_UpgraderStatus(); - $this->updateState = new Puc_v4p10_StateStore($this->optionName); + $this->upgraderStatus = new Puc_v4p11_UpgraderStatus(); + $this->updateState = new Puc_v4p11_StateStore($this->optionName); if ( did_action('init') ) { $this->loadTextDomain(); @@ -218,12 +218,12 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): /** * Create a package instance that represents this plugin or theme. * - * @return Puc_v4p10_InstalledPackage + * @return Puc_v4p11_InstalledPackage */ abstract protected function createInstalledPackage(); /** - * @return Puc_v4p10_InstalledPackage + * @return Puc_v4p11_InstalledPackage */ public function getInstalledPackage() { return $this->package; @@ -236,14 +236,14 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): * and substitute their own scheduler. * * @param int $checkPeriod - * @return Puc_v4p10_Scheduler + * @return Puc_v4p11_Scheduler */ abstract protected function createScheduler($checkPeriod); /** * Check for updates. The results are stored in the DB option specified in $optionName. * - * @return Puc_v4p10_Update|null + * @return Puc_v4p11_Update|null */ public function checkForUpdates() { $installedVersion = $this->getInstalledVersion(); @@ -277,7 +277,7 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): /** * Load the update checker state from the DB. * - * @return Puc_v4p10_StateStore + * @return Puc_v4p11_StateStore */ public function getUpdateState() { return $this->updateState->lazyLoad(); @@ -302,7 +302,7 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): * Uses cached update data. To retrieve update information straight from * the metadata URL, call requestUpdate() instead. * - * @return Puc_v4p10_Update|null + * @return Puc_v4p11_Update|null */ public function getUpdate() { $update = $this->updateState->getUpdate(); @@ -323,16 +323,16 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): * * Subclasses should run the update through filterUpdateResult before returning it. * - * @return Puc_v4p10_Update An instance of Update, or NULL when no updates are available. + * @return Puc_v4p11_Update An instance of Update, or NULL when no updates are available. */ abstract public function requestUpdate(); /** * Filter the result of a requestUpdate() call. * - * @param Puc_v4p10_Update|null $update + * @param Puc_v4p11_Update|null $update * @param array|WP_Error|null $httpResult The value returned by wp_remote_get(), if any. - * @return Puc_v4p10_Update + * @return Puc_v4p11_Update */ protected function filterUpdateResult($update, $httpResult = null) { //Let plugins/themes modify the update. @@ -355,9 +355,9 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): * "Compatibility: Unknown". * The function mimics how wordpress.org API crafts the "tested" field out of "Tested up to". * - * @param Puc_v4p10_Metadata|null $update + * @param Puc_v4p11_Metadata|null $update */ - protected function fixSupportedWordpressVersion(Puc_v4p10_Metadata $update = null) { + protected function fixSupportedWordpressVersion(Puc_v4p11_Metadata $update = null) { if ( !isset($update->tested) || !preg_match('/^\d++\.\d++$/', $update->tested) ) { return; } @@ -638,7 +638,7 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): * @param string $metaClass Parse the JSON as an instance of this class. It must have a static fromJson method. * @param string $filterRoot * @param array $queryArgs Additional query arguments. - * @return array [Puc_v4p10_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get(). + * @return array [Puc_v4p11_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get(). */ protected function requestMetadata($metaClass, $filterRoot, $queryArgs = array()) { //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()). @@ -980,13 +980,13 @@ if ( !class_exists('Puc_v4p10_UpdateChecker', false) ): } protected function createDebugBarExtension() { - return new Puc_v4p10_DebugBar_Extension($this); + return new Puc_v4p11_DebugBar_Extension($this); } /** * Display additional configuration details in the Debug Bar panel. * - * @param Puc_v4p10_DebugBar_Panel $panel + * @param Puc_v4p11_DebugBar_Panel $panel */ public function onDisplayConfiguration($panel) { //Do nothing. Subclasses can use this to add additional info to the panel. diff --git a/Puc/v4p10/UpgraderStatus.php b/Puc/v4p10/UpgraderStatus.php index 2c2a625..8c0006e 100644 --- a/Puc/v4p10/UpgraderStatus.php +++ b/Puc/v4p10/UpgraderStatus.php @@ -1,5 +1,5 @@ $branch->name, 'updated' => $branch->target->date, 'downloadUrl' => $this->getDownloadUrl($branch->name), @@ -70,7 +70,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): * Get a specific tag. * * @param string $tagName - * @return Puc_v4p10_Vcs_Reference|null + * @return Puc_v4p11_Vcs_Reference|null */ public function getTag($tagName) { $tag = $this->api('/refs/tags/' . $tagName); @@ -78,7 +78,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): return null; } - return new Puc_v4p10_Vcs_Reference(array( + return new Puc_v4p11_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'updated' => $tag->target->date, @@ -89,7 +89,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p10_Vcs_Reference|null + * @return Puc_v4p11_Vcs_Reference|null */ public function getLatestTag() { $tags = $this->api('/refs/tags?sort=-target.date'); @@ -103,7 +103,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): //Return the first result. if ( !empty($versionTags) ) { $tag = $versionTags[0]; - return new Puc_v4p10_Vcs_Reference(array( + return new Puc_v4p11_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'updated' => $tag->target->date, @@ -117,7 +117,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): * Get the tag/ref specified by the "Stable tag" header in the readme.txt of a given branch. * * @param string $branch - * @return null|Puc_v4p10_Vcs_Reference + * @return null|Puc_v4p11_Vcs_Reference */ protected function getStableTag($branch) { $remoteReadme = $this->getRemoteReadme($branch); @@ -187,7 +187,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): */ public function api($url, $version = '2.0') { $url = ltrim($url, '/'); - $isSrcResource = Puc_v4p10_Utils::startsWith($url, 'src/'); + $isSrcResource = Puc_v4p11_Utils::startsWith($url, 'src/'); $url = implode('/', array( 'https://api.bitbucket.org', @@ -242,7 +242,7 @@ if ( !class_exists('Puc_v4p10_Vcs_BitBucketApi', false) ): parent::setAuthentication($credentials); if ( !empty($credentials) && !empty($credentials['consumer_key']) ) { - $this->oauth = new Puc_v4p10_OAuthSignature( + $this->oauth = new Puc_v4p11_OAuthSignature( $credentials['consumer_key'], $credentials['consumer_secret'] ); diff --git a/Puc/v4p10/Vcs/GitHubApi.php b/Puc/v4p10/Vcs/GitHubApi.php index ada0d13..79f3c56 100644 --- a/Puc/v4p10/Vcs/GitHubApi.php +++ b/Puc/v4p10/Vcs/GitHubApi.php @@ -1,8 +1,8 @@ api('/repos/:user/:repo/releases/latest'); @@ -65,7 +65,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): return null; } - $reference = new Puc_v4p10_Vcs_Reference(array( + $reference = new Puc_v4p11_Vcs_Reference(array( 'name' => $release->tag_name, 'version' => ltrim($release->tag_name, 'v'), //Remove the "v" prefix from "v1.2.3". 'downloadUrl' => $release->zipball_url, @@ -109,7 +109,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p10_Vcs_Reference|null + * @return Puc_v4p11_Vcs_Reference|null */ public function getLatestTag() { $tags = $this->api('/repos/:user/:repo/tags'); @@ -124,7 +124,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): } $tag = $versionTags[0]; - return new Puc_v4p10_Vcs_Reference(array( + return new Puc_v4p11_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'downloadUrl' => $tag->zipball_url, @@ -136,7 +136,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): * Get a branch by name. * * @param string $branchName - * @return null|Puc_v4p10_Vcs_Reference + * @return null|Puc_v4p11_Vcs_Reference */ public function getBranch($branchName) { $branch = $this->api('/repos/:user/:repo/branches/' . $branchName); @@ -144,7 +144,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): return null; } - $reference = new Puc_v4p10_Vcs_Reference(array( + $reference = new Puc_v4p11_Vcs_Reference(array( 'name' => $branch->name, 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), 'apiResponse' => $branch, @@ -314,7 +314,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitHubApi', false) ): * Figure out which reference (i.e tag or branch) contains the latest version. * * @param string $configBranch Start looking in this branch. - * @return null|Puc_v4p10_Vcs_Reference + * @return null|Puc_v4p11_Vcs_Reference */ public function chooseReference($configBranch) { $updateSource = null; diff --git a/Puc/v4p10/Vcs/GitLabApi.php b/Puc/v4p10/Vcs/GitLabApi.php index a1a313c..8fd3f45 100644 --- a/Puc/v4p10/Vcs/GitLabApi.php +++ b/Puc/v4p10/Vcs/GitLabApi.php @@ -1,8 +1,8 @@ getLatestTag(); @@ -100,7 +100,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitLabApi', false) ): /** * Get the tag that looks like the highest version number. * - * @return Puc_v4p10_Vcs_Reference|null + * @return Puc_v4p11_Vcs_Reference|null */ public function getLatestTag() { $tags = $this->api('/:id/repository/tags'); @@ -114,7 +114,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitLabApi', false) ): } $tag = $versionTags[0]; - return new Puc_v4p10_Vcs_Reference(array( + return new Puc_v4p11_Vcs_Reference(array( 'name' => $tag->name, 'version' => ltrim($tag->name, 'v'), 'downloadUrl' => $this->buildArchiveDownloadUrl($tag->name), @@ -126,7 +126,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitLabApi', false) ): * Get a branch by name. * * @param string $branchName - * @return null|Puc_v4p10_Vcs_Reference + * @return null|Puc_v4p11_Vcs_Reference */ public function getBranch($branchName) { $branch = $this->api('/:id/repository/branches/' . $branchName); @@ -134,7 +134,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitLabApi', false) ): return null; } - $reference = new Puc_v4p10_Vcs_Reference(array( + $reference = new Puc_v4p11_Vcs_Reference(array( 'name' => $branch->name, 'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name), 'apiResponse' => $branch, @@ -283,7 +283,7 @@ if ( !class_exists('Puc_v4p10_Vcs_GitLabApi', false) ): * Figure out which reference (i.e tag or branch) contains the latest version. * * @param string $configBranch Start looking in this branch. - * @return null|Puc_v4p10_Vcs_Reference + * @return null|Puc_v4p11_Vcs_Reference */ public function chooseReference($configBranch) { $updateSource = null; diff --git a/Puc/v4p10/Vcs/PluginUpdateChecker.php b/Puc/v4p10/Vcs/PluginUpdateChecker.php index aba4b32..bc6d94a 100644 --- a/Puc/v4p10/Vcs/PluginUpdateChecker.php +++ b/Puc/v4p10/Vcs/PluginUpdateChecker.php @@ -1,21 +1,21 @@ api; $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); - $info = new Puc_v4p10_Plugin_Info(); + $info = new Puc_v4p11_Plugin_Info(); $info->filename = $this->pluginFile; $info->slug = $this->slug; @@ -124,7 +124,7 @@ if ( !class_exists('Puc_v4p10_Vcs_PluginUpdateChecker') ): * Copy plugin metadata from a file header to a Plugin Info object. * * @param array $fileHeader - * @param Puc_v4p10_Plugin_Info $pluginInfo + * @param Puc_v4p11_Plugin_Info $pluginInfo */ protected function setInfoFromHeader($fileHeader, $pluginInfo) { $headerToPropertyMap = array( @@ -157,7 +157,7 @@ if ( !class_exists('Puc_v4p10_Vcs_PluginUpdateChecker') ): * Copy plugin metadata from the remote readme.txt file. * * @param string $ref GitHub tag or branch where to look for the readme. - * @param Puc_v4p10_Plugin_Info $pluginInfo + * @param Puc_v4p11_Plugin_Info $pluginInfo */ protected function setInfoFromRemoteReadme($ref, $pluginInfo) { $readme = $this->api->getRemoteReadme($ref); diff --git a/Puc/v4p10/Vcs/Reference.php b/Puc/v4p10/Vcs/Reference.php index 85250cd..0bf8c69 100644 --- a/Puc/v4p10/Vcs/Reference.php +++ b/Puc/v4p10/Vcs/Reference.php @@ -1,5 +1,5 @@ api; $api->setLocalDirectory($this->package->getAbsoluteDirectoryPath()); - $update = new Puc_v4p10_Theme_Update(); + $update = new Puc_v4p11_Theme_Update(); $update->slug = $this->slug; //Figure out which reference (tag or branch) we'll use to get the latest version of the theme. @@ -60,13 +60,13 @@ if ( !class_exists('Puc_v4p10_Vcs_ThemeUpdateChecker', false) ): //Get headers from the main stylesheet in this branch/tag. Its "Version" header and other metadata //are what the WordPress install will actually see after upgrading, so they take precedence over releases/tags. $remoteHeader = $this->package->getFileHeader($api->getRemoteFile('style.css', $ref)); - $update->version = Puc_v4p10_Utils::findNotEmpty(array( + $update->version = Puc_v4p11_Utils::findNotEmpty(array( $remoteHeader['Version'], - Puc_v4p10_Utils::get($updateSource, 'version'), + Puc_v4p11_Utils::get($updateSource, 'version'), )); //The details URL defaults to the Theme URI header or the repository URL. - $update->details_url = Puc_v4p10_Utils::findNotEmpty(array( + $update->details_url = Puc_v4p11_Utils::findNotEmpty(array( $remoteHeader['ThemeURI'], $this->package->getHeaderValue('ThemeURI'), $this->metadataUrl, diff --git a/README.md b/README.md index ddb9fb5..d946c84 100644 --- a/README.md +++ b/README.md @@ -246,8 +246,8 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli Alternatively, if you're using a self-hosted GitLab instance, initialize the update checker like this: ```php - $myUpdateChecker = new Puc_v4p10_Vcs_PluginUpdateChecker( - new Puc_v4p10_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'), + $myUpdateChecker = new Puc_v4p11_Vcs_PluginUpdateChecker( + new Puc_v4p11_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'), __FILE__, 'unique-plugin-or-theme-slug' ); @@ -255,8 +255,8 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli ``` If you're using a self-hosted GitLab instance and [subgroups or nested groups](https://docs.gitlab.com/ce/user/group/subgroups/index.html), you have to tell the update checker which parts of the URL are subgroups: ```php - $myUpdateChecker = new Puc_v4p10_Vcs_PluginUpdateChecker( - new Puc_v4p10_Vcs_GitLabApi('https://myserver.com/group-name/subgroup-level1/subgroup-level2/subgroup-level3/repo-name/', null, 'subgroup-level1/subgroup-level2/subgroup-level3'), + $myUpdateChecker = new Puc_v4p11_Vcs_PluginUpdateChecker( + new Puc_v4p11_Vcs_GitLabApi('https://myserver.com/group-name/subgroup-level1/subgroup-level2/subgroup-level3/repo-name/', null, 'subgroup-level1/subgroup-level2/subgroup-level3'), __FILE__, 'unique-plugin-or-theme-slug' ); diff --git a/composer.json b/composer.json index db487f3..6064bd4 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ "ext-json": "*" }, "autoload": { - "files": ["load-v4p10.php"] + "files": ["load-v4p11.php"] } } diff --git a/languages/plugin-update-checker.pot b/languages/plugin-update-checker.pot index 29d1f40..99cc24c 100644 --- a/languages/plugin-update-checker.pot +++ b/languages/plugin-update-checker.pot @@ -17,33 +17,33 @@ msgstr "" "X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n" "X-Poedit-SearchPath-0: .\n" -#: Puc/v4p10/Plugin/Ui.php:128 +#: Puc/v4p11/Plugin/Ui.php:128 msgid "Check for updates" msgstr "" -#: Puc/v4p10/Plugin/Ui.php:213 +#: Puc/v4p11/Plugin/Ui.php:213 #, php-format msgctxt "the plugin title" msgid "The %s plugin is up to date." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:215 +#: Puc/v4p11/Plugin/Ui.php:215 #, php-format msgctxt "the plugin title" msgid "A new version of the %s plugin is available." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:217 +#: Puc/v4p11/Plugin/Ui.php:217 #, php-format msgctxt "the plugin title" msgid "Could not determine if updates are available for %s." msgstr "" -#: Puc/v4p10/Plugin/Ui.php:223 +#: Puc/v4p11/Plugin/Ui.php:223 #, php-format msgid "Unknown update checker status \"%s\"" msgstr "" -#: Puc/v4p10/Vcs/PluginUpdateChecker.php:98 +#: Puc/v4p11/Vcs/PluginUpdateChecker.php:98 msgid "There is no changelog available." msgstr "" diff --git a/load-v4p10.php b/load-v4p10.php index 5531938..76916cc 100644 --- a/load-v4p10.php +++ b/load-v4p10.php @@ -1,28 +1,28 @@ 'Puc_v4p10_Plugin_UpdateChecker', - 'Theme_UpdateChecker' => 'Puc_v4p10_Theme_UpdateChecker', + 'Plugin_UpdateChecker' => 'Puc_v4p11_Plugin_UpdateChecker', + 'Theme_UpdateChecker' => 'Puc_v4p11_Theme_UpdateChecker', - 'Vcs_PluginUpdateChecker' => 'Puc_v4p10_Vcs_PluginUpdateChecker', - 'Vcs_ThemeUpdateChecker' => 'Puc_v4p10_Vcs_ThemeUpdateChecker', + 'Vcs_PluginUpdateChecker' => 'Puc_v4p11_Vcs_PluginUpdateChecker', + 'Vcs_ThemeUpdateChecker' => 'Puc_v4p11_Vcs_ThemeUpdateChecker', - 'GitHubApi' => 'Puc_v4p10_Vcs_GitHubApi', - 'BitBucketApi' => 'Puc_v4p10_Vcs_BitBucketApi', - 'GitLabApi' => 'Puc_v4p10_Vcs_GitLabApi', + 'GitHubApi' => 'Puc_v4p11_Vcs_GitHubApi', + 'BitBucketApi' => 'Puc_v4p11_Vcs_BitBucketApi', + 'GitLabApi' => 'Puc_v4p11_Vcs_GitLabApi', ) as $pucGeneralClass => $pucVersionedClass ) { - Puc_v4_Factory::addVersion($pucGeneralClass, $pucVersionedClass, '4.10'); + Puc_v4_Factory::addVersion($pucGeneralClass, $pucVersionedClass, '4.11'); //Also add it to the minor-version factory in case the major-version factory //was already defined by another, older version of the update checker. - Puc_v4p10_Factory::addVersion($pucGeneralClass, $pucVersionedClass, '4.10'); + Puc_v4p11_Factory::addVersion($pucGeneralClass, $pucVersionedClass, '4.11'); } diff --git a/plugin-update-checker.php b/plugin-update-checker.php index 5a03ddb..f6ae63f 100644 --- a/plugin-update-checker.php +++ b/plugin-update-checker.php @@ -1,10 +1,10 @@ Date: Mon, 15 Mar 2021 18:07:52 +0200 Subject: [PATCH 09/10] Change version number in file/directory names Step 2 of version bump --- Puc/{v4p10 => v4p11}/Autoloader.php | 0 Puc/{v4p10 => v4p11}/DebugBar/Extension.php | 0 Puc/{v4p10 => v4p11}/DebugBar/Panel.php | 0 Puc/{v4p10 => v4p11}/DebugBar/PluginExtension.php | 0 Puc/{v4p10 => v4p11}/DebugBar/PluginPanel.php | 0 Puc/{v4p10 => v4p11}/DebugBar/ThemePanel.php | 0 Puc/{v4p10 => v4p11}/Factory.php | 0 Puc/{v4p10 => v4p11}/InstalledPackage.php | 0 Puc/{v4p10 => v4p11}/Metadata.php | 0 Puc/{v4p10 => v4p11}/OAuthSignature.php | 0 Puc/{v4p10 => v4p11}/Plugin/Info.php | 0 Puc/{v4p10 => v4p11}/Plugin/Package.php | 0 Puc/{v4p10 => v4p11}/Plugin/Ui.php | 0 Puc/{v4p10 => v4p11}/Plugin/Update.php | 0 Puc/{v4p10 => v4p11}/Plugin/UpdateChecker.php | 0 Puc/{v4p10 => v4p11}/Scheduler.php | 0 Puc/{v4p10 => v4p11}/StateStore.php | 0 Puc/{v4p10 => v4p11}/Theme/Package.php | 0 Puc/{v4p10 => v4p11}/Theme/Update.php | 0 Puc/{v4p10 => v4p11}/Theme/UpdateChecker.php | 0 Puc/{v4p10 => v4p11}/Update.php | 0 Puc/{v4p10 => v4p11}/UpdateChecker.php | 0 Puc/{v4p10 => v4p11}/UpgraderStatus.php | 0 Puc/{v4p10 => v4p11}/Utils.php | 0 Puc/{v4p10 => v4p11}/Vcs/Api.php | 0 Puc/{v4p10 => v4p11}/Vcs/BaseChecker.php | 0 Puc/{v4p10 => v4p11}/Vcs/BitBucketApi.php | 0 Puc/{v4p10 => v4p11}/Vcs/GitHubApi.php | 0 Puc/{v4p10 => v4p11}/Vcs/GitLabApi.php | 0 Puc/{v4p10 => v4p11}/Vcs/PluginUpdateChecker.php | 0 Puc/{v4p10 => v4p11}/Vcs/Reference.php | 0 Puc/{v4p10 => v4p11}/Vcs/ThemeUpdateChecker.php | 0 load-v4p10.php => load-v4p11.php | 0 33 files changed, 0 insertions(+), 0 deletions(-) rename Puc/{v4p10 => v4p11}/Autoloader.php (100%) rename Puc/{v4p10 => v4p11}/DebugBar/Extension.php (100%) rename Puc/{v4p10 => v4p11}/DebugBar/Panel.php (100%) rename Puc/{v4p10 => v4p11}/DebugBar/PluginExtension.php (100%) rename Puc/{v4p10 => v4p11}/DebugBar/PluginPanel.php (100%) rename Puc/{v4p10 => v4p11}/DebugBar/ThemePanel.php (100%) rename Puc/{v4p10 => v4p11}/Factory.php (100%) rename Puc/{v4p10 => v4p11}/InstalledPackage.php (100%) rename Puc/{v4p10 => v4p11}/Metadata.php (100%) rename Puc/{v4p10 => v4p11}/OAuthSignature.php (100%) rename Puc/{v4p10 => v4p11}/Plugin/Info.php (100%) rename Puc/{v4p10 => v4p11}/Plugin/Package.php (100%) rename Puc/{v4p10 => v4p11}/Plugin/Ui.php (100%) rename Puc/{v4p10 => v4p11}/Plugin/Update.php (100%) rename Puc/{v4p10 => v4p11}/Plugin/UpdateChecker.php (100%) rename Puc/{v4p10 => v4p11}/Scheduler.php (100%) rename Puc/{v4p10 => v4p11}/StateStore.php (100%) rename Puc/{v4p10 => v4p11}/Theme/Package.php (100%) rename Puc/{v4p10 => v4p11}/Theme/Update.php (100%) rename Puc/{v4p10 => v4p11}/Theme/UpdateChecker.php (100%) rename Puc/{v4p10 => v4p11}/Update.php (100%) rename Puc/{v4p10 => v4p11}/UpdateChecker.php (100%) rename Puc/{v4p10 => v4p11}/UpgraderStatus.php (100%) rename Puc/{v4p10 => v4p11}/Utils.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/Api.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/BaseChecker.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/BitBucketApi.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/GitHubApi.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/GitLabApi.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/PluginUpdateChecker.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/Reference.php (100%) rename Puc/{v4p10 => v4p11}/Vcs/ThemeUpdateChecker.php (100%) rename load-v4p10.php => load-v4p11.php (100%) diff --git a/Puc/v4p10/Autoloader.php b/Puc/v4p11/Autoloader.php similarity index 100% rename from Puc/v4p10/Autoloader.php rename to Puc/v4p11/Autoloader.php diff --git a/Puc/v4p10/DebugBar/Extension.php b/Puc/v4p11/DebugBar/Extension.php similarity index 100% rename from Puc/v4p10/DebugBar/Extension.php rename to Puc/v4p11/DebugBar/Extension.php diff --git a/Puc/v4p10/DebugBar/Panel.php b/Puc/v4p11/DebugBar/Panel.php similarity index 100% rename from Puc/v4p10/DebugBar/Panel.php rename to Puc/v4p11/DebugBar/Panel.php diff --git a/Puc/v4p10/DebugBar/PluginExtension.php b/Puc/v4p11/DebugBar/PluginExtension.php similarity index 100% rename from Puc/v4p10/DebugBar/PluginExtension.php rename to Puc/v4p11/DebugBar/PluginExtension.php diff --git a/Puc/v4p10/DebugBar/PluginPanel.php b/Puc/v4p11/DebugBar/PluginPanel.php similarity index 100% rename from Puc/v4p10/DebugBar/PluginPanel.php rename to Puc/v4p11/DebugBar/PluginPanel.php diff --git a/Puc/v4p10/DebugBar/ThemePanel.php b/Puc/v4p11/DebugBar/ThemePanel.php similarity index 100% rename from Puc/v4p10/DebugBar/ThemePanel.php rename to Puc/v4p11/DebugBar/ThemePanel.php diff --git a/Puc/v4p10/Factory.php b/Puc/v4p11/Factory.php similarity index 100% rename from Puc/v4p10/Factory.php rename to Puc/v4p11/Factory.php diff --git a/Puc/v4p10/InstalledPackage.php b/Puc/v4p11/InstalledPackage.php similarity index 100% rename from Puc/v4p10/InstalledPackage.php rename to Puc/v4p11/InstalledPackage.php diff --git a/Puc/v4p10/Metadata.php b/Puc/v4p11/Metadata.php similarity index 100% rename from Puc/v4p10/Metadata.php rename to Puc/v4p11/Metadata.php diff --git a/Puc/v4p10/OAuthSignature.php b/Puc/v4p11/OAuthSignature.php similarity index 100% rename from Puc/v4p10/OAuthSignature.php rename to Puc/v4p11/OAuthSignature.php diff --git a/Puc/v4p10/Plugin/Info.php b/Puc/v4p11/Plugin/Info.php similarity index 100% rename from Puc/v4p10/Plugin/Info.php rename to Puc/v4p11/Plugin/Info.php diff --git a/Puc/v4p10/Plugin/Package.php b/Puc/v4p11/Plugin/Package.php similarity index 100% rename from Puc/v4p10/Plugin/Package.php rename to Puc/v4p11/Plugin/Package.php diff --git a/Puc/v4p10/Plugin/Ui.php b/Puc/v4p11/Plugin/Ui.php similarity index 100% rename from Puc/v4p10/Plugin/Ui.php rename to Puc/v4p11/Plugin/Ui.php diff --git a/Puc/v4p10/Plugin/Update.php b/Puc/v4p11/Plugin/Update.php similarity index 100% rename from Puc/v4p10/Plugin/Update.php rename to Puc/v4p11/Plugin/Update.php diff --git a/Puc/v4p10/Plugin/UpdateChecker.php b/Puc/v4p11/Plugin/UpdateChecker.php similarity index 100% rename from Puc/v4p10/Plugin/UpdateChecker.php rename to Puc/v4p11/Plugin/UpdateChecker.php diff --git a/Puc/v4p10/Scheduler.php b/Puc/v4p11/Scheduler.php similarity index 100% rename from Puc/v4p10/Scheduler.php rename to Puc/v4p11/Scheduler.php diff --git a/Puc/v4p10/StateStore.php b/Puc/v4p11/StateStore.php similarity index 100% rename from Puc/v4p10/StateStore.php rename to Puc/v4p11/StateStore.php diff --git a/Puc/v4p10/Theme/Package.php b/Puc/v4p11/Theme/Package.php similarity index 100% rename from Puc/v4p10/Theme/Package.php rename to Puc/v4p11/Theme/Package.php diff --git a/Puc/v4p10/Theme/Update.php b/Puc/v4p11/Theme/Update.php similarity index 100% rename from Puc/v4p10/Theme/Update.php rename to Puc/v4p11/Theme/Update.php diff --git a/Puc/v4p10/Theme/UpdateChecker.php b/Puc/v4p11/Theme/UpdateChecker.php similarity index 100% rename from Puc/v4p10/Theme/UpdateChecker.php rename to Puc/v4p11/Theme/UpdateChecker.php diff --git a/Puc/v4p10/Update.php b/Puc/v4p11/Update.php similarity index 100% rename from Puc/v4p10/Update.php rename to Puc/v4p11/Update.php diff --git a/Puc/v4p10/UpdateChecker.php b/Puc/v4p11/UpdateChecker.php similarity index 100% rename from Puc/v4p10/UpdateChecker.php rename to Puc/v4p11/UpdateChecker.php diff --git a/Puc/v4p10/UpgraderStatus.php b/Puc/v4p11/UpgraderStatus.php similarity index 100% rename from Puc/v4p10/UpgraderStatus.php rename to Puc/v4p11/UpgraderStatus.php diff --git a/Puc/v4p10/Utils.php b/Puc/v4p11/Utils.php similarity index 100% rename from Puc/v4p10/Utils.php rename to Puc/v4p11/Utils.php diff --git a/Puc/v4p10/Vcs/Api.php b/Puc/v4p11/Vcs/Api.php similarity index 100% rename from Puc/v4p10/Vcs/Api.php rename to Puc/v4p11/Vcs/Api.php diff --git a/Puc/v4p10/Vcs/BaseChecker.php b/Puc/v4p11/Vcs/BaseChecker.php similarity index 100% rename from Puc/v4p10/Vcs/BaseChecker.php rename to Puc/v4p11/Vcs/BaseChecker.php diff --git a/Puc/v4p10/Vcs/BitBucketApi.php b/Puc/v4p11/Vcs/BitBucketApi.php similarity index 100% rename from Puc/v4p10/Vcs/BitBucketApi.php rename to Puc/v4p11/Vcs/BitBucketApi.php diff --git a/Puc/v4p10/Vcs/GitHubApi.php b/Puc/v4p11/Vcs/GitHubApi.php similarity index 100% rename from Puc/v4p10/Vcs/GitHubApi.php rename to Puc/v4p11/Vcs/GitHubApi.php diff --git a/Puc/v4p10/Vcs/GitLabApi.php b/Puc/v4p11/Vcs/GitLabApi.php similarity index 100% rename from Puc/v4p10/Vcs/GitLabApi.php rename to Puc/v4p11/Vcs/GitLabApi.php diff --git a/Puc/v4p10/Vcs/PluginUpdateChecker.php b/Puc/v4p11/Vcs/PluginUpdateChecker.php similarity index 100% rename from Puc/v4p10/Vcs/PluginUpdateChecker.php rename to Puc/v4p11/Vcs/PluginUpdateChecker.php diff --git a/Puc/v4p10/Vcs/Reference.php b/Puc/v4p11/Vcs/Reference.php similarity index 100% rename from Puc/v4p10/Vcs/Reference.php rename to Puc/v4p11/Vcs/Reference.php diff --git a/Puc/v4p10/Vcs/ThemeUpdateChecker.php b/Puc/v4p11/Vcs/ThemeUpdateChecker.php similarity index 100% rename from Puc/v4p10/Vcs/ThemeUpdateChecker.php rename to Puc/v4p11/Vcs/ThemeUpdateChecker.php diff --git a/load-v4p10.php b/load-v4p11.php similarity index 100% rename from load-v4p10.php rename to load-v4p11.php From 703cbd854dbc660de1a943afae9a68a069264e8c Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Wed, 31 Mar 2021 17:30:10 +0300 Subject: [PATCH 10/10] Docs: Imply that the branch name is not optional The update checker will look for a `master` branch by default, but new repositories use the name `main` instead, and it is technically possible to use any branch as the default branch. So while you don't *have to* set the branch name, it's probably a good idea to always do that. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d946c84..ed08b17 100644 --- a/README.md +++ b/README.md @@ -101,12 +101,12 @@ By default, the library will check the specified URL for changes every 12 hours. __FILE__, 'unique-plugin-or-theme-slug' ); + + //Set the branch that contains the stable release. + $myUpdateChecker->setBranch('stable-branch-name'); //Optional: If you're using a private repository, specify the access token like this: $myUpdateChecker->setAuthentication('your-token-here'); - - //Optional: Set the branch that contains the stable release. - $myUpdateChecker->setBranch('stable-branch-name'); ``` 3. Plugins only: Add a `readme.txt` file formatted according to the [WordPress.org plugin readme standard](https://wordpress.org/plugins/readme.txt) to your repository. The contents of this file will be shown when the user clicks the "View version 1.2.3 details" link.