diff --git a/lang/en/plugin.php b/lang/en/plugin.php index 7b62babd8bd2c..6b062117a61c7 100644 --- a/lang/en/plugin.php +++ b/lang/en/plugin.php @@ -50,6 +50,7 @@ $string['sourceext'] = 'Extension'; $string['sourcestd'] = 'Standard'; $string['status'] = 'Status'; +$string['status_delete'] = 'To be deleted'; $string['status_downgrade'] = 'Higher version already installed!'; $string['status_missing'] = 'Missing from disk!'; $string['status_new'] = 'To be installed'; diff --git a/lib/pluginlib.php b/lib/pluginlib.php index e0c22716dcca3..6ed56d3e6192f 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -47,6 +47,8 @@ class plugin_manager { const PLUGIN_STATUS_NEW = 'new'; /** the plugin is about to be upgraded */ const PLUGIN_STATUS_UPGRADE = 'upgrade'; + /** the standard plugin is about to be deleted */ + const PLUGIN_STATUS_DELETE = 'delete'; /** the version at the disk is lower than the one already installed */ const PLUGIN_STATUS_DOWNGRADE = 'downgrade'; /** the plugin is installed but missing from disk */ @@ -289,9 +291,32 @@ public function all_plugins_ok($moodleversion) { return true; } + /** + * Defines a list of all plugins that were originally shipped in the standard Moodle distribution, + * but are not anymore and are deleted during upgrades. + * + * The main purpose of this list is to hide missing plugins during upgrade. + * + * @param string $type plugin type + * @param string $name plugin name + * @return bool + */ + public static function is_deleted_standard_plugin($type, $name) { + static $plugins = array( + 'block' => array('admin', 'admin_tree', 'loancalc', 'search'), + 'filter' => array('mod_data', 'mod_glossary'), + ); + + if (!isset($plugins[$type])) { + return false; + } + return in_array($name, $plugins[$type]); + } + /** * Defines a white list of all plugins shipped in the standard Moodle distribution * + * @param string $type * @return false|array array of standard plugins or false if the type is unknown */ public static function standard_plugins_list($type) { @@ -809,6 +834,9 @@ public function init_is_standard() { $standard = array_flip($standard); if (isset($standard[$this->name])) { $this->source = plugin_manager::PLUGIN_SOURCE_STANDARD; + } else if (!is_null($this->versiondb) and is_null($this->versiondisk) + and plugin_manager::is_deleted_standard_plugin($this->type, $this->name)) { + $this->source = plugin_manager::PLUGIN_SOURCE_STANDARD; // to be deleted } else { $this->source = plugin_manager::PLUGIN_SOURCE_EXTENSION; } @@ -834,7 +862,11 @@ public function get_status() { return plugin_manager::PLUGIN_STATUS_NEW; } else if (!is_null($this->versiondb) and is_null($this->versiondisk)) { - return plugin_manager::PLUGIN_STATUS_MISSING; + if (plugin_manager::is_deleted_standard_plugin($this->type, $this->name)) { + return plugin_manager::PLUGIN_STATUS_DELETE; + } else { + return plugin_manager::PLUGIN_STATUS_MISSING; + } } else if ((string)$this->versiondb === (string)$this->versiondisk) { return plugin_manager::PLUGIN_STATUS_UPTODATE; diff --git a/theme/base/style/admin.css b/theme/base/style/admin.css index f90af47238b31..64017d4360e43 100644 --- a/theme/base/style/admin.css +++ b/theme/base/style/admin.css @@ -190,6 +190,7 @@ #page-admin-index #plugins-check .status-missing .status {background-color:#ffd3d9;} #page-admin-index #plugins-check .status-new .status {background-color:#e7f1c3;} #page-admin-index #plugins-check .status-nodb .status {color:#999;} +#page-admin-index #plugins-check .status-delete .status {background-color:#d2ebff;} #page-admin-index #plugins-check .status-upgrade .status {background-color:#d2ebff;} #page-admin-index #plugins-check .status-uptodate .status {color:#999;} #page-admin-index #plugins-check .requires ul {font-size:0.7em;margin:0;}