From 9b1e3eb1775f3af365d7320a8a0bbfed85e2311c Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sun, 1 Aug 2010 21:08:03 -0700
Subject: Updated for gallery module v31.

---
 installer/install.sql | 449 +++++++++++++++++++++++++-------------------------
 1 file changed, 225 insertions(+), 224 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 687da129..8836f53f 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -1,246 +1,246 @@
 DROP TABLE IF EXISTS {access_caches};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {access_caches} (
-  `id` int(9) NOT NULL auto_increment,
-  `item_id` int(9) default NULL,
-  `view_full_1` binary(1) NOT NULL default '0',
-  `edit_1` binary(1) NOT NULL default '0',
-  `add_1` binary(1) NOT NULL default '0',
-  `view_full_2` binary(1) NOT NULL default '0',
-  `edit_2` binary(1) NOT NULL default '0',
-  `add_2` binary(1) NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `item_id` int(9) DEFAULT NULL,
+  `view_full_1` binary(1) NOT NULL DEFAULT '0',
+  `edit_1` binary(1) NOT NULL DEFAULT '0',
+  `add_1` binary(1) NOT NULL DEFAULT '0',
+  `view_full_2` binary(1) NOT NULL DEFAULT '0',
+  `edit_2` binary(1) NOT NULL DEFAULT '0',
+  `add_2` binary(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
 ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
 DROP TABLE IF EXISTS {access_intents};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {access_intents} (
-  `id` int(9) NOT NULL auto_increment,
-  `item_id` int(9) default NULL,
-  `view_1` binary(1) default NULL,
-  `view_full_1` binary(1) default NULL,
-  `edit_1` binary(1) default NULL,
-  `add_1` binary(1) default NULL,
-  `view_2` binary(1) default NULL,
-  `view_full_2` binary(1) default NULL,
-  `edit_2` binary(1) default NULL,
-  `add_2` binary(1) default NULL,
-  PRIMARY KEY  (`id`)
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `item_id` int(9) DEFAULT NULL,
+  `view_1` binary(1) DEFAULT NULL,
+  `view_full_1` binary(1) DEFAULT NULL,
+  `edit_1` binary(1) DEFAULT NULL,
+  `add_1` binary(1) DEFAULT NULL,
+  `view_2` binary(1) DEFAULT NULL,
+  `view_full_2` binary(1) DEFAULT NULL,
+  `edit_2` binary(1) DEFAULT NULL,
+  `add_2` binary(1) DEFAULT NULL,
+  PRIMARY KEY (`id`)
 ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0');
 DROP TABLE IF EXISTS {caches};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {caches} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `key` varchar(255) NOT NULL,
-  `tags` varchar(255) default NULL,
+  `tags` varchar(255) DEFAULT NULL,
   `expiration` int(9) NOT NULL,
   `cache` longblob,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   KEY `key` (`key`),
   KEY `tags` (`tags`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {comments};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {comments} (
-  `author_id` int(9) default NULL,
+  `author_id` int(9) DEFAULT NULL,
   `created` int(9) NOT NULL,
-  `guest_email` varchar(128) default NULL,
-  `guest_name` varchar(128) default NULL,
-  `guest_url` varchar(255) default NULL,
-  `id` int(9) NOT NULL auto_increment,
+  `guest_email` varchar(128) DEFAULT NULL,
+  `guest_name` varchar(128) DEFAULT NULL,
+  `guest_url` varchar(255) DEFAULT NULL,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `item_id` int(9) NOT NULL,
-  `server_http_accept_charset` varchar(64) default NULL,
-  `server_http_accept_encoding` varchar(64) default NULL,
-  `server_http_accept_language` varchar(64) default NULL,
-  `server_http_accept` varchar(128) default NULL,
-  `server_http_connection` varchar(64) default NULL,
-  `server_http_host` varchar(64) default NULL,
-  `server_http_referer` varchar(255) default NULL,
-  `server_http_user_agent` varchar(128) default NULL,
-  `server_query_string` varchar(64) default NULL,
-  `server_remote_addr` varchar(32) default NULL,
-  `server_remote_host` varchar(64) default NULL,
-  `server_remote_port` varchar(16) default NULL,
-  `state` varchar(15) default 'unpublished',
+  `server_http_accept_charset` varchar(64) DEFAULT NULL,
+  `server_http_accept_encoding` varchar(64) DEFAULT NULL,
+  `server_http_accept_language` varchar(64) DEFAULT NULL,
+  `server_http_accept` varchar(128) DEFAULT NULL,
+  `server_http_connection` varchar(64) DEFAULT NULL,
+  `server_http_host` varchar(64) DEFAULT NULL,
+  `server_http_referer` varchar(255) DEFAULT NULL,
+  `server_http_user_agent` varchar(128) DEFAULT NULL,
+  `server_query_string` varchar(64) DEFAULT NULL,
+  `server_remote_addr` varchar(32) DEFAULT NULL,
+  `server_remote_host` varchar(64) DEFAULT NULL,
+  `server_remote_port` varchar(16) DEFAULT NULL,
+  `state` varchar(15) DEFAULT 'unpublished',
   `text` text,
   `updated` int(9) NOT NULL,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY (`id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {failed_auths};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {failed_auths} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `count` int(9) NOT NULL,
   `name` varchar(255) NOT NULL,
   `time` int(9) NOT NULL,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY (`id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {graphics_rules};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {graphics_rules} (
-  `id` int(9) NOT NULL auto_increment,
-  `active` tinyint(1) default '0',
-  `args` varchar(255) default NULL,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `active` tinyint(1) 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`)
+  PRIMARY KEY (`id`)
 ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb');
 INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:640;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize');
 DROP TABLE IF EXISTS {groups};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {groups} (
-  `id` int(9) NOT NULL auto_increment,
-  `name` char(64) default NULL,
-  `special` tinyint(1) default '0',
-  PRIMARY KEY  (`id`),
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `name` char(64) DEFAULT NULL,
+  `special` tinyint(1) DEFAULT '0',
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {groups} VALUES (1,'Everybody',1);
 INSERT INTO {groups} VALUES (2,'Registered Users',1);
 DROP TABLE IF EXISTS {groups_users};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {groups_users} (
   `group_id` int(9) NOT NULL,
   `user_id` int(9) NOT NULL,
-  PRIMARY KEY  (`group_id`,`user_id`),
+  PRIMARY KEY (`group_id`,`user_id`),
   UNIQUE KEY `user_id` (`user_id`,`group_id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {groups_users} VALUES (1,1);
 INSERT INTO {groups_users} VALUES (1,2);
 INSERT INTO {groups_users} VALUES (2,2);
 DROP TABLE IF EXISTS {incoming_translations};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {incoming_translations} (
-  `id` int(9) NOT NULL auto_increment,
+  `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,
+  `revision` int(9) DEFAULT NULL,
   `translation` text,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   UNIQUE KEY `key` (`key`,`locale`),
   KEY `locale_key` (`locale`,`key`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {items};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 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,
+  `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_ptr` 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,
+  `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,
-  `relative_url_cache` varchar(255) default NULL,
-  `resize_dirty` tinyint(1) default '1',
-  `resize_height` int(9) default NULL,
-  `resize_width` int(9) default NULL,
+  `rand_key` float DEFAULT NULL,
+  `relative_path_cache` varchar(255) DEFAULT NULL,
+  `relative_url_cache` varchar(255) DEFAULT NULL,
+  `resize_dirty` tinyint(1) DEFAULT '1',
+  `resize_height` int(9) DEFAULT NULL,
+  `resize_width` int(9) DEFAULT NULL,
   `right_ptr` int(9) NOT NULL,
-  `slug` varchar(255) default NULL,
-  `sort_column` varchar(64) default NULL,
-  `sort_order` char(4) default 'ASC',
-  `thumb_dirty` tinyint(1) default '1',
-  `thumb_height` int(9) default NULL,
-  `thumb_width` int(9) default NULL,
-  `title` varchar(255) default NULL,
+  `slug` varchar(255) DEFAULT NULL,
+  `sort_column` varchar(64) DEFAULT NULL,
+  `sort_order` char(4) DEFAULT 'ASC',
+  `thumb_dirty` tinyint(1) 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,
-  `view_1` binary(1) default '0',
-  `view_2` binary(1) default '0',
-  PRIMARY KEY  (`id`),
+  `updated` int(9) DEFAULT NULL,
+  `view_count` int(9) DEFAULT '0',
+  `weight` int(9) NOT NULL DEFAULT '0',
+  `width` int(9) DEFAULT NULL,
+  `view_1` binary(1) DEFAULT '0',
+  `view_2` binary(1) DEFAULT '0',
+  PRIMARY KEY (`id`),
   KEY `parent_id` (`parent_id`),
   KEY `type` (`type`),
   KEY `random` (`rand_key`),
   KEY `weight` (`weight`)
 ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
 DROP TABLE IF EXISTS {items_tags};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {items_tags} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `item_id` int(9) NOT NULL,
   `tag_id` int(9) NOT NULL,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   KEY `tag_id` (`tag_id`,`id`),
   KEY `item_id` (`item_id`,`id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {logs};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {logs} (
-  `id` int(9) NOT NULL auto_increment,
-  `category` varchar(64) default NULL,
-  `html` varchar(255) default NULL,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `category` varchar(64) DEFAULT NULL,
+  `html` varchar(255) DEFAULT NULL,
   `message` text,
-  `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`)
+  `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`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {messages};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 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`),
+  `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` (`key`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {modules};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {modules} (
-  `id` int(9) NOT NULL auto_increment,
-  `active` tinyint(1) default '0',
-  `name` varchar(64) default NULL,
-  `version` int(9) default NULL,
-  PRIMARY KEY  (`id`),
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `active` tinyint(1) DEFAULT '0',
+  `name` varchar(64) DEFAULT NULL,
+  `version` int(9) DEFAULT NULL,
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',30);
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO {modules} VALUES (1,1,'gallery',31);
 INSERT INTO {modules} VALUES (2,1,'user',3);
 INSERT INTO {modules} VALUES (3,1,'comment',3);
 INSERT INTO {modules} VALUES (4,1,'organize',1);
@@ -251,148 +251,148 @@ INSERT INTO {modules} VALUES (8,1,'search',1);
 INSERT INTO {modules} VALUES (9,1,'slideshow',2);
 INSERT INTO {modules} VALUES (10,1,'tag',2);
 DROP TABLE IF EXISTS {outgoing_translations};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {outgoing_translations} (
-  `id` int(9) NOT NULL auto_increment,
-  `base_revision` int(9) default NULL,
+  `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`),
+  PRIMARY KEY (`id`),
   UNIQUE KEY `key` (`key`,`locale`),
   KEY `locale_key` (`locale`,`key`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {permissions};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {permissions} (
-  `id` int(9) NOT NULL auto_increment,
-  `display_name` varchar(64) default NULL,
-  `name` varchar(64) default NULL,
-  PRIMARY KEY  (`id`),
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `display_name` varchar(64) DEFAULT NULL,
+  `name` varchar(64) DEFAULT NULL,
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {permissions} VALUES (1,'View','view');
 INSERT INTO {permissions} VALUES (2,'View full size','view_full');
 INSERT INTO {permissions} VALUES (3,'Edit','edit');
 INSERT INTO {permissions} VALUES (4,'Add','add');
 DROP TABLE IF EXISTS {search_records};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {search_records} (
-  `id` int(9) NOT NULL auto_increment,
-  `item_id` int(9) default NULL,
-  `dirty` tinyint(1) default '1',
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `item_id` int(9) DEFAULT NULL,
+  `dirty` tinyint(1) DEFAULT '1',
   `data` longtext,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   KEY `item_id` (`item_id`),
   FULLTEXT KEY `data` (`data`)
 ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {search_records} VALUES (1,1,0,'  Gallery');
 DROP TABLE IF EXISTS {sessions};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {sessions} (
   `session_id` varchar(127) NOT NULL,
   `data` text NOT NULL,
   `last_activity` int(10) unsigned NOT NULL,
-  PRIMARY KEY  (`session_id`)
+  PRIMARY KEY (`session_id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {tags};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {tags} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `name` varchar(128) NOT NULL,
-  `count` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
+  `count` int(10) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {tasks};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {tasks} (
-  `id` int(9) NOT NULL auto_increment,
-  `callback` varchar(128) default NULL,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `callback` varchar(128) DEFAULT NULL,
   `context` text NOT NULL,
-  `done` tinyint(1) 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`),
+  `done` tinyint(1) 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` (`owner_id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {themes};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {themes} (
-  `id` int(9) NOT NULL auto_increment,
-  `name` varchar(64) default NULL,
-  `version` int(9) default NULL,
-  PRIMARY KEY  (`id`),
+  `id` int(9) NOT NULL AUTO_INCREMENT,
+  `name` varchar(64) DEFAULT NULL,
+  `version` int(9) DEFAULT NULL,
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {themes} VALUES (1,'wind',1);
 INSERT INTO {themes} VALUES (2,'admin_wind',1);
 DROP TABLE IF EXISTS {user_access_keys};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {user_access_keys} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `user_id` int(9) NOT NULL,
   `access_key` char(32) NOT NULL,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   UNIQUE KEY `access_key` (`access_key`),
   UNIQUE KEY `user_id` (`user_id`)
 ) DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS {users};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {users} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `name` varchar(32) NOT NULL,
   `full_name` varchar(255) NOT NULL,
   `password` varchar(64) NOT NULL,
-  `login_count` int(10) unsigned NOT NULL default '0',
-  `last_login` int(10) unsigned NOT NULL default '0',
-  `email` varchar(64) default NULL,
-  `admin` tinyint(1) default '0',
-  `guest` tinyint(1) default '0',
-  `hash` char(32) default NULL,
-  `url` varchar(255) default NULL,
-  `locale` char(10) default NULL,
-  PRIMARY KEY  (`id`),
+  `login_count` int(10) unsigned NOT NULL DEFAULT '0',
+  `last_login` int(10) unsigned NOT NULL DEFAULT '0',
+  `email` varchar(64) DEFAULT NULL,
+  `admin` tinyint(1) DEFAULT '0',
+  `guest` tinyint(1) DEFAULT '0',
+  `hash` char(32) DEFAULT NULL,
+  `url` varchar(255) DEFAULT NULL,
+  `locale` char(10) DEFAULT NULL,
+  PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`),
   UNIQUE KEY `hash` (`hash`)
 ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL);
 INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,'unknown@unknown.com',1,0,NULL,NULL,NULL);
 DROP TABLE IF EXISTS {vars};
-SET @saved_cs_client     = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
 CREATE TABLE {vars} (
-  `id` int(9) NOT NULL auto_increment,
+  `id` int(9) NOT NULL AUTO_INCREMENT,
   `module_name` varchar(64) NOT NULL,
   `name` varchar(64) NOT NULL,
   `value` text,
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY (`id`),
   UNIQUE KEY `module_name` (`module_name`,`name`)
 ) AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
 INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
 INSERT INTO {vars} VALUES (NULL,'gallery','page_size','9');
@@ -406,15 +406,16 @@ INSERT INTO {vars} VALUES (NULL,'gallery','show_credits','1');
 INSERT INTO {vars} VALUES (NULL,'gallery','credits','Powered by <a href=\"%url\">%gallery_version</a>');
 INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5');
 INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400');
+INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
+INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
 INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1');
 INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
-INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
-INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
 INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
+INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
 INSERT INTO {vars} VALUES (NULL,'rest','allow_guest_access','0');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:3:{i:9;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:10;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:11;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
 INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0');
-- 
cgit v1.2.3


From d3a161ca1bb388593e03bd5c57c60ea249b3fe8d Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Fri, 6 Aug 2010 10:41:38 -0700
Subject: Add a "weight" column to the module table.  This allows us to specify
 module ordering, which is currently being done in the moduleorder contrib
 module.

By default, the weight will be the same as the id of the row which
means that new modules will get added at the end of the list.  This is
covered in the upgrade case as well.

The one gotcha is that we need to make sure that we don't try to sort
by the weight column if the gallery module version is < 32, which is
something we haven't done before.
---
 installer/install.sql                         | 30 ++++++++++++++-------------
 modules/gallery/helpers/gallery_installer.php | 13 ++++++++++--
 modules/gallery/helpers/module.php            | 20 +++++++++++++++++-
 modules/gallery/module.info                   |  2 +-
 4 files changed, 47 insertions(+), 18 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 8836f53f..18cf607a 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -236,20 +236,22 @@ CREATE TABLE {modules} (
   `active` tinyint(1) DEFAULT '0',
   `name` varchar(64) DEFAULT NULL,
   `version` int(9) DEFAULT NULL,
+  `weight` int(9) DEFAULT NULL,
   PRIMARY KEY (`id`),
-  UNIQUE KEY `name` (`name`)
+  UNIQUE KEY `name` (`name`),
+  KEY `weight` (`weight`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',31);
-INSERT INTO {modules} VALUES (2,1,'user',3);
-INSERT INTO {modules} VALUES (3,1,'comment',3);
-INSERT INTO {modules} VALUES (4,1,'organize',1);
-INSERT INTO {modules} VALUES (5,1,'info',1);
-INSERT INTO {modules} VALUES (6,1,'rest',3);
-INSERT INTO {modules} VALUES (7,1,'rss',1);
-INSERT INTO {modules} VALUES (8,1,'search',1);
-INSERT INTO {modules} VALUES (9,1,'slideshow',2);
-INSERT INTO {modules} VALUES (10,1,'tag',2);
+INSERT INTO {modules} VALUES (1,1,'gallery',32,1);
+INSERT INTO {modules} VALUES (2,1,'user',3,2);
+INSERT INTO {modules} VALUES (3,1,'comment',3,3);
+INSERT INTO {modules} VALUES (4,1,'organize',1,4);
+INSERT INTO {modules} VALUES (5,1,'info',1,5);
+INSERT INTO {modules} VALUES (6,1,'rest',3,6);
+INSERT INTO {modules} VALUES (7,1,'rss',1,7);
+INSERT INTO {modules} VALUES (8,1,'search',1,8);
+INSERT INTO {modules} VALUES (9,1,'slideshow',2,9);
+INSERT INTO {modules} VALUES (10,1,'tag',2,10);
 DROP TABLE IF EXISTS {outgoing_translations};
 /*!40101 SET @saved_cs_client     = @@character_set_client */;
 /*!40101 SET character_set_client = utf8 */;
@@ -391,7 +393,7 @@ CREATE TABLE {vars} (
   `value` text,
   PRIMARY KEY (`id`),
   UNIQUE KEY `module_name` (`module_name`,`name`)
-) AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
 INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
@@ -408,14 +410,14 @@ INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5');
 INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400');
 INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
-INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
 INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1');
+INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
+INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:10;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:11;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:12;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
 INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
 INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
 INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
 INSERT INTO {vars} VALUES (NULL,'rest','allow_guest_access','0');
-INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:3:{i:9;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:10;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:11;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
 INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0');
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index f5589618..8fc0cf96 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -144,8 +144,10 @@ class gallery_installer {
                  `active` BOOLEAN default 0,
                  `name` varchar(64) default NULL,
                  `version` int(9) default NULL,
+                 `weight` int(9) default NULL,
                  PRIMARY KEY (`id`),
-                 UNIQUE KEY(`name`))
+                 UNIQUE KEY(`name`),
+                 KEY (`weight`))
                DEFAULT CHARSET=utf8;");
 
     $db->query("CREATE TABLE {outgoing_translations} (
@@ -296,7 +298,7 @@ class gallery_installer {
     module::set_var("gallery", "simultaneous_upload_limit", 5);
     module::set_var("gallery", "admin_area_timeout", 90 * 60);
     module::set_var("gallery", "maintenance_mode", 0);
-    module::set_version("gallery", 31);
+    module::set_version("gallery", 32);
   }
 
   static function upgrade($version) {
@@ -561,6 +563,13 @@ class gallery_installer {
       module::set_var("gallery", "maintenance_mode", 0);
       module::set_version("gallery", $version = 31);
     }
+
+    if ($version == 31) {
+      db::update("modules")
+        ->set("weight", "=", "id")
+        ->execute();
+      module::set_version("gallery", $version = 32);
+    }
   }
 
   static function uninstall() {
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 5134c7b3..ca6651f1 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -166,6 +166,16 @@ class module_Core {
     } else {
       module::set_version($module_name, 1);
     }
+
+    // Set the weight of the new module, which controls the order in which the modules are
+    // loaded. By default, new modules are installed at the end of the priority list.  Since the
+    // id field is monotonically increasing, the easiest way to guarantee that is to set the weight
+    // the same as the id.  We don't know that until we save it for the first time
+    $module = ORM::factory("module")->where("name", "=", $module_name)->find();
+    if ($module->loaded()) {
+      $module->weight = $module->id;
+      $module->save();
+    }
     module::load_modules();
 
     // Now the module is installed but inactive, so don't leave it in the active path
@@ -314,7 +324,15 @@ class module_Core {
     self::$modules = array();
     self::$active = array();
     $kohana_modules = array();
-    foreach (ORM::factory("module")->find_all() as $module) {
+
+    // In version 32 we introduced a weight column so we can specify the module order
+    // If we try to use that blindly, we'll break earlier versions before they can even
+    // run the upgrader.
+    $modules = module::get_version("gallery") < 32 ?
+      ORM::factory("module")->find_all():
+      ORM::factory("module")->order_by("weight")->find_all();
+
+    foreach ($modules as $module) {
       self::$modules[$module->name] = $module;
       if (!$module->active) {
         continue;
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 7d28a7c1..59db07de 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
 name = "Gallery 3"
 description = "Gallery core application"
-version = 31
+version = 32
-- 
cgit v1.2.3


From b6a377bc8219a5354778692086cd11b8fd05f927 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 14 Aug 2010 15:08:38 -0700
Subject: Update install.sql for gallery module version 3.  This was left out
 of 779d91cca01567a09b894e9fff4dfa32cb82d3d9 but it doesn't cause any real
 damage, it just means that anybody who got the code in the intervening window
 and did an initial install required an upgrade as well.

---
 installer/install.sql | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 18cf607a..0df82086 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -184,7 +184,8 @@ CREATE TABLE {items} (
   KEY `parent_id` (`parent_id`),
   KEY `type` (`type`),
   KEY `random` (`rand_key`),
-  KEY `weight` (`weight`)
+  KEY `weight` (`weight`),
+  KEY `left_ptr` (`left_ptr`)
 ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
@@ -242,7 +243,7 @@ CREATE TABLE {modules} (
   KEY `weight` (`weight`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',32,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',33,1);
 INSERT INTO {modules} VALUES (2,1,'user',3,2);
 INSERT INTO {modules} VALUES (3,1,'comment',3,3);
 INSERT INTO {modules} VALUES (4,1,'organize',1,4);
-- 
cgit v1.2.3


From 50e3230d79b8736f78ebaa4f1c7e6df1c29b3243 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 14 Aug 2010 15:10:07 -0700
Subject: Add a key on access_caches.item_id.  Without this, the Fix task query
 to find missing access_caches is very slow.  Bump Gallery module to v34.

---
 installer/install.sql                         |  5 +++--
 modules/gallery/helpers/gallery_installer.php | 10 ++++++++--
 modules/gallery/module.info                   |  2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 0df82086..c6314aa7 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -10,7 +10,8 @@ CREATE TABLE {access_caches} (
   `view_full_2` binary(1) NOT NULL DEFAULT '0',
   `edit_2` binary(1) NOT NULL DEFAULT '0',
   `add_2` binary(1) NOT NULL DEFAULT '0',
-  PRIMARY KEY (`id`)
+  PRIMARY KEY (`id`),
+  KEY `item_id` (`item_id`)
 ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
@@ -243,7 +244,7 @@ CREATE TABLE {modules} (
   KEY `weight` (`weight`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',33,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',34,1);
 INSERT INTO {modules} VALUES (2,1,'user',3,2);
 INSERT INTO {modules} VALUES (3,1,'comment',3,3);
 INSERT INTO {modules} VALUES (4,1,'organize',1,4);
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 21c47ad5..569c5118 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -23,7 +23,8 @@ class gallery_installer {
     $db->query("CREATE TABLE {access_caches} (
                  `id` int(9) NOT NULL auto_increment,
                  `item_id` int(9),
-                 PRIMARY KEY (`id`))
+                 PRIMARY KEY (`id`),
+                 KEY (`item_id`))
                DEFAULT CHARSET=utf8;");
 
     $db->query("CREATE TABLE {access_intents} (
@@ -299,7 +300,7 @@ class gallery_installer {
     module::set_var("gallery", "simultaneous_upload_limit", 5);
     module::set_var("gallery", "admin_area_timeout", 90 * 60);
     module::set_var("gallery", "maintenance_mode", 0);
-    module::set_version("gallery", 33);
+    module::set_version("gallery", 34);
   }
 
   static function upgrade($version) {
@@ -578,6 +579,11 @@ class gallery_installer {
       $db->query("ALTER TABLE {items} ADD KEY (`left_ptr`)");
       module::set_version("gallery", $version = 33);
     }
+
+    if ($version == 33) {
+      $db->query("ALTER TABLE {access_caches} ADD KEY (`item_id`)");
+      module::set_version("gallery", $version = 34);
+    }
   }
 
   static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index dbecda03..084a0945 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
 name = "Gallery 3"
 description = "Gallery core application"
-version = 33
+version = 34
-- 
cgit v1.2.3


From 922b810c56bc42a5d3df957cae82c0e70642f8fa Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 28 Aug 2010 21:25:09 -0700
Subject: Oops, forgot to create an install() function and set the version of
 the organize module to 2 in 8fb56abf034dd1f5c561e7af12bf6e097a3de6f6

---
 installer/install.sql                           | 2 +-
 modules/organize/helpers/organize_installer.php | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index c6314aa7..058bc882 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -247,7 +247,7 @@ CREATE TABLE {modules} (
 INSERT INTO {modules} VALUES (1,1,'gallery',34,1);
 INSERT INTO {modules} VALUES (2,1,'user',3,2);
 INSERT INTO {modules} VALUES (3,1,'comment',3,3);
-INSERT INTO {modules} VALUES (4,1,'organize',1,4);
+INSERT INTO {modules} VALUES (4,1,'organize',2,4);
 INSERT INTO {modules} VALUES (5,1,'info',1,5);
 INSERT INTO {modules} VALUES (6,1,'rest',3,6);
 INSERT INTO {modules} VALUES (7,1,'rss',1,7);
diff --git a/modules/organize/helpers/organize_installer.php b/modules/organize/helpers/organize_installer.php
index bbe6fc65..12d8147f 100644
--- a/modules/organize/helpers/organize_installer.php
+++ b/modules/organize/helpers/organize_installer.php
@@ -22,6 +22,10 @@ class organize_installer {
     site_status::clear("organize_needs_rest");
   }
 
+  static function install() {
+    module::set_version("organize", $version = 2);
+  }
+
   static function upgrade($version) {
     if ($version == 1) {
       if (!module::is_active("rest")) {
-- 
cgit v1.2.3


From a08cd0db4e0b90bd625b8c4c608c41a4c41721d1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 28 Aug 2010 21:57:54 -0700
Subject: Add a "visible_title_length" variable that defaults to 15 and use
 that as the max title length when we do title truncation in the wind theme.
 Bump the gallery module to 35.

---
 installer/install.sql                         |  5 +++--
 modules/gallery/helpers/gallery_installer.php |  8 +++++++-
 modules/gallery/module.info                   |  2 +-
 themes/wind/views/page.html.php               | 15 +++++++++------
 4 files changed, 20 insertions(+), 10 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 058bc882..3e67a07a 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
   KEY `weight` (`weight`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',34,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',35,1);
 INSERT INTO {modules} VALUES (2,1,'user',3,2);
 INSERT INTO {modules} VALUES (3,1,'comment',3,3);
 INSERT INTO {modules} VALUES (4,1,'organize',2,4);
@@ -395,7 +395,7 @@ CREATE TABLE {vars} (
   `value` text,
   PRIMARY KEY (`id`),
   UNIQUE KEY `module_name` (`module_name`,`name`)
-) AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=44 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
 INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
@@ -412,6 +412,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5');
 INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400');
 INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
+INSERT INTO {vars} VALUES (NULL,'gallery','visible_title_length','15');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 569c5118..9aabf22b 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -300,7 +300,8 @@ class gallery_installer {
     module::set_var("gallery", "simultaneous_upload_limit", 5);
     module::set_var("gallery", "admin_area_timeout", 90 * 60);
     module::set_var("gallery", "maintenance_mode", 0);
-    module::set_version("gallery", 34);
+    module::set_var("gallery", "visible_title_length", 15);
+    module::set_version("gallery", 35);
   }
 
   static function upgrade($version) {
@@ -584,6 +585,11 @@ class gallery_installer {
       $db->query("ALTER TABLE {access_caches} ADD KEY (`item_id`)");
       module::set_version("gallery", $version = 34);
     }
+
+    if ($version == 34) {
+      module::set_var("gallery", "visible_title_length", 15);
+      module::set_version("gallery", $version = 35);
+    }
   }
 
   static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 084a0945..94942840 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
 name = "Gallery 3"
 description = "Gallery core application"
-version = 34
+version = 35
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index 9f94b04f..3c4f6ef5 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -101,19 +101,22 @@
           <? $i = 0 ?>
           <? foreach ($parents as $parent): ?>
           <li<? if ($i == 0) print " class=\"g-first\"" ?>>
-            <!-- Adding ?show=<id> causes Gallery3 to display the page
-                 containing that photo.  For now, we just do it for
-                 the immediate parent so that when you go back up a
-                 level you're on the right page. -->
+            <? // Adding ?show=<id> causes Gallery3 to display the page
+               // containing that photo.  For now, we just do it for
+               // the immediate parent so that when you go back up a
+               // level you're on the right page. ?>
             <a href="<?= $parent->url($parent == $theme->item()->parent() ?
                      "show={$theme->item()->id}" : null) ?>">
-              <?= html::purify(text::limit_chars($parent->title, 15)) ?>
+              <!-- limit the title length to something reasonable (defaults to 15) -->
+              <?= html::purify(text::limit_chars($parent->title,
+                    module::get_var("gallery", "visible_title_length"))) ?>
             </a>
           </li>
           <? $i++ ?>
           <? endforeach ?>
           <li class="g-active<? if ($i == 0) print " g-first" ?>">
-            <?= html::purify(text::limit_chars($theme->item()->title, 15)) ?>
+            <?= html::purify(text::limit_chars($theme->item()->title,
+                  module::get_var("gallery", "visible_title_length"))) ?>
           </li>
         </ul>
         <? endif ?>
-- 
cgit v1.2.3


From 4c8445852d0657d8c598d38096852b49e4672638 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sun, 29 Aug 2010 16:26:27 -0700
Subject: Bump gallery module to v36 and add a favicon_url variable, which we
 expose in Admin > Appearance > Theme Options and defaults to
 lib/images/favicon.ico.

Thix fixes ticket #1312.
---
 installer/install.sql                               | 5 +++--
 modules/gallery/controllers/admin_theme_options.php | 4 ++++
 modules/gallery/helpers/gallery_installer.php       | 8 +++++++-
 modules/gallery/module.info                         | 2 +-
 themes/admin_wind/views/admin.html.php              | 2 +-
 themes/wind/views/page.html.php                     | 2 +-
 6 files changed, 17 insertions(+), 6 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 3e67a07a..e08c4128 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
   KEY `weight` (`weight`)
 ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',35,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',36,1);
 INSERT INTO {modules} VALUES (2,1,'user',3,2);
 INSERT INTO {modules} VALUES (3,1,'comment',3,3);
 INSERT INTO {modules} VALUES (4,1,'organize',2,4);
@@ -395,7 +395,7 @@ CREATE TABLE {vars} (
   `value` text,
   PRIMARY KEY (`id`),
   UNIQUE KEY `module_name` (`module_name`,`name`)
-) AUTO_INCREMENT=44 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
 INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
@@ -414,6 +414,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
 INSERT INTO {vars} VALUES (NULL,'gallery','visible_title_length','15');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
+INSERT INTO {vars} VALUES (NULL,'gallery','favicon_url','lib/images/favicon.ico');
 INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
 INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
 INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1');
diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php
index 781d6e62..58ed723e 100644
--- a/modules/gallery/controllers/admin_theme_options.php
+++ b/modules/gallery/controllers/admin_theme_options.php
@@ -58,6 +58,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
       module::set_var("gallery", "header_text", $form->edit_theme->header_text->value);
       module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value);
       module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
+      module::set_var("gallery", "favicon_url", $form->edit_theme->favicon_url->value);
 
       module::event("theme_edit_form_completed", $form);
 
@@ -89,6 +90,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
       ->error_messages("required", t("You must enter a number"))
       ->error_messages("valid_digit", t("You must enter a number"))
       ->value(module::get_var("gallery", "resize_size"));
+    $group->input("favicon_url")->label(t("URL (or relative path) to your favicon.ico"))
+      ->id("g-favicon")
+      ->value(module::get_var("gallery", "favicon_url"));
     $group->textarea("header_text")->label(t("Header text"))->id("g-header-text")
       ->value(module::get_var("gallery", "header_text"));
     $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text")
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 9aabf22b..d1bfa656 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -301,7 +301,8 @@ class gallery_installer {
     module::set_var("gallery", "admin_area_timeout", 90 * 60);
     module::set_var("gallery", "maintenance_mode", 0);
     module::set_var("gallery", "visible_title_length", 15);
-    module::set_version("gallery", 35);
+    module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
+    module::set_version("gallery", 36);
   }
 
   static function upgrade($version) {
@@ -590,6 +591,11 @@ class gallery_installer {
       module::set_var("gallery", "visible_title_length", 15);
       module::set_version("gallery", $version = 35);
     }
+
+    if ($version == 35) {
+      module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
+      module::set_version("gallery", $version = 36);
+    }
   }
 
   static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 94942840..44da9f2f 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
 name = "Gallery 3"
 description = "Gallery core application"
-version = 35
+version = 36
diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php
index 6b0c3fe5..c4b51f41 100644
--- a/themes/admin_wind/views/admin.html.php
+++ b/themes/admin_wind/views/admin.html.php
@@ -11,7 +11,7 @@
         <?= t("Admin dashboard") ?>
       <? endif ?>
     </title>
-    <link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
+    <link rel="shortcut icon" href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>" type="image/x-icon" />
 
     <?= $theme->css("yui/reset-fonts-grids.css") ?>
     <?= $theme->css("themeroller/ui.base.css") ?>
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index 3c4f6ef5..4938ed60 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -23,7 +23,7 @@
         <? endif ?>
       <? endif ?>
     </title>
-    <link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
+    <link rel="shortcut icon" href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>" type="image/x-icon" />
     <?= $theme->css("yui/reset-fonts-grids.css") ?>
     <?= $theme->css("superfish/css/superfish.css") ?>
     <?= $theme->css("themeroller/ui.base.css") ?>
-- 
cgit v1.2.3

