From b6322b1c9f9b0914fa639dba3361f1ff6fe05ab5 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Thu, 28 Jan 2010 21:31:54 -0800
Subject: Updated for model based validation.  We must now provide a
 placeholder email address for the admin user, since one is required for all
 users.

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

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 95a57d86..39637fb3 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -355,7 +355,7 @@ CREATE TABLE {users} (
 ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 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,NULL,1,0,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;
@@ -366,7 +366,7 @@ CREATE TABLE {vars} (
   `value` text,
   PRIMARY KEY  (`id`),
   UNIQUE KEY `module_name` (`module_name`,`name`)
-) AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;
+) AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
 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');
@@ -385,8 +385,8 @@ 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','spam_caught','0');
-INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
 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 45cdac973d35de083875ed966ac687b805d60e7f Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Fri, 29 Jan 2010 14:06:36 -0800
Subject: Oops, somebody (me?) forgot to update the gallery module version
 number in gallery_installer::install() so the install.sql was out of sync.

---
 installer/install.sql                         | 2 +-
 modules/gallery/helpers/gallery_installer.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 39637fb3..a5eec229 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -228,7 +228,7 @@ CREATE TABLE {modules} (
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
 SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',21);
+INSERT INTO {modules} VALUES (1,1,'gallery',22);
 INSERT INTO {modules} VALUES (2,1,'user',2);
 INSERT INTO {modules} VALUES (3,1,'comment',2);
 INSERT INTO {modules} VALUES (4,1,'organize',1);
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index bfab4645..93948045 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -276,7 +276,7 @@ class gallery_installer {
     // @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", "simultaneous_upload_limit", 5);
-    module::set_version("gallery", 21);
+    module::set_version("gallery", 22);
   }
 
   static function upgrade($version) {
-- 
cgit v1.2.3


From c8a8097ef2ebbb78d7d20b99f1ea2af3da946bca Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 30 Jan 2010 20:40:28 -0800
Subject: Gallery module version 23, with the failed_logins table.

---
 installer/install.sql | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index a5eec229..e64a961e 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -74,6 +74,17 @@ CREATE TABLE {comments} (
   PRIMARY KEY  (`id`)
 ) DEFAULT CHARSET=utf8;
 SET character_set_client = @saved_cs_client;
+DROP TABLE IF EXISTS {failed_logins};
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE {failed_logins} (
+  `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`)
+) DEFAULT CHARSET=utf8;
+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;
@@ -228,7 +239,7 @@ CREATE TABLE {modules} (
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
 SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',22);
+INSERT INTO {modules} VALUES (1,1,'gallery',23);
 INSERT INTO {modules} VALUES (2,1,'user',2);
 INSERT INTO {modules} VALUES (3,1,'comment',2);
 INSERT INTO {modules} VALUES (4,1,'organize',1);
-- 
cgit v1.2.3


From cb92e58d40bfa866c07b10fe189bd653074a9917 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sat, 30 Jan 2010 21:16:47 -0800
Subject: Update install.sql -- gallery version jumps from 23 to 25 due to a
 mistake in the version 24 upgrade code.

Update packager to serialize files so that we can serialize the new
.htaccess files

Update init_var.php to include the newly serialized .htaccess files.

Fixes ticket #587.
---
 installer/init_var.php                   | 3 +++
 installer/install.sql                    | 2 +-
 modules/gallery/controllers/packager.php | 9 ++++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/init_var.php b/installer/init_var.php
index c010888c..353665a3 100755
--- a/installer/init_var.php
+++ b/installer/init_var.php
@@ -7,3 +7,6 @@
 !file_exists(VARPATH . "thumbs") && mkdir(VARPATH . "thumbs");
 !file_exists(VARPATH . "tmp") && mkdir(VARPATH . "tmp");
 !file_exists(VARPATH . "uploads") && mkdir(VARPATH . "uploads");
+file_put_contents(VARPATH . "logs/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
+file_put_contents(VARPATH . "tmp/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
+file_put_contents(VARPATH . "uploads/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
diff --git a/installer/install.sql b/installer/install.sql
index e64a961e..20b632fa 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -239,7 +239,7 @@ CREATE TABLE {modules} (
   UNIQUE KEY `name` (`name`)
 ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
 SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',23);
+INSERT INTO {modules} VALUES (1,1,'gallery',25);
 INSERT INTO {modules} VALUES (2,1,'user',2);
 INSERT INTO {modules} VALUES (3,1,'comment',2);
 INSERT INTO {modules} VALUES (4,1,'organize',1);
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index cb64f1bf..66626483 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -164,7 +164,7 @@ class Packager_Controller extends Controller {
     foreach($objects as $name => $file){
       if ($file->getBasename() == "database.php") {
         continue;
-      } else if (basename($file->getPath()) == "logs") {
+      } else if (basename($file->getPath()) == "logs" && $file->getBasename() != ".htaccess") {
         continue;
       }
 
@@ -172,8 +172,8 @@ class Packager_Controller extends Controller {
         $paths[] = "VARPATH . \"" . substr($name, strlen(VARPATH)) . "\"";
       } else {
         // @todo: serialize non-directories
-        print "IGNORING FILE: $name\n";
-        return;
+        $files["VARPATH . \"" . substr($name, strlen(VARPATH)) . "\""] =
+          base64_encode(file_get_contents($name));
       }
     }
     // Sort the paths so that the var file is stable
@@ -185,6 +185,9 @@ class Packager_Controller extends Controller {
     foreach ($paths as $path) {
       fwrite($fd, "!file_exists($path) && mkdir($path);\n");
     }
+    foreach ($files as $file => $contents) {
+      fwrite($fd, "file_put_contents($file, base64_decode(\"$contents\"));\n");
+    }
     fclose($fd);
   }
 }
\ No newline at end of file
-- 
cgit v1.2.3

