summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2012-07-21 15:11:27 -0700
committerBharat Mediratta <bharat@menalto.com>2012-07-21 15:11:27 -0700
commit467a032f8e4927590a9860adbf3f9a25dd599657 (patch)
treee3b6c123d704177ac0ad65c8538929818dc9492a
parent6d9d6a2e5d4fae49942e78e4e812c44934513f4a (diff)
Rename any files that have two dots in them to a legal name. This
fixes the bug where we made those files invalid in 3.0.4 without providing a clean upgrade path. Bump gallery module to 50. Fixes
-rw-r--r--installer/install.sql2
-rw-r--r--modules/gallery/helpers/gallery_installer.php23
-rw-r--r--modules/gallery/module.info2
3 files changed, 24 insertions, 3 deletions
diff --git a/installer/install.sql b/installer/install.sql
index 2ba168d2..2353a75a 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',49,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',50,1);
INSERT INTO {modules} VALUES (2,1,'user',4,2);
INSERT INTO {modules} VALUES (3,1,'comment',6,3);
INSERT INTO {modules} VALUES (4,1,'organize',4,4);
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 2fb2bfd4..e556b49a 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -313,7 +313,7 @@ class gallery_installer {
module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
module::set_var("gallery", "timezone", null);
- module::set_version("gallery", 49);
+ module::set_version("gallery", 50);
}
static function upgrade($version) {
@@ -692,6 +692,27 @@ class gallery_installer {
module::set_var("gallery", "timezone", null);
module::set_version("gallery", $version = 49);
}
+
+ if ($version == 49) {
+ // In v49 we changed the Item_Model validation code to disallow files with two dots in them,
+ // but we didn't rename any files which fail to validate, so as soon as you do anything to
+ // change those files (eg. as a side effect of getting the url or file path) it fails to
+ // validate. Fix those here. This might be slow, but if it times out it can just pick up
+ // where it left off.
+ foreach (db::build()
+ ->from("items")
+ ->select("id")
+ ->where("type", "<>", "album")
+ ->where(db::expr("`name` REGEXP '\\\\..*\\\\.'"), "=", 1)
+ ->order_by("id", "asc")
+ ->execute() as $row) {
+ set_time_limit(30);
+ $item = ORM::factory("item", $row->id);
+ $item->name = legal_file::smash_extensions($item->name);
+ $item->save();
+ }
+ module::set_version("gallery", $version = 50);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 42345531..a905a241 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,6 +1,6 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 49
+version = 50
author_name = "Gallery Team"
author_url = "http://codex.gallery2.org/Gallery:Team"
info_url = "http://codex.gallery2.org/Gallery3:Modules:gallery"