From 09509599040b26a58f0e8ecf1086e8ff3f87164f Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 25 Mar 2016 12:37:15 +1100 Subject: [PATCH] Do not show disabled plugins in the update list Fixes #1716 --- modules/system/classes/UpdateManager.php | 10 +++++++--- modules/system/models/PluginVersion.php | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index ee360bb85..829f3d03d 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -211,6 +211,7 @@ class UpdateManager $names = $installed->lists('name', 'code'); $icons = $installed->lists('icon', 'code'); $frozen = $installed->lists('is_frozen', 'code'); + $updatable = $installed->lists('is_updatable', 'code'); $build = Parameters::get('system::core.build'); $params = [ @@ -245,10 +246,13 @@ class UpdateManager $info['icon'] = isset($icons[$code]) ? $icons[$code] : false; /* - * If plugin has updates frozen, do not add it to the list - * and discount an update unit. + * If a plugin has updates frozen, or cannot be updated, + * do not add to the list and discount an update unit. */ - if (isset($frozen[$code]) && $frozen[$code]) { + if ( + (isset($frozen[$code]) && $frozen[$code]) || + (isset($updatable[$code]) && !$updatable[$code]) + ) { $updateCount = max(0, --$updateCount); } else { diff --git a/modules/system/models/PluginVersion.php b/modules/system/models/PluginVersion.php index 0754e4223..02513e8f1 100644 --- a/modules/system/models/PluginVersion.php +++ b/modules/system/models/PluginVersion.php @@ -79,7 +79,15 @@ class PluginVersion extends Model $this->description = Lang::get('system::lang.plugins.unknown_plugin'); $this->orphaned = true; } + } + /** + * Returns true if the plugin should be updated by the system. + * @return bool + */ + public function getIsUpdatableAttribute() + { + return !$this->is_disabled && !$this->disabledBySystem && !$this->disabledByConfig; } /**