From 5344ddd1161d3880a8a5e009926e7fb83c169397 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Mon, 26 Mar 2012 15:59:25 +0200 Subject: [PATCH] MDL-20438 warn the admin that we are just showing available updates This warning is displayed so that folks do not expect any sort of auto-update ala Wordpress (yet). --- admin/renderer.php | 5 +++++ lang/en/admin.php | 6 +++++- lib/pluginlib.php | 17 +++++++++++++++++ theme/base/style/admin.css | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/admin/renderer.php b/admin/renderer.php index b21c33c3cd2..8bed3910dfa 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -195,6 +195,11 @@ class core_admin_renderer extends plugin_renderer_base { $output .= $this->upgrade_reload($reloadurl); if ($pluginman->all_plugins_ok($version)) { + if ($pluginman->some_plugins_updatable()) { + $output .= $this->container_start('upgradepluginsinfo'); + $output .= $this->help_icon('upgradepluginsinfo', 'core_admin', get_string('upgradepluginsfirst', 'core_admin')); + $output .= $this->container_end(); + } $button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get'); $button->class = 'continuebutton'; $output .= $this->render($button); diff --git a/lang/en/admin.php b/lang/en/admin.php index 062d68cbb48..762ec715517 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -984,7 +984,11 @@ $string['updateminmaturity'] = 'Required code maturity'; $string['updateminmaturity_desc'] = 'Notify about available updates only if the available code has the selected maturity level at least. Updates for plugins that do not declare their code maturity level are always reported regardless this setting.'; $string['updatenotifybuilds'] = 'Notify about new builds'; $string['updatenotifybuilds_desc'] = 'If enabled, the available update for Moodle code is also reported when a new build for the current version is available. Builds are continuous improvements of a given Moodle version. They are generally released every week. If disabled, the available update will be reported only when there is a higher version of Moodle released. Checks for plugins are not affected by this setting.'; -$string['upgradestart'] = 'Upgrade'; +$string['upgradestart'] = 'Upgrade Moodle database now'; +$string['upgradepluginsfirst'] = 'You have to download and install available updates manually'; +$string['upgradepluginsinfo'] = 'Updating plugins'; +$string['upgradepluginsinfo_help'] = 'There are available updates for some of your plugins. Moodle does not update them automatically yet. You have to download the update and install it at your server manually.'; +$string['upgradepluginsinfo_link'] = 'admin/upgradepluginsinfo'; $string['upgradeerror'] = 'Unknown error upgrading {$a->plugin} to version {$a->version}, can not continue.'; $string['upgradeforumread'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts.
To use this functionality you need to update your tables.'; $string['upgradeforumreadinfo'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts. To use this functionality you need to update your tables with all the tracking information for existing posts. Depending on the size of your site this can take a long time (hours) and can be quite taxing on the database, so it\'s best to do it during a quiet period. However, your site will continue functioning during this upgrade and users won\'t be affected. Once you start this process you should let it finish (keep your browser window open). However, if you stop the process by closing the window: don\'t worry, you can start over.

Do you want to start the upgrading process now?'; diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 8923914ed72..845de2ee8ff 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -298,6 +298,23 @@ class plugin_manager { return true; } + /** + * Checks if there are some plugins with a known available update + * + * @return bool true if there is at least one available update + */ + public function some_plugins_updatable() { + foreach ($this->get_plugins() as $type => $plugins) { + foreach ($plugins as $plugin) { + if ($plugin->available_updates()) { + return true; + } + } + } + + return false; + } + /** * Defines a list of all plugins that were originally shipped in the standard Moodle distribution, * but are not anymore and are deleted during upgrades. diff --git a/theme/base/style/admin.css b/theme/base/style/admin.css index c06d82075bf..58ba4e7a451 100644 --- a/theme/base/style/admin.css +++ b/theme/base/style/admin.css @@ -220,6 +220,7 @@ #page-admin-index #plugins-check .status .pluginupdateinfo span, #page-admin-index #plugins-check .status .pluginupdateinfo a {padding-right:1em;} #page-admin-index #plugins-check .status .pluginupdateinfo .separator {border-left:1px dotted #333;} +#page-admin-index .upgradepluginsinfo {text-align:center;} /** Plugins management */ #page-admin-plugins .checkforupdates {margin:0 auto 1em;text-align:center;}