Skip to content

Commit

Permalink
Merge pull request #555 from 10up/feature/update-plugin-checker
Browse files Browse the repository at this point in the history
Update `yahnis-elsts/plugin-update-checker` from 4.13 to 5.1
  • Loading branch information
dkotter authored Aug 18, 2023
2 parents bd9ea48 + 6be813c commit 5e545c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "GPLv2",
"require": {
"php": ">=7.4",
"yahnis-elsts/plugin-update-checker": "4.13",
"yahnis-elsts/plugin-update-checker": "5.1",
"ua-parser/uap-php": "dev-master"
},
"autoload": {
Expand Down Expand Up @@ -42,4 +42,4 @@
"!/vendor/"
]
}
}
}
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions includes/Classifai/Admin/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Classifai\Admin;

use Puc_v4_Factory;
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

/**
* Plugin update class.
Expand All @@ -24,7 +24,7 @@ class Update {
/**
* The update checker object.
*
* @var Puc_v4p13_Plugin_UpdateChecker
* @var YahnisElsts\PluginUpdateChecker\v5p1\Vcs\PluginUpdateChecker
*/
protected $updater;

Expand All @@ -34,7 +34,7 @@ class Update {
* @return bool
*/
public function can_register() {
return class_exists( '\Puc_v4_Factory' ) && self::license_check();
return class_exists( '\YahnisElsts\PluginUpdateChecker\v5\PucFactory' ) && self::license_check();
}

/**
Expand All @@ -52,7 +52,7 @@ public function register() {
* @return void
*/
public function init() {
$this->updater = Puc_v4_Factory::buildUpdateChecker(
$this->updater = PucFactory::buildUpdateChecker(
self::$repo_url,
CLASSIFAI_PLUGIN,
'classifai'
Expand Down Expand Up @@ -87,7 +87,9 @@ public function maybe_update( $transient ) {

// Adding the plugin info to the `no_update` property is required
// for the enable/disable auto-update links to appear correctly in the UI.
$transient->no_update[ $update->filename ] = $update;
if ( $update ) {
$transient->no_update[ $update->filename ] = $update;
}
}

return $transient;
Expand Down

0 comments on commit 5e545c1

Please sign in to comment.