diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-01-16 22:16:09 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-01-16 22:16:09 -0800 |
commit | 70abfb2a20734802c922c0e9917d2a1778aef3f2 (patch) | |
tree | fb8371b9c03da2eca3501372d330a53430fff7b9 /modules/gallery/helpers/gallery_installer.php | |
parent | 84d576606d709dcccef2549fdb926d47494a876c (diff) |
Upgrade checking code is now here, along with a bump of the Gallery
module to v46. There's a new block in the admin dashboard which
controls whether automatic checking happens, and lets you check
immediately. If a newer version is detected, a site status message
appears for admins providing upgrade instructions.
Automatic checking is not yet implemented (even though the UI claims
that it exists). This is all for #1605.
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 92e5b7b8..1ffe9bae 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -259,6 +259,7 @@ class gallery_installer { module::set_var("gallery", "default_locale", "en_US"); module::set_var("gallery", "image_quality", 75); module::set_var("gallery", "image_sharpen", 15); + module::set_var("gallery", "upgrade_checker_auto_enabled", true); // Add rules for generating our thumbnails and resizes graphics::add_rule( @@ -285,6 +286,7 @@ class gallery_installer { block_manager::add("dashboard_sidebar", "gallery", "platform_info"); block_manager::add("dashboard_sidebar", "gallery", "project_news"); block_manager::add("dashboard_center", "gallery", "welcome"); + block_manager::add("dashboard_center", "gallery", "upgrade_checker"); block_manager::add("dashboard_center", "gallery", "photo_stream"); block_manager::add("dashboard_center", "gallery", "log_entries"); @@ -309,7 +311,7 @@ class gallery_installer { module::set_var("gallery", "show_user_profiles_to", "registered_users"); module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin"); - module::set_version("gallery", 45); + module::set_version("gallery", 46); } static function upgrade($version) { @@ -663,6 +665,18 @@ class gallery_installer { $db->query("ALTER TABLE {messages} CHANGE `value` `value` text default NULL"); module::set_version("gallery", $version = 45); } + + if ($version == 45) { + // Splice the upgrade_checker block into the admin dashboard at the top + // of the page, but under the welcome block if it's in the first position. + $blocks = block_manager::get_active("dashboard_center"); + $index = count($blocks) && current($blocks) == array("gallery", "welcome") ? 1 : 0; + array_splice($blocks, $index, 0, array(random::int() => array("gallery", "upgrade_checker"))); + block_manager::set_active("dashboard_center", $blocks); + + module::set_var("gallery", "upgrade_checker_auto_enabled", true); + module::set_version("gallery", $version = 46); + } } static function uninstall() { |