Skip to content

Commit

Permalink
Detect out-of-date modules and put up a message for site admins.
Browse files Browse the repository at this point in the history
Fixes ticket #1353.
  • Loading branch information
bharat committed Sep 9, 2010
1 parent 391a90e commit cbb6967
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/gallery/controllers/admin_modules.php
Expand Up @@ -95,12 +95,17 @@ private function _do_save() {
$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))));
Expand Down
3 changes: 3 additions & 0 deletions modules/gallery/controllers/upgrader.php
Expand Up @@ -83,6 +83,9 @@ public function upgrade() {
}
}

// If the upgrade failed, this will get recreated
site_status::clear("upgrade_now");

if (php_sapi_name() == "cli") {
print "Upgrade complete\n";
} else {
Expand Down
4 changes: 4 additions & 0 deletions modules/gallery/helpers/module.php
Expand Up @@ -99,6 +99,10 @@ static function available() {
$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
Expand Down

0 comments on commit cbb6967

Please sign in to comment.