diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-09-08 20:59:40 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-09-08 20:59:40 -0700 |
commit | cbb6967405569606de3b67e1f1dcde2ed8d6bb03 (patch) | |
tree | 38aad79f5b77fd7ad84fc7cbd06130998b7de4f0 | |
parent | 391a90e3cedd1cca7631f9a4d786c6c513b1dd48 (diff) |
Detect out-of-date modules and put up a message for site admins.
Fixes ticket #1353.
-rw-r--r-- | modules/gallery/controllers/admin_modules.php | 5 | ||||
-rw-r--r-- | modules/gallery/controllers/upgrader.php | 3 | ||||
-rw-r--r-- | modules/gallery/helpers/module.php | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index f5af9a5a..650b7e9e 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -95,12 +95,17 @@ class Admin_Modules_Controller extends Admin_Controller { $activated_names[] = t($info->name); } } catch (Exception $e) { + message::warning(t("An error occurred while installing the <b>%module_name</b> module", + array("module_name" => $info->name))); Kohana_Log::add("error", (string)$e); } } module::event("module_change", $changes); + // If modules need upgrading, this will get recreated + site_status::clear("upgrade_now"); + // @todo this type of collation is questionable from an i18n perspective if ($activated_names) { message::success(t("Activated: %names", array("names" => join(", ", $activated_names)))); diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index a3cfac48..6613d671 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -83,6 +83,9 @@ class Upgrader_Controller extends Controller { } } + // If the upgrade failed, this will get recreated + site_status::clear("upgrade_now"); + if (php_sapi_name() == "cli") { print "Upgrade complete\n"; } else { diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index be9c4249..7863520e 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -99,6 +99,10 @@ class module_Core { $m->code_version = $m->version; $m->version = self::get_version($module_name); $m->locked = false; + + if ($m->active && $m->version != $m->code_version) { + site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::site("upgrader"))), "upgrade_now"); + } } // Lock certain modules |