From 02de0bdc280d8aec841353d87cb6af4bcacea8bd Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Sun, 6 May 2012 10:03:25 -0700
Subject: Update the installer bundle for the comment module.  Fixes #1852.

---
 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 2b8ec11e..17f40cab 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -246,7 +246,7 @@ CREATE TABLE {modules} (
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {modules} VALUES (1,1,'gallery',49,1);
 INSERT INTO {modules} VALUES (2,1,'user',4,2);
-INSERT INTO {modules} VALUES (3,1,'comment',4,3);
+INSERT INTO {modules} VALUES (3,1,'comment',5,3);
 INSERT INTO {modules} VALUES (4,1,'organize',4,4);
 INSERT INTO {modules} VALUES (5,1,'info',2,5);
 INSERT INTO {modules} VALUES (6,1,'rss',1,6);
@@ -382,7 +382,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');
@@ -419,6 +419,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
 INSERT INTO {vars} VALUES (NULL,'user','minimum_password_length','5');
 INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
 INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
+INSERT INTO {vars} VALUES (NULL,'comment','rss_available','both');
 INSERT INTO {vars} VALUES (NULL,'info','show_title','1');
 INSERT INTO {vars} VALUES (NULL,'info','show_description','1');
 INSERT INTO {vars} VALUES (NULL,'info','show_owner','1');
-- 
cgit v1.2.3


From 5400c4be26a809be8b0571f1291aa528ef39b743 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta <bharat@menalto.com>
Date: Mon, 7 May 2012 13:45:13 -0700
Subject: Oops, fix up a bug originally added in
 7d66ab2e949bc915f108737f08cac2f9057ef729 when I tweaked the name of the
 rss_available variable to be rss_visible, but got it wrong.  Bump the comment
 module to 6 so that we run the installer and clean up old vars.

Fixes #1854.
---
 installer/install.sql                          |  4 ++--
 modules/comment/controllers/admin_comments.php |  4 ++--
 modules/comment/helpers/comment_installer.php  | 14 ++++++++++++--
 modules/comment/module.info                    |  2 +-
 4 files changed, 17 insertions(+), 7 deletions(-)

(limited to 'installer/install.sql')

diff --git a/installer/install.sql b/installer/install.sql
index 17f40cab..2ba168d2 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -246,7 +246,7 @@ CREATE TABLE {modules} (
 /*!40101 SET character_set_client = @saved_cs_client */;
 INSERT INTO {modules} VALUES (1,1,'gallery',49,1);
 INSERT INTO {modules} VALUES (2,1,'user',4,2);
-INSERT INTO {modules} VALUES (3,1,'comment',5,3);
+INSERT INTO {modules} VALUES (3,1,'comment',6,3);
 INSERT INTO {modules} VALUES (4,1,'organize',4,4);
 INSERT INTO {modules} VALUES (5,1,'info',2,5);
 INSERT INTO {modules} VALUES (6,1,'rss',1,6);
@@ -419,7 +419,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
 INSERT INTO {vars} VALUES (NULL,'user','minimum_password_length','5');
 INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
 INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
-INSERT INTO {vars} VALUES (NULL,'comment','rss_available','both');
+INSERT INTO {vars} VALUES (NULL,'comment','rss_visible','both');
 INSERT INTO {vars} VALUES (NULL,'info','show_title','1');
 INSERT INTO {vars} VALUES (NULL,'info','show_description','1');
 INSERT INTO {vars} VALUES (NULL,'info','show_owner','1');
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php
index bcd6a939..00a7a608 100644
--- a/modules/comment/controllers/admin_comments.php
+++ b/modules/comment/controllers/admin_comments.php
@@ -32,8 +32,8 @@ class Admin_Comments_Controller extends Admin_Controller {
     $form->validate();
     module::set_var("comment", "access_permissions",
                     $form->comment_settings->access_permissions->value);
-    module::set_var("comment", "rss_available",
-                    $form->comment_settings->rss_available->value);
+    module::set_var("comment", "rss_visible",
+                    $form->comment_settings->rss_visible->value);
     message::success(t("Comment settings updated"));
     url::redirect("admin/comments");
   }
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index a64064f6..cbb8c783 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -48,8 +48,8 @@ class comment_installer {
 
     module::set_var("comment", "spam_caught", 0);
     module::set_var("comment", "access_permissions", "everybody");
-    module::set_var("comment", "rss_available", "both");
-    module::set_version("comment", 5);
+    module::set_var("comment", "rss_visible", "both");
+    module::set_version("comment", 6);
   }
 
   static function upgrade($version) {
@@ -81,6 +81,16 @@ class comment_installer {
       module::set_var("comment", "rss_visible", "all");
       module::set_version("comment", $version = 5);
     }
+
+    // In version 5 we accidentally set the installer variable to rss_available when it should
+    // have been rss_visible.  Migrate it over now, if necessary.
+    if ($version == 5) {
+      if (!module::get_var("comment", "rss_visible")) {
+        module::set_var("comment", "rss_visible", module::get_var("comment", "rss_available"));
+      }
+      module::clear_var("comment", "rss_available");
+      module::set_version("comment", $version = 6);
+    }
   }
 
   static function uninstall() {
diff --git a/modules/comment/module.info b/modules/comment/module.info
index ecbf8885..bd4abe9f 100644
--- a/modules/comment/module.info
+++ b/modules/comment/module.info
@@ -1,6 +1,6 @@
 name = "Comments"
 description = "Allows users and guests to leave comments on photos and albums."
-version = 5
+version = 6
 author_name = "Gallery Team"
 author_url = "http://codex.gallery2.org/Gallery:Team"
 info_url = "http://codex.gallery2.org/Gallery3:Modules:comment"
-- 
cgit v1.2.3

