Merge branch 'w52_MDL-30786_m23_todelete' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk 2012-01-03 16:35:36 +13:00
commit 44141b1881
3 changed files with 34 additions and 1 deletions

View file

@ -50,6 +50,7 @@ $string['source'] = 'Source';
$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';

View file

@ -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,31 @@ class plugin_manager {
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(
// do not add 1.9-2.2 plugin removals here
);
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 +833,9 @@ abstract class plugintype_base {
$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 +861,11 @@ abstract class plugintype_base {
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;

View file

@ -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;}