diff options
author | Chad Kieffer <ckieffer@gmail.com> | 2009-06-09 23:56:17 -0600 |
---|---|---|
committer | Chad Kieffer <ckieffer@gmail.com> | 2009-06-09 23:56:17 -0600 |
commit | 9717c7cd83e62458b0dd20414d4814260a3dd57a (patch) | |
tree | 3c86ec4d8b7bb8fa1d1814779ff9e119e5ce589b /modules/gallery/controllers | |
parent | 1e56e683fc65a6f369a46dd5fa3db105be9793f5 (diff) | |
parent | 9ecd2ac0e95b3045e763742073d6e6ca1c69832a (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r-- | modules/gallery/controllers/upgrader.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index e8798de5..0d5bb4f6 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -19,7 +19,38 @@ */ class Upgrader_Controller extends Controller { public function index() { + // Todo: give the admin a chance to log in here + if (!user::active()->admin) { + access::forbidden(); + } + $view = new View("upgrader.html"); + $view->available = module::available(); + $view->done = Input::instance()->get("done"); print $view; } + + public function upgrade() { + // Todo: give the admin a chance to log in here + if (!user::active()->admin) { + access::forbidden(); + } + + // Upgrade gallery and user first + module::install("gallery"); + module::install("user"); + + // Then upgrade the rest + foreach (module::available() as $id => $module) { + if ($id == "gallery") { + continue; + } + + if ($module->active && $module->code_version != $module->version) { + module::install($id); + } + } + + url::redirect("upgrader?done=1"); + } } |