diff options
Diffstat (limited to 'modules/gallery/helpers')
| -rw-r--r-- | modules/gallery/helpers/gallery_block.php | 5 | ||||
| -rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 432 | ||||
| -rw-r--r-- | modules/gallery/helpers/gallery_quick.php | 7 | ||||
| -rw-r--r-- | modules/gallery/helpers/module.php | 34 | ||||
| -rw-r--r-- | modules/gallery/helpers/theme.php | 2 | 
5 files changed, 259 insertions, 221 deletions
| diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index c3837f54..a10f2bbf 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -49,8 +49,9 @@ class gallery_block_Core {        $block->css_id = "gLogEntries";        $block->title = t("Log Entries");        $block->content = new View("admin_block_log_entries.html"); -      $block->content->entries = ORM::factory("log")->orderby("timestamp", "DESC")->find_all(5); -        break; +      $block->content->entries = ORM::factory("log") +        ->orderby(array("timestamp" => "DESC", "id" => "DESC"))->find_all(5); +      break;      case "stats":        $block->css_id = "gStats"; diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index cd871c17..df555d52 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -18,244 +18,241 @@   * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.   */  class gallery_installer { -  static function install($initial_install=false) { +  static function install() {      $db = Database::instance(); -    if ($initial_install) { -      $version = 0; -    } else { -      $version = module::get_version("gallery"); -    } - -    if ($version == 0) { -      $db->query("CREATE TABLE {access_caches} ( -                   `id` int(9) NOT NULL auto_increment, -                   `item_id` int(9), -                   PRIMARY KEY (`id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - -      $db->query("CREATE TABLE {access_intents} ( -                   `id` int(9) NOT NULL auto_increment, -                   `item_id` int(9), -                   PRIMARY KEY (`id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {access_caches} ( +                 `id` int(9) NOT NULL auto_increment, +                 `item_id` int(9), +                 PRIMARY KEY (`id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {graphics_rules} ( -                   `id` int(9) NOT NULL auto_increment, -                   `active` BOOLEAN default 0, -                   `args` varchar(255) default NULL, -                   `module_name` varchar(64) NOT NULL, -                   `operation` varchar(64) NOT NULL, -                   `priority` int(9) NOT NULL, -                   `target`  varchar(32) NOT NULL, -                   PRIMARY KEY (`id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {access_intents} ( +                 `id` int(9) NOT NULL auto_increment, +                 `item_id` int(9), +                 PRIMARY KEY (`id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {incoming_translations} ( -                   `id` int(9) NOT NULL auto_increment, -                   `key` char(32) NOT NULL, -                   `locale` char(10) NOT NULL, -                   `message` text NOT NULL, -                   `revision` int(9) DEFAULT NULL, -                   `translation` text, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`key`, `locale`), -                   KEY `locale_key` (`locale`, `key`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {graphics_rules} ( +                 `id` int(9) NOT NULL auto_increment, +                 `active` BOOLEAN default 0, +                 `args` varchar(255) default NULL, +                 `module_name` varchar(64) NOT NULL, +                 `operation` varchar(64) NOT NULL, +                 `priority` int(9) NOT NULL, +                 `target`  varchar(32) NOT NULL, +                 PRIMARY KEY (`id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {items} ( -                   `id` int(9) NOT NULL auto_increment, -                   `album_cover_item_id` int(9) default NULL, -                   `captured` int(9) default NULL, -                   `created` int(9) default NULL, -                   `description` varchar(2048) default NULL, -                   `height` int(9) default NULL, -                   `left` int(9) NOT NULL, -                   `level` int(9) NOT NULL, -                   `mime_type` varchar(64) default NULL, -                   `name` varchar(255) default NULL, -                   `owner_id` int(9) default NULL, -                   `parent_id` int(9) NOT NULL, -                   `rand_key` float default NULL, -                   `relative_path_cache` varchar(255) default NULL, -                   `resize_dirty` boolean default 1, -                   `resize_height` int(9) default NULL, -                   `resize_width` int(9) default NULL, -                   `right` int(9) NOT NULL, -                   `sort_column` varchar(64) default NULL, -                   `sort_order` char(4) default 'ASC', -                   `thumb_dirty` boolean default 1, -                   `thumb_height` int(9) default NULL, -                   `thumb_width` int(9) default NULL, -                   `title` varchar(255) default NULL, -                   `type` varchar(32) NOT NULL, -                   `updated` int(9) default NULL, -                   `view_count` int(9) default 0, -                   `weight` int(9) NOT NULL default 0, -                   `width` int(9) default NULL, -                   PRIMARY KEY (`id`), -                   KEY `parent_id` (`parent_id`), -                   KEY `type` (`type`), -                   KEY `random` (`rand_key`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {incoming_translations} ( +                 `id` int(9) NOT NULL auto_increment, +                 `key` char(32) NOT NULL, +                 `locale` char(10) NOT NULL, +                 `message` text NOT NULL, +                 `revision` int(9) DEFAULT NULL, +                 `translation` text, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`key`, `locale`), +                 KEY `locale_key` (`locale`, `key`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {logs} ( -                   `id` int(9) NOT NULL auto_increment, -                   `category` varchar(64) default NULL, -                   `html` varchar(255) default NULL, -                   `message` text default NULL, -                   `referer` varchar(255) default NULL, -                   `severity` int(9) default 0, -                   `timestamp` int(9) default 0, -                   `url` varchar(255) default NULL, -                   `user_id` int(9) default 0, -                   PRIMARY KEY (`id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {items} ( +                 `id` int(9) NOT NULL auto_increment, +                 `album_cover_item_id` int(9) default NULL, +                 `captured` int(9) default NULL, +                 `created` int(9) default NULL, +                 `description` varchar(2048) default NULL, +                 `height` int(9) default NULL, +                 `left` int(9) NOT NULL, +                 `level` int(9) NOT NULL, +                 `mime_type` varchar(64) default NULL, +                 `name` varchar(255) default NULL, +                 `owner_id` int(9) default NULL, +                 `parent_id` int(9) NOT NULL, +                 `rand_key` float default NULL, +                 `relative_path_cache` varchar(255) default NULL, +                 `resize_dirty` boolean default 1, +                 `resize_height` int(9) default NULL, +                 `resize_width` int(9) default NULL, +                 `right` int(9) NOT NULL, +                 `sort_column` varchar(64) default NULL, +                 `sort_order` char(4) default 'ASC', +                 `thumb_dirty` boolean default 1, +                 `thumb_height` int(9) default NULL, +                 `thumb_width` int(9) default NULL, +                 `title` varchar(255) default NULL, +                 `type` varchar(32) NOT NULL, +                 `updated` int(9) default NULL, +                 `view_count` int(9) default 0, +                 `weight` int(9) NOT NULL default 0, +                 `width` int(9) default NULL, +                 PRIMARY KEY (`id`), +                 KEY `parent_id` (`parent_id`), +                 KEY `type` (`type`), +                 KEY `random` (`rand_key`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {messages} ( -                   `id` int(9) NOT NULL auto_increment, -                   `key` varchar(255) default NULL, -                   `severity` varchar(32) default NULL, -                   `value` varchar(255) default NULL, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`key`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {logs} ( +                 `id` int(9) NOT NULL auto_increment, +                 `category` varchar(64) default NULL, +                 `html` varchar(255) default NULL, +                 `message` text default NULL, +                 `referer` varchar(255) default NULL, +                 `severity` int(9) default 0, +                 `timestamp` int(9) default 0, +                 `url` varchar(255) default NULL, +                 `user_id` int(9) default 0, +                 PRIMARY KEY (`id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {modules} ( -                   `id` int(9) NOT NULL auto_increment, -                   `active` BOOLEAN default 0, -                   `name` varchar(64) default NULL, -                   `version` int(9) default NULL, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`name`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {messages} ( +                 `id` int(9) NOT NULL auto_increment, +                 `key` varchar(255) default NULL, +                 `severity` varchar(32) default NULL, +                 `value` varchar(255) default NULL, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`key`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {outgoing_translations} ( -                   `id` int(9) NOT NULL auto_increment, -                   `base_revision` int(9) DEFAULT NULL, -                   `key` char(32) NOT NULL, -                   `locale` char(10) NOT NULL, -                   `message` text NOT NULL, -                   `translation` text, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`key`, `locale`), -                   KEY `locale_key` (`locale`, `key`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {modules} ( +                 `id` int(9) NOT NULL auto_increment, +                 `active` BOOLEAN default 0, +                 `name` varchar(64) default NULL, +                 `version` int(9) default NULL, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`name`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {permissions} ( -                   `id` int(9) NOT NULL auto_increment, -                   `display_name` varchar(64) default NULL, -                   `name` varchar(64) default NULL, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`name`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {outgoing_translations} ( +                 `id` int(9) NOT NULL auto_increment, +                 `base_revision` int(9) DEFAULT NULL, +                 `key` char(32) NOT NULL, +                 `locale` char(10) NOT NULL, +                 `message` text NOT NULL, +                 `translation` text, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`key`, `locale`), +                 KEY `locale_key` (`locale`, `key`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {sessions} ( -                  `session_id` varchar(127) NOT NULL, -                  `data` text NOT NULL, -                  `last_activity` int(10) UNSIGNED NOT NULL, -                  PRIMARY KEY (`session_id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {permissions} ( +                 `id` int(9) NOT NULL auto_increment, +                 `display_name` varchar(64) default NULL, +                 `name` varchar(64) default NULL, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`name`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {tasks} ( -                  `id` int(9) NOT NULL auto_increment, -                  `callback` varchar(128) default NULL, -                  `context` text NOT NULL, -                  `done` boolean default 0, -                  `name` varchar(128) default NULL, -                  `owner_id` int(9) default NULL, -                  `percent_complete` int(9) default 0, -                  `state` varchar(32) default NULL, -                  `status` varchar(255) default NULL, -                  `updated` int(9) default NULL, -                  PRIMARY KEY (`id`), -                  KEY (`owner_id`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {sessions} ( +                `session_id` varchar(127) NOT NULL, +                `data` text NOT NULL, +                `last_activity` int(10) UNSIGNED NOT NULL, +                PRIMARY KEY (`session_id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {themes} ( -                   `id` int(9) NOT NULL auto_increment, -                   `name` varchar(64) default NULL, -                   `version` int(9) default NULL, -                   PRIMARY KEY (`id`), -                   UNIQUE KEY(`name`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {tasks} ( +                `id` int(9) NOT NULL auto_increment, +                `callback` varchar(128) default NULL, +                `context` text NOT NULL, +                `done` boolean default 0, +                `name` varchar(128) default NULL, +                `owner_id` int(9) default NULL, +                `percent_complete` int(9) default 0, +                `state` varchar(32) default NULL, +                `status` varchar(255) default NULL, +                `updated` int(9) default NULL, +                PRIMARY KEY (`id`), +                KEY (`owner_id`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      $db->query("CREATE TABLE {vars} ( -                  `id` int(9) NOT NULL auto_increment, -                  `module_name` varchar(64) NOT NULL, -                  `name` varchar(64) NOT NULL, -                  `value` text, -                  PRIMARY KEY (`id`), -                  UNIQUE KEY(`module_name`, `name`)) -                 ENGINE=InnoDB DEFAULT CHARSET=utf8;"); +    $db->query("CREATE TABLE {themes} ( +                 `id` int(9) NOT NULL auto_increment, +                 `name` varchar(64) default NULL, +                 `version` int(9) default NULL, +                 PRIMARY KEY (`id`), +                 UNIQUE KEY(`name`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { -        @mkdir(VARPATH . $dir); -      } +    $db->query("CREATE TABLE {vars} ( +                `id` int(9) NOT NULL auto_increment, +                `module_name` varchar(64) NOT NULL, +                `name` varchar(64) NOT NULL, +                `value` text, +                PRIMARY KEY (`id`), +                UNIQUE KEY(`module_name`, `name`)) +               ENGINE=InnoDB DEFAULT CHARSET=utf8;"); -      access::register_permission("view", "View"); -      access::register_permission("view_full", "View Full Size"); -      access::register_permission("edit", "Edit"); -      access::register_permission("add", "Add"); +    foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) { +      @mkdir(VARPATH . $dir); +    } -      $root = ORM::factory("item"); -      $root->type = "album"; -      $root->title = "Gallery"; -      $root->description = ""; -      $root->left = 1; -      $root->right = 2; -      $root->parent_id = 0; -      $root->level = 1; -      $root->thumb_dirty = 1; -      $root->resize_dirty = 1; -      $root->sort_column = "weight"; -      $root->sort_order = "ASC"; -      $root->save(); -      access::add_item($root); +    access::register_permission("view", "View"); +    access::register_permission("view_full", "View Full Size"); +    access::register_permission("edit", "Edit"); +    access::register_permission("add", "Add"); -      module::set_var("gallery", "active_site_theme", "default"); -      module::set_var("gallery", "active_admin_theme", "admin_default"); -      module::set_var("gallery", "page_size", 9); -      module::set_var("gallery", "thumb_size", 200); -      module::set_var("gallery", "resize_size", 640); -      module::set_var("gallery", "default_locale", "en_US"); -      module::set_var("gallery", "image_quality", 75); +    $root = ORM::factory("item"); +    $root->type = "album"; +    $root->title = "Gallery"; +    $root->description = ""; +    $root->left = 1; +    $root->right = 2; +    $root->parent_id = 0; +    $root->level = 1; +    $root->thumb_dirty = 1; +    $root->resize_dirty = 1; +    $root->sort_column = "weight"; +    $root->sort_order = "ASC"; +    $root->save(); +    access::add_item($root); -      // Add rules for generating our thumbnails and resizes -      graphics::add_rule( -        "gallery", "thumb", "resize", -        array("width" => 200, "height" => 200, "master" => Image::AUTO), -        100); -      graphics::add_rule( -        "gallery", "resize", "resize", -        array("width" => 640, "height" => 480, "master" => Image::AUTO), -        100); +    module::set_var("gallery", "active_site_theme", "default"); +    module::set_var("gallery", "active_admin_theme", "admin_default"); +    module::set_var("gallery", "page_size", 9); +    module::set_var("gallery", "thumb_size", 200); +    module::set_var("gallery", "resize_size", 640); +    module::set_var("gallery", "default_locale", "en_US"); +    module::set_var("gallery", "image_quality", 75); -      // Instantiate default themes (site and admin) -      foreach (array("default", "admin_default") as $theme_name) { -        $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), -                                      ArrayObject::ARRAY_AS_PROPS); -        $theme = ORM::factory("theme"); -        $theme->name = $theme_name; -        $theme->version = $theme_info->version; -        $theme->save(); -      } +    // Add rules for generating our thumbnails and resizes +    graphics::add_rule( +      "gallery", "thumb", "resize", +      array("width" => 200, "height" => 200, "master" => Image::AUTO), +      100); +    graphics::add_rule( +      "gallery", "resize", "resize", +      array("width" => 640, "height" => 480, "master" => Image::AUTO), +      100); -      block_manager::add("dashboard_sidebar", "gallery", "block_adder"); -      block_manager::add("dashboard_sidebar", "gallery", "stats"); -      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", "photo_stream"); -      block_manager::add("dashboard_center", "gallery", "log_entries"); +    // Instantiate default themes (site and admin) +    foreach (array("default", "admin_default") as $theme_name) { +      $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), +                                    ArrayObject::ARRAY_AS_PROPS); +      $theme = ORM::factory("theme"); +      $theme->name = $theme_name; +      $theme->version = $theme_info->version; +      $theme->save(); +    } -      module::set_version("gallery", $version = 1); -      module::set_var("gallery", "version", "3.0 beta 1"); -      module::set_var("gallery", "choose_default_tookit", 1); +    block_manager::add("dashboard_sidebar", "gallery", "block_adder"); +    block_manager::add("dashboard_sidebar", "gallery", "stats"); +    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", "photo_stream"); +    block_manager::add("dashboard_center", "gallery", "log_entries"); -      // @todo this string needs to be picked up by l10n_scanner -      module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); -    } +    module::set_var("gallery", "version", "3.0 pre beta 2 (git)"); +    module::set_var("gallery", "choose_default_tookit", 1); +    module::set_var("gallery", "date_format", "Y-M-d"); +    module::set_var("gallery", "date_time_format", "Y-M-d H:i:s"); +    module::set_var("gallery", "time_format", "H:i:s"); +    module::set_var("gallery", "show_credits", 1); +    // @todo this string needs to be picked up by l10n_scanner +    module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); +    module::set_version("gallery", 3); +  } +  static function upgrade($version) {      if ($version == 1) {        module::set_var("gallery", "date_format", "Y-M-d");        module::set_var("gallery", "date_time_format", "Y-M-d H:i:s"); @@ -263,6 +260,11 @@ class gallery_installer {        module::set_var("gallery", "version", "3.0 pre beta 2 (git)");        module::set_version("gallery", $version = 2);      } + +    if ($version == 2) { +      module::set_var("gallery", "show_credits", 1); +      module::set_version("gallery", $version = 3); +    }    }    static function uninstall() { diff --git a/modules/gallery/helpers/gallery_quick.php b/modules/gallery/helpers/gallery_quick.php index bb791c33..d0ffc584 100644 --- a/modules/gallery/helpers/gallery_quick.php +++ b/modules/gallery/helpers/gallery_quick.php @@ -83,19 +83,20 @@ class gallery_quick_Core {        "class" => "gDialogLink gButtonLink",        "icon" => "ui-icon-pencil",        "href" => url::site("quick/form_edit/$item->id?page_type=$page_type")); +      if ($item->is_photo() && graphics::can("rotate")) {        $elements["left"][] =          (object)array(            "title" => t("Rotate 90 degrees counter clockwise"),            "class" => "gButtonLink",            "icon" => "ui-icon-rotate-ccw", -          "href" => url::site("quick/form_edit/$item->id/ccw?csrf=$csrf&?page_type=$page_type")); +          "href" => url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"));        $elements["left"][] =          (object)array(            "title" => t("Rotate 90 degrees clockwise"),            "class" => "gButtonLink",            "icon" => "ui-icon-rotate-cw", -          "href" => url::site("quick/form_edit/$item->id/cw?csrf=$csrf&page_type=$page_type")); +          "href" => url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"));      }      // Don't move photos from the photo page; we don't yet have a good way of redirecting after move @@ -118,7 +119,7 @@ class gallery_quick_Core {        $elements["right"][] = (object)array(          "title" => $delete_title, -        "class" => "gButtonLink", +        "class" => "gDialogLink gButtonLink",          "icon" => "ui-icon-trash",          "id" => "gQuickDelete",          "href" => url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type")); diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index dea8e22c..0d483206 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -107,7 +107,7 @@ class module_Core {    /**     * Install a module.  This will call <module>_installer::install(), which is responsible for -   * creating database tables, setting module variables and and calling module::set_version(). +   * creating database tables, setting module variables and calling module::set_version().     * Note that after installing, the module must be activated before it is available for use.     * @param string $module_name     */ @@ -131,6 +131,38 @@ class module_Core {    }    /** +   * Upgrade a module.  This will call <module>_installer::upgrade(), which is responsible for +   * modifying database tables, changing module variables and calling module::set_version(). +   * Note that after upgrading, the module must be activated before it is available for use. +   * @param string $module_name +   */ +  static function upgrade($module_name) { +    $kohana_modules = Kohana::config("core.modules"); +    array_unshift($kohana_modules, MODPATH . $module_name); +    Kohana::config_set("core.modules",  $kohana_modules); + +    $version_before = module::get_version($module_name); +    $installer_class = "{$module_name}_installer"; +    if (method_exists($installer_class, "upgrade")) { +      call_user_func_array(array($installer_class, "upgrade"), array($version_before)); +    } +    module::load_modules(); + +    // Now the module is upgraded but inactive, so don't leave it in the active path +    array_shift($kohana_modules); +    Kohana::config_set("core.modules",  $kohana_modules); + +    $version_after = module::get_version($module_name); +    if ($version_before != $version_after) { +      log::success( +        "module", t("Upgraded module %module_name from %version_before to %version_after", +                    array("module_name" => $module_name, +                          "version_before" => $version_before, +                          "version_after" => $version_after))); +    } +  } + +  /**     * Activate an installed module.  This will call <module>_installer::activate() which should take     * any steps to make sure that the module is ready for use.  This will also activate any     * existing graphics rules for this module. diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index 0a43f25c..b46a2c14 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -55,6 +55,8 @@ class theme_Core {        ->value(module::get_var("gallery", "header_text"));      $group->textarea("footer_text")->label(t("Footer text"))->id("gFooterText")        ->value(module::get_var("gallery", "footer_text")); +    $group->checkbox("show_credits")->label(t("Show site credits"))->id("gFooterText") +      ->checked(module::get_var("gallery", "show_credits"));      $group->submit("")->value(t("Save"));      return $form;    } | 
