summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_installer.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
-rw-r--r--modules/gallery/helpers/gallery_installer.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 051a66cf..f1604150 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -797,6 +797,38 @@ class gallery_installer {
module::set_var("gallery", "movie_allow_uploads", "autodetect");
module::set_version("gallery", $version = 56);
}
+
+ if ($version == 56) {
+ // Cleanup possible instances where resize_dirty of albums or movies was set to 0. This is
+ // unlikely to have occurred, and doesn't currently matter much since albums and movies don't
+ // have resize images anyway. However, it may be useful to be consistent here going forward.
+ db::build()
+ ->update("items")
+ ->set("resize_dirty", 1)
+ ->where("type", "<>", "photo")
+ ->execute();
+ module::set_version("gallery", $version = 57);
+ }
+
+ if ($version == 57) {
+ // In v58 we changed the Item_Model validation code to disallow files or directories with
+ // backslashes in them, and we need to fix any existing items that have them. This is
+ // pretty unlikely, as having backslashes would have probably already caused other issues for
+ // users, but we should check anyway. 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(db::expr("`name` REGEXP '\\\\\\\\'"), "=", 1) // one \, 3x escaped
+ ->order_by("id", "asc")
+ ->execute() as $row) {
+ set_time_limit(30);
+ $item = ORM::factory("item", $row->id);
+ $item->name = str_replace("\\", "_", $item->name);
+ $item->save();
+ }
+ module::set_version("gallery", $version = 58);
+ }
}
static function uninstall() {