MDL-29474 display the dependancy information on the upgrade screen.
This commit is contained in:
+2
-4
@@ -267,12 +267,11 @@ if ($version > $CFG->version) { // upgrade
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->plugins_check(plugin_manager::instance(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
@@ -307,12 +306,11 @@ if (moodle_needs_upgrading()) {
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->plugins_check(plugin_manager::instance(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
print_upgrade_reload('index.php');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
|
||||
+1
-2
@@ -31,11 +31,10 @@ require_once($CFG->libdir . '/pluginlib.php');
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
admin_externalpage_setup('pluginsoverview');
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginsoverview', 'core_admin'));
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->plugins_control_panel($pluginman->get_plugins());
|
||||
echo $output->plugins_control_panel(plugin_manager::instance());
|
||||
echo $output->box_end();
|
||||
echo $output->footer();
|
||||
|
||||
+72
-11
@@ -39,11 +39,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* options support:
|
||||
* (bool)full = false: whether to display up-to-date plugins, too
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @param plugin_manager $pluginman provides information about the plugins.
|
||||
* @param array $options rendering options
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_check(array $plugininfo, array $options = null) {
|
||||
public function plugins_check(plugin_manager $pluginman, array $options = null) {
|
||||
global $CFG;
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
@@ -55,8 +57,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
);
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-check';
|
||||
$table->head = array(
|
||||
@@ -65,10 +65,11 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('versiondb', 'core_plugin'),
|
||||
get_string('versiondisk', 'core_plugin'),
|
||||
get_string('requires', 'core_plugin'),
|
||||
get_string('status', 'core_plugin'),
|
||||
);
|
||||
$table->colclasses = array(
|
||||
'displayname', 'rootdir', 'source', 'versiondb', 'versiondisk', 'status',
|
||||
'displayname', 'rootdir', 'source', 'versiondb', 'versiondisk', 'requires', 'status',
|
||||
);
|
||||
$table->data = array();
|
||||
|
||||
@@ -126,7 +127,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$status = new html_table_cell(get_string('status_' . $statuscode, 'core_plugin'));
|
||||
|
||||
if ($isstandard and in_array($statuscode, array(plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE))) {
|
||||
$requires = new html_table_cell($this->required_column($plugin, $pluginman));
|
||||
|
||||
$statusisboring = in_array($statuscode, array(
|
||||
plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE));
|
||||
$dependanciesok = $pluginman->are_dependancies_satisfied(
|
||||
$plugin->get_other_required_plugins());
|
||||
if ($isstandard and $statusisboring and $dependanciesok) {
|
||||
if (empty($options['full'])) {
|
||||
continue;
|
||||
}
|
||||
@@ -134,7 +141,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$numofhighlighted[$type]++;
|
||||
}
|
||||
|
||||
$row->cells = array($displayname, $rootdir, $source, $versiondb, $versiondisk, $status);
|
||||
$row->cells = array($displayname, $rootdir, $source,
|
||||
$versiondb, $versiondisk, $requires, $status);
|
||||
$plugintyperows[] = $row;
|
||||
}
|
||||
|
||||
@@ -176,22 +184,75 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the information that needs to go in the 'Requires' column.
|
||||
* @param plugin_information $plugin the plugin we are rendering the row for.
|
||||
* @param plugin_manager $pluginman provides data on all the plugins.
|
||||
*/
|
||||
protected function required_column($plugin, $pluginman) {
|
||||
global $CFG;
|
||||
$requires = array();
|
||||
|
||||
if (!empty($plugin->versionrequires)) {
|
||||
if ($plugin->versionrequires <= $CFG->version) {
|
||||
$class = 'requires-ok';
|
||||
} else {
|
||||
$class = 'requires-failed';
|
||||
}
|
||||
$requires[] = html_writer::tag('li',
|
||||
get_string('moodleversion', 'core_plugin', $plugin->versionrequires),
|
||||
array('class' => $class));
|
||||
}
|
||||
|
||||
foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) {
|
||||
$ok = true;
|
||||
$otherplugin = $pluginman->get_plugin_info($component);
|
||||
|
||||
if (is_null($otherplugin)) {
|
||||
$ok = false;
|
||||
}
|
||||
if ($requiredversion != ANY_VERSION and $otherplugin->versiondb < $requiredversion) {
|
||||
$ok = false;
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
$class = 'requires-ok';
|
||||
} else {
|
||||
$class = 'requires-failed';
|
||||
}
|
||||
|
||||
if ($requiredversion != ANY_VERSION) {
|
||||
$str = 'otherpluginversion';
|
||||
} else {
|
||||
$str = 'otherplugin';
|
||||
}
|
||||
$requires[] = html_writer::tag('li',
|
||||
get_string($str, 'core_plugin',
|
||||
array('component' => $component, 'version' => $requiredversion)),
|
||||
array('class' => $class));
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
return '';
|
||||
}
|
||||
return html_writer::tag('ul', implode("\n", $requires));
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all known plugins and links to manage them
|
||||
*
|
||||
* This default implementation renders all plugins into one big table.
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @param plugin_manager $pluginman provides information about the plugins.
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_control_panel(array $plugininfo) {
|
||||
public function plugins_control_panel(plugin_manager $pluginman) {
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-control-panel';
|
||||
$table->head = array(
|
||||
|
||||
@@ -27,9 +27,12 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$string['availability'] = 'Availability';
|
||||
$string['displayname'] = 'Plugin name';
|
||||
$string['moodleversion'] = 'Moodle {$a}';
|
||||
$string['nonehighlighted'] = 'No plugins require your attention during this upgrade';
|
||||
$string['nonehighlightedinfo'] = 'Display the list of all installed plugins anyway';
|
||||
$string['noneinstalled'] = 'No plugins of this type are installed';
|
||||
$string['otherplugin'] = '{$a->component}';
|
||||
$string['otherpluginversion'] = '{$a->component} ({$a->version})';
|
||||
$string['showall'] = 'Reload and show all plugins';
|
||||
$string['pluginchecknotice'] = 'This page displays plugins that may require your attention during the upgrade. Highlighted items include new plugins that are about to be installed, updated plugins that are about to be upgraded and any missing plugins. Contributed plugins are also highlighted.
|
||||
It is recommended that you check whether there are more recent versions of contributed plugins available and update their source code before continuing with this Moodle upgrade.';
|
||||
@@ -37,6 +40,7 @@ $string['plugindisable'] = 'Disable';
|
||||
$string['plugindisabled'] = 'Disabled';
|
||||
$string['pluginenable'] = 'Enable';
|
||||
$string['pluginenabled'] = 'Enabled';
|
||||
$string['requires'] = 'Requires';
|
||||
$string['rootdir'] = 'Directory';
|
||||
$string['settings'] = 'Settings';
|
||||
$string['somehighlighted'] = 'Number of plugins requiring attention during this upgrade: {$a}';
|
||||
|
||||
@@ -334,6 +334,7 @@ abstract class question_engine {
|
||||
* @return string name from the current language pack.
|
||||
*/
|
||||
public static function get_behaviour_required_behaviours($behaviour) {
|
||||
self::load_behaviour_class($behaviour);
|
||||
$class = 'qbehaviour_' . $behaviour;
|
||||
return $class::get_required_behaviours();
|
||||
}
|
||||
|
||||
@@ -192,6 +192,11 @@
|
||||
#page-admin-index #plugins-check .status-nodb .status {color:#999;}
|
||||
#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;}
|
||||
#page-admin-index #plugins-check .requires li {display:block;;}
|
||||
#page-admin-index #plugins-check .requires-ok {color:#999;}
|
||||
#page-admin-index #plugins-check .requires-failed {background-color:#ffd3d9;}
|
||||
|
||||
|
||||
/** Plugins management */
|
||||
#page-admin-plugins #plugins-control-panel {margin-left:auto; margin-right:auto;}
|
||||
|
||||
Reference in New Issue
Block a user