From 8e8a9f728b4e04f281eacc1467e79f55cb2343c5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 04:41:06 -0700 Subject: Update comments --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6ebdd994..e7d630f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# Ignore the var subdirectory +# We store Gallery3 data in var var -# Ignore the index.local.php +# local.php is a local customization point that gets loaded at the end of index.php local.php -- cgit v1.2.3 From 954ab5a5051edb67eca8ae74283a80a226e39672 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 05:03:36 -0700 Subject: Further simplify server_add (and bump it to version 3). Now we don't have checkboxes, but instead we restrict you to selecting directories and albums from only one level in the hierarchy. This makes it easier for us to make sure that we properly create the hierarchy that you want and avoid confusion about what's going to wind up where. Modify Server_Add_File_Model to have a parent_id and item_id and then modify them as we go so that we can build up a tree structure there *before* we create any items. This makes it much easier to figure out where a new item is going to go and get rid of a bunch of probably buggy code in the main task. --- modules/server_add/controllers/server_add.php | 199 +++++++++------------ .../server_add/helpers/server_add_installer.php | 8 +- modules/server_add/js/server_add.js | 67 ++----- modules/server_add/module.info | 2 +- modules/server_add/views/server_add_tree.html.php | 56 ++++-- themes/default/css/screen.css | 20 +-- 6 files changed, 158 insertions(+), 194 deletions(-) diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 08e01858..6056d7cd 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -29,51 +29,58 @@ class Server_Add_Controller extends Admin_Controller { $view->item = $item; $view->tree = new View("server_add_tree.html"); $view->tree->files = $files; + $view->tree->parents = array(); print $view; } public function children() { $path = $this->input->get("path"); - if (!server_add::is_valid_path($path)) { - throw new Exception("@todo BAD_PATH"); - } $tree = new View("server_add_tree.html"); $tree->files = array(); - $tree->tree_id = substr(md5($path), 10); + $tree->parents = array(); - foreach (glob("$path/*") as $file) { - if (!is_readable($file)) { - continue; + // Make a tree with the parents back up to the authorized path, and all the children under the + // current path. + if (server_add::is_valid_path($path)) { + $tree->parents[] = $path; + while (server_add::is_valid_path(dirname($tree->parents[0]))) { + array_unshift($tree->parents, dirname($tree->parents[0])); } - if (!is_dir($file)) { - $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); - if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4"))) { + foreach (glob("$path/*") as $file) { + if (!is_readable($file)) { continue; } - } + if (!is_dir($file)) { + $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4"))) { + continue; + } + } - $tree->files[] = $file; + $tree->files[] = $file; + } + } else { + // Missing or invalid path; print out the list of authorized path + $paths = unserialize(module::get_var("server_add", "authorized_paths")); + foreach (array_keys($paths) as $path) { + $tree->files[] = $path; + } } print $tree; } + /** + * Begin the task of adding photos. + */ public function start() { access::verify_csrf(); - $item = ORM::factory("item", Input::instance()->get("item_id")); - // We're an admin so this isn't necessary, but we'll eventually open this up to non-admins and - // this also verifies that the item was loaded properly. - access::required("edit", $item); - // Gather up all the paths and associate them by directory, so that we can locate any empty - // directories for the next round. foreach (Input::instance()->post("paths") as $path) { - if (is_dir($path)) { - $selections[$path] = array(); - } else if (is_file($path)) { - $selections[dirname($path)][] = $path; + if (server_add::is_valid_path($path)) { + $paths[] = array($path, null); } } @@ -81,8 +88,7 @@ class Server_Add_Controller extends Admin_Controller { ->callback("Server_Add_Controller::add") ->description(t("Add photos or movies from the local server")) ->name(t("Add from server")); - $task = task::create( - $task_def, array("item_id" => $item->id, "selections" => $selections)); + $task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths)); print json_encode( array("result" => "started", @@ -90,6 +96,9 @@ class Server_Add_Controller extends Admin_Controller { "url" => url::site("server_add/run/$task->id?csrf=" . access::csrf_token()))); } + /** + * Run the task of adding photos + */ function run($task_id) { access::verify_csrf(); @@ -110,49 +119,48 @@ class Server_Add_Controller extends Admin_Controller { * them one at a time. */ static function add($task) { - $selections = $task->get("selections"); $mode = $task->get("mode", "init"); $start = microtime(true); - $item_id = $task->get("item_id"); switch ($mode) { case "init": $task->set("mode", "build-file-list"); - $task->set("queue", array_keys($selections)); $task->percent_complete = 0; $task->status = t("Starting up"); batch::start(); break; - case "build-file-list": /* 0% to 10% */ + case "build-file-list": // 0% to 10% // We can't fit an arbitrary number of paths in a task, so store them in a separate table. // Don't use an iterator here because we can't get enough control over it when we're dealing - // with a deep hierarchy and we don't want to go over our time quota. + // with a deep hierarchy and we don't want to go over our time quota. The queue is in the + // form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We + // have this extra level of abstraction because we don't know its Item_Model id yet. $queue = $task->get("queue"); while ($queue && microtime(true) - $start < 0.5) { - $file = array_shift($queue); - if (is_dir($file)) { - $entry = ORM::factory("server_add_file"); - $entry->task_id = $task->id; - $entry->file = $file; - $entry->save(); - - $children = empty($selections[$file]) ? glob("$file/*") : $selections[$file]; - } else { - $children = array($file); - } - - foreach ($children as $child) { - $entry = ORM::factory("server_add_file"); - $entry->task_id = $task->id; - $entry->file = $child; - $entry->save(); + list($file, $parent_entry_id) = array_shift($queue); + $entry = ORM::factory("server_add_file"); + $entry->task_id = $task->id; + $entry->file = $file; + $entry->parent_id = $parent_entry_id; + $entry->save(); + foreach (glob("$file/*") as $child) { if (is_dir($child)) { - $queue[] = $child; + $queue[] = array($child, $entry->id); + } else { + $ext = strtolower(pathinfo($child, PATHINFO_EXTENSION)); + if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4"))) { + $child_entry = ORM::factory("server_add_file"); + $child_entry->task_id = $task->id; + $child_entry->file = $child; + $child_entry->parent_id = $entry->id; + $child_entry->save(); + } } } } + // We have no idea how long this can take because we have no idea how deep the tree // hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go // over 10% in percent_complete. @@ -168,79 +176,67 @@ class Server_Add_Controller extends Admin_Controller { $task->set( "total_files", database::instance()->count_records( "server_add_files", array("task_id" => $task->id))); - $task->set("albums", array()); - $task->set("completed", 0); $task->percent_complete = 10; } break; - case "add-files": /* 10% to 100% */ - $completed_files = $task->get("completed_files"); + case "add-files": // 10% to 100% + $completed_files = $task->get("completed_files", 0); $total_files = $task->get("total_files"); - $albums = $task->get("albums"); // Ordering by id ensures that we add them in the order that we created the entries, which - // will create albums first. + // will create albums first. Ignore entries which already have an Item_Model attached, + // they're done. $entries = ORM::factory("server_add_file") ->where("task_id", $task->id) + ->where("item_id", null) ->orderby("id", "ASC") ->limit(10) ->find_all(); if ($entries->count() == 0) { + // Out of entries, we're done. $task->set("mode", "done"); } - $item = model_cache::get("item", $item_id); + $owner_id = user::active()->id; foreach ($entries as $entry) { if (microtime(true) - $start > 0.5) { break; } - $relative_path = self::_relative_path($entry->file); - $name = basename($relative_path); + // Look up the parent item for this entry. By now it should exist, but if none was + // specified, then this belongs as a child of the current item. + $parent_entry = ORM::factory("server_add_file", $entry->parent_id); + if (!$parent_entry->loaded) { + $parent = ORM::factory("item", $task->get("item_id")); + } else { + $parent = ORM::factory("item", $parent_entry->item_id); + } + + $name = basename($entry->file); $title = item::convert_filename_to_title($name); if (is_dir($entry->file)) { - $parent_path = dirname($relative_path); - if (isset($albums[$parent_path]) && $parent_id = $albums[$parent_path]) { - $parent = ORM::factory("item", $parent_id); - } else { - $parent = $item; - } - $album = album::create($parent, $name, $title, null, user::active()->id); - $albums[$relative_path] = $album->id; - $task->set("albums", $albums); + $album = album::create($parent, $name, $title, null, $owner_id); + $entry->item_id = $album->id; } else { - // Find the nearest selected parent. We check to see if any of the candidate parents - // were selected in the UI and if so, we use that. Otherwise, we fall back to making - // the parent the current item. - $parent_path = $relative_path; - $parent = null; - do { - if (strpos($parent_path, "/") !== false) { - if (array_key_exists($parent_path, $albums)) { - $parent = ORM::factory("item", $albums[$parent_path]); - } else { - $parent_path = dirname($parent_path); - } - } else { - $parent = $item; - } - } while (!$parent); - $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) { - photo::create($parent, $entry->file, $name, $title, null, user::active()->id); + $photo = photo::create($parent, $entry->file, $name, $title, null, $owner_id); + $entry->item_id = $photo->id; } else if (in_array($extension, array("flv", "mp4"))) { - movie::create($parent, $entry->file, $name, $title, null, user::active()->id); + $movie = movie::create($parent, $entry->file, $name, $title, null, $owner_id); + $entry->item_id = $movie->id; } else { - $task->log("Skipping unknown file type: $relative_path"); - // Unsupported type - // @todo: $task->log this + // This should never happen, because we don't add stuff to the list that we can't + // process. But just in, case.. set this to a non-null value so that we skip this + // entry. + $entry->item_id = 0; + $task->log("Skipping unknown file type: $entry->file"); } } $completed_files++; - $entry->delete(); + $entry->save(); } $task->set("completed_files", $completed_files); $task->status = t("Adding photos and albums (%completed of %total)", @@ -254,33 +250,10 @@ class Server_Add_Controller extends Admin_Controller { $task->done = true; $task->state = "success"; $task->percent_complete = 100; + ORM::factory("server_add_file")->where("task_id", $task->id)->delete_all(); message::info(t2("Successfully added one photo", - "Successfully added %count photos", + "Successfully added %count photos and albums", $task->get("completed_files"))); } } - - /** - * Given a path that's somewhere in our authorized_paths list, return just the part that's - * relative to the nearest authorized path. - */ - static function _relative_path($path) { - static $authorized_paths; - // @todo this doesn't deal well with overlapping authorized paths, it'll just use the first one - // that matches. If we sort $authorized_paths by length in descending order, that should take - // care of the problem. - if (!$authorized_paths) { - $authorized_paths = - array_keys(unserialize(module::get_var("server_add", "authorized_paths"))); - } - - foreach ($authorized_paths as $candidate) { - $candidate = dirname($candidate); - if (strpos($path, $candidate) === 0) { - return substr($path, strlen($candidate) + 1); - } - } - - throw new Exception("@todo BAD_PATH"); - } } diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php index 6956a72c..4cc34207 100644 --- a/modules/server_add/helpers/server_add_installer.php +++ b/modules/server_add/helpers/server_add_installer.php @@ -22,8 +22,10 @@ class server_add_installer { $db = Database::instance(); $db->query("CREATE TABLE {server_add_files} ( `id` int(9) NOT NULL auto_increment, - `task_id` int(9) NOT NULL, `file` varchar(255) NOT NULL, + `item_id` int(9), + `parent_id` int(9), + `task_id` int(9) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("server_add", 2); @@ -40,6 +42,10 @@ class server_add_installer { PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("server_add", $version = 2); + } else if ($version == 2) { + $db->query("ALTER TABLE {server_add_files} ADD COLUMN `item_id` int(9)"); + $db->query("ALTER TABLE {server_add_files} ADD COLUMN `parent_id` int(9)"); + module::set_version("server_add", $version = 3); } } diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 1a78d733..989555cc 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -1,51 +1,9 @@ /** - * We've clicked the + icon next to a directory. Load up children of this - * directory from the server and display them. + * Manage file selection state. */ -function open_close_branch(path, id) { - var parent = $("#file_" + id); - var children = $("#tree_" + id); - var icon = parent.find(".ui-icon:first"); - - if (!children.html()) { - parent.addClass("gLoadingSmall"); - $.ajax({ - url: GET_CHILDREN_URL.replace("__PATH__", path), - success: function(data, textStatus) { - children.html(data); - parent.removeClass("gLoadingSmall"); - - // Propagate checkbox value - children.find("input[type=checkbox]").attr( - "checked", parent.find("input[type=checkbox]:first").attr("checked")); - } - }); - } - - children.slideToggle("fast", function() { - if (children.is(":hidden")) { - icon.addClass("ui-icon-plus"); - icon.removeClass("ui-icon-minus"); - } else { - icon.addClass("ui-icon-minus"); - icon.removeClass("ui-icon-plus"); - parent.removeClass("gCollapsed"); - } - }); -} - -/** - * We've clicked a checkbox. Propagate the value downwards as necessary. - */ -function click_node(checkbox) { - var parent = $(checkbox).parents("li").get(0); - var checked = $(checkbox).attr("checked"); - $(parent).find("input[type=checkbox]").attr("checked", checked); - - // @todo if we uncheck all the children for a parent, we should uncheck the - // parent itself, otherwise in the code we'll add the entire parent since if - // we find an album as a leaf, we assume that it's never been expanded in the UI. - if ($("#gServerAddTree").find("input[type=checkbox]").is(":checked")) { +function select_file(li) { + $(li).toggleClass("selected"); + if ($("#gServerAdd span.selected").length) { $("#gServerAddAddButton").enable(true); $("#gServerAddAddButton").removeClass("ui-state-disabled"); } else { @@ -54,11 +12,24 @@ function click_node(checkbox) { } } +/** + * Load a new directory + */ +function open_dir(path) { + $.ajax({ + url: GET_CHILDREN_URL.replace("__PATH__", path), + success: function(data, textStatus) { + $("#gServerAddTree").html(data); + } + }); +} + function start_add() { var paths = []; - $.each($("#gServerAdd :checkbox[checked]"), function () { - paths.push(this.value); + $.each($("#gServerAdd span.selected"), function () { + paths.push($(this).attr("file")); }); + $.ajax({ url: START_URL, type: "POST", diff --git a/modules/server_add/module.info b/modules/server_add/module.info index 1c99d280..295d3beb 100644 --- a/modules/server_add/module.info +++ b/modules/server_add/module.info @@ -1,3 +1,3 @@ name = Server Add description = Allows authorized users to load images directly from your web server -version = 2 +version = 3 diff --git a/modules/server_add/views/server_add_tree.html.php b/modules/server_add/views/server_add_tree.html.php index 74bc40e0..254a9da0 100644 --- a/modules/server_add/views/server_add_tree.html.php +++ b/modules/server_add/views/server_add_tree.html.php @@ -1,19 +1,41 @@ - - -
  • "> - - - - - - - +
  • + + + + +
      + + +
    • + + + + +
        + + + +
      • + "> + + ondblclick="open_dir($(this).attr('file'))" + + file="" + > + + +
      • + + +
      • + + + +
      +
    • + + +
  • - - -
  • - diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 41e51623..842a1491 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -879,24 +879,20 @@ form .gError, /* Server Add */ -.gCheckboxTree input { - display: inline; +#gServerAddTree { + cursor: pointer; } -.gCheckboxTree li { +#gServerAddTree li { padding: 0; float: none; } -.gCheckboxTree .ui-icon { - cursor: pointer; +#gServerAddTree span.selected { + background: #ddd; } -.gFile { - padding-left: 2.5em; -} - -#gServerAdd #gServerAddTree { +#gServerAddTree { border: 1px solid #ccc; height: 25em; overflow: auto; @@ -909,10 +905,6 @@ form .gError, padding-left: 1.2em; } -#gServerAdd ul li .gFile { - padding-left: 2.5em; -} - #gServerAdd .gBreadcrumbs { font-size: 1em; padding: 0; -- cgit v1.2.3 From 4132d6c55ed91ca66607680bc44775c4ba650da6 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 11 Jul 2009 15:47:04 -0700 Subject: Put quotes around the href param (href="#") --- modules/gallery/libraries/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 9ede49b6..d37be7d3 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -207,7 +207,7 @@ class Menu_Core extends Menu_Element { public function __toString() { $html = $this->is_root ? "
      " : - "
    • label\">$this->label
        "; + "
      • label\">$this->label
          "; $html .= implode("\n", $this->elements); $html .= $this->is_root ? "
        " : "
    • "; return $html; -- cgit v1.2.3 From 22fcb4c776d8034766c861847ead8e0f18518ed0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 05:14:02 -0700 Subject: Forgot to bump the version up to 3 --- modules/server_add/helpers/server_add_installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/server_add/helpers/server_add_installer.php b/modules/server_add/helpers/server_add_installer.php index 4cc34207..67c7a377 100644 --- a/modules/server_add/helpers/server_add_installer.php +++ b/modules/server_add/helpers/server_add_installer.php @@ -28,7 +28,7 @@ class server_add_installer { `task_id` int(9) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - module::set_version("server_add", 2); + module::set_version("server_add", 3); server_add::check_config(); } -- cgit v1.2.3 From 9f753a53f0371e60f62b8c88d39733d87b4af8f0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 05:30:39 -0700 Subject: MySQL 5 generates backwards compatible code-containing comments so: SET character_set_client = @saved_cs_client; becomes: /*!40101 SET character_set_client = @saved_cs_client */; for MySQL 4.0.1-01 and newer. --- installer/install.sql | 132 +++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/installer/install.sql b/installer/install.sql index 7da5fe68..d719d49d 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -1,6 +1,6 @@ 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, @@ -12,11 +12,11 @@ CREATE TABLE {access_caches} ( `add_2` smallint(6) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB 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, @@ -30,11 +30,11 @@ CREATE TABLE {access_intents} ( `add_2` tinyint(1) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB 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, `key` varchar(255) NOT NULL, @@ -44,10 +44,10 @@ CREATE TABLE {caches} ( PRIMARY KEY (`id`), KEY `tags` (`tags`) ) ENGINE=InnoDB 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, `created` int(9) NOT NULL, @@ -73,10 +73,10 @@ CREATE TABLE {comments} ( `updated` int(9) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB 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', @@ -87,11 +87,11 @@ CREATE TABLE {graphics_rules} ( `target` varchar(32) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB 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','resize',100,'thumb'),(2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','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, @@ -99,22 +99,22 @@ CREATE TABLE {groups} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB 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),(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`), UNIQUE KEY `user_id` (`user_id`,`group_id`) ) ENGINE=InnoDB 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),(1,2),(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, `key` char(32) NOT NULL, @@ -126,10 +126,10 @@ CREATE TABLE {incoming_translations} ( UNIQUE KEY `key` (`key`,`locale`), KEY `locale_key` (`locale`,`key`) ) ENGINE=InnoDB 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, @@ -167,11 +167,11 @@ CREATE TABLE {items} ( KEY `type` (`type`), KEY `random` (`rand_key`) ) ENGINE=InnoDB 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,NULL,0,NULL,'',1,NULL,NULL,2,'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, `item_id` int(9) NOT NULL, @@ -180,10 +180,10 @@ CREATE TABLE {items_tags} ( KEY `tag_id` (`tag_id`,`id`), KEY `item_id` (`item_id`,`id`) ) ENGINE=InnoDB 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, @@ -196,10 +196,10 @@ CREATE TABLE {logs} ( `user_id` int(9) default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB 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, @@ -208,10 +208,10 @@ CREATE TABLE {messages} ( PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) ) ENGINE=InnoDB 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', @@ -220,11 +220,11 @@ CREATE TABLE {modules} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {modules} VALUES (1,1,'gallery',6),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); 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, @@ -236,10 +236,10 @@ CREATE TABLE {outgoing_translations} ( UNIQUE KEY `key` (`key`,`locale`), KEY `locale_key` (`locale`,`key`) ) ENGINE=InnoDB 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, @@ -247,11 +247,11 @@ CREATE TABLE {permissions} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB 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'),(2,'View Full Size','view_full'),(3,'Edit','edit'),(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, @@ -261,21 +261,21 @@ CREATE TABLE {search_records} ( 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`) ) ENGINE=InnoDB 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, `name` varchar(64) NOT NULL, @@ -283,10 +283,10 @@ CREATE TABLE {tags} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB 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, @@ -301,10 +301,10 @@ CREATE TABLE {tasks} ( PRIMARY KEY (`id`), KEY `owner_id` (`owner_id`) ) ENGINE=InnoDB 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, @@ -312,11 +312,11 @@ CREATE TABLE {themes} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB 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,'default',1),(2,'admin_default',1); 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, `name` varchar(32) NOT NULL, @@ -334,11 +334,11 @@ CREATE TABLE {users} ( UNIQUE KEY `name` (`name`), UNIQUE KEY `hash` (`hash`) ) ENGINE=InnoDB 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),(2,'admin','Gallery Administrator','',0,0,NULL,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, `module_name` varchar(64) NOT NULL, @@ -347,5 +347,5 @@ CREATE TABLE {vars} ( PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; -SET character_set_client = @saved_cs_client; +/*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','default'),(2,'gallery','active_admin_theme','admin_default'),(3,'gallery','page_size','9'),(4,'gallery','thumb_size','200'),(5,'gallery','resize_size','640'),(6,'gallery','default_locale','en_US'),(7,'gallery','image_quality','75'),(9,'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\";}}'),(14,'gallery','blocks_dashboard_center','a:4:{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\";}i:9;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(17,'gallery','version','3.0 pre beta 2 (git)'),(18,'gallery','choose_default_tookit','1'),(19,'gallery','date_format','Y-M-d'),(20,'gallery','date_time_format','Y-M-d H:i:s'),(21,'gallery','time_format','H:i:s'),(22,'gallery','show_credits','1'),(23,'gallery','credits','Powered by Gallery %version'),(25,'comment','spam_caught','0'); -- cgit v1.2.3 From 6281ed03d54a010efdee3988a893cfcd7f3663b5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 05:36:31 -0700 Subject: Turn off extended inserts when creating install.sql so that it's easier to see what's changed. --- installer/install.sql | 49 ++++++++++++++++++++++++++------ modules/gallery/controllers/packager.php | 4 +-- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/installer/install.sql b/installer/install.sql index d719d49d..bda576d1 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -88,7 +88,8 @@ CREATE TABLE {graphics_rules} ( PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!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','resize',100,'thumb'),(2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','resize',100,'resize'); +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','resize',100,'thumb'); +INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','resize',100,'resize'); DROP TABLE IF EXISTS {groups}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -100,7 +101,8 @@ CREATE TABLE {groups} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {groups} VALUES (1,'Everybody',1),(2,'Registered Users',1); +INSERT INTO {groups} VALUES (1,'Everybody',1); +INSERT INTO {groups} VALUES (2,'Registered Users',1); DROP TABLE IF EXISTS {groups_users}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -111,7 +113,9 @@ CREATE TABLE {groups_users} ( UNIQUE KEY `user_id` (`user_id`,`group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {groups_users} VALUES (1,1),(1,2),(2,2); +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}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -221,7 +225,15 @@ CREATE TABLE {modules} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',6),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); +INSERT INTO {modules} VALUES (1,1,'gallery',6); +INSERT INTO {modules} VALUES (2,1,'user',1); +INSERT INTO {modules} VALUES (3,1,'comment',2); +INSERT INTO {modules} VALUES (4,1,'organize',1); +INSERT INTO {modules} VALUES (5,1,'info',1); +INSERT INTO {modules} VALUES (6,1,'rss',1); +INSERT INTO {modules} VALUES (7,1,'search',1); +INSERT INTO {modules} VALUES (8,1,'slideshow',1); +INSERT INTO {modules} VALUES (9,1,'tag',1); DROP TABLE IF EXISTS {outgoing_translations}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -248,7 +260,10 @@ CREATE TABLE {permissions} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {permissions} VALUES (1,'View','view'),(2,'View Full Size','view_full'),(3,'Edit','edit'),(4,'Add','add'); +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}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -313,7 +328,8 @@ CREATE TABLE {themes} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {themes} VALUES (1,'default',1),(2,'admin_default',1); +INSERT INTO {themes} VALUES (1,'default',1); +INSERT INTO {themes} VALUES (2,'admin_default',1); DROP TABLE IF EXISTS {users}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -335,7 +351,8 @@ CREATE TABLE {users} ( UNIQUE KEY `hash` (`hash`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL),(2,'admin','Gallery Administrator','',0,0,NULL,1,0,NULL,NULL,NULL); +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); DROP TABLE IF EXISTS {vars}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -348,4 +365,20 @@ CREATE TABLE {vars} ( UNIQUE KEY `module_name` (`module_name`,`name`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','default'),(2,'gallery','active_admin_theme','admin_default'),(3,'gallery','page_size','9'),(4,'gallery','thumb_size','200'),(5,'gallery','resize_size','640'),(6,'gallery','default_locale','en_US'),(7,'gallery','image_quality','75'),(9,'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\";}}'),(14,'gallery','blocks_dashboard_center','a:4:{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\";}i:9;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(17,'gallery','version','3.0 pre beta 2 (git)'),(18,'gallery','choose_default_tookit','1'),(19,'gallery','date_format','Y-M-d'),(20,'gallery','date_time_format','Y-M-d H:i:s'),(21,'gallery','time_format','H:i:s'),(22,'gallery','show_credits','1'),(23,'gallery','credits','Powered by Gallery %version'),(25,'comment','spam_caught','0'); +INSERT INTO {vars} VALUES (1,'gallery','active_site_theme','default'); +INSERT INTO {vars} VALUES (2,'gallery','active_admin_theme','admin_default'); +INSERT INTO {vars} VALUES (3,'gallery','page_size','9'); +INSERT INTO {vars} VALUES (4,'gallery','thumb_size','200'); +INSERT INTO {vars} VALUES (5,'gallery','resize_size','640'); +INSERT INTO {vars} VALUES (6,'gallery','default_locale','en_US'); +INSERT INTO {vars} VALUES (7,'gallery','image_quality','75'); +INSERT INTO {vars} VALUES (9,'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 (14,'gallery','blocks_dashboard_center','a:4:{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\";}i:9;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'); +INSERT INTO {vars} VALUES (17,'gallery','version','3.0 pre beta 2 (git)'); +INSERT INTO {vars} VALUES (18,'gallery','choose_default_tookit','1'); +INSERT INTO {vars} VALUES (19,'gallery','date_format','Y-M-d'); +INSERT INTO {vars} VALUES (20,'gallery','date_time_format','Y-M-d H:i:s'); +INSERT INTO {vars} VALUES (21,'gallery','time_format','H:i:s'); +INSERT INTO {vars} VALUES (22,'gallery','show_credits','1'); +INSERT INTO {vars} VALUES (23,'gallery','credits','Powered by Gallery %version'); +INSERT INTO {vars} VALUES (25,'comment','spam_caught','0'); diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index da0a7983..7b4d68f6 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -98,7 +98,7 @@ class Packager_Controller extends Controller { print "$sql_file is not writeable"; return; } - $command = "mysqldump --compact --add-drop-table -h{$conn['host']} " . + $command = "mysqldump --compact --skip-extended-insert --add-drop-table -h{$conn['host']} " . "-u{$conn['user']} $pass {$conn['database']} > $sql_file"; exec($command, $output, $status); if ($status) { @@ -153,7 +153,7 @@ class Packager_Controller extends Controller { $paths[] = "VARPATH . \"" . substr($name, strlen(VARPATH)) . "\""; } else { // @todo: serialize non-directories - print "Unknown file: $name"; + print "IGNORING FILE: $name\n"; return; } } -- cgit v1.2.3 From ecc7d881e3bad1dd8edf5cbd4382bda9a668fcb8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 05:52:50 -0700 Subject: Fix bug introduced in e0e450d90fe67ac199d82d2b8e902cff5c8b6c7d where it got rid of the 'img' var which is used when we set the click action on buttons. Partial fix for #528. --- modules/gallery/js/quick.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js index 32e34ef3..28ced3f6 100644 --- a/modules/gallery/js/quick.js +++ b/modules/gallery/js/quick.js @@ -11,6 +11,7 @@ $(document).ready(function() { var show_quick = function() { var cont = $(this); var quick = $(this).find(".gQuick"); + var img = cont.find(".gThumbnail,.gResize"); $("#gQuickPane").remove(); cont.append("
      "); $("#gQuickPane").hide(); -- cgit v1.2.3 From 6b013060aabc1d13545958fdb3c096faac2ba5a7 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 06:15:44 -0700 Subject: Fix style: space after ) before {. --- modules/gallery/js/quick.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js index 28ced3f6..2dcb1c36 100644 --- a/modules/gallery/js/quick.js +++ b/modules/gallery/js/quick.js @@ -22,10 +22,10 @@ var show_quick = function() { function(data, textStatus) { $("#gQuickPane").html(data).slideDown("fast"); $(".ui-state-default").hover( - function(){ + function() { $(this).addClass("ui-state-hover"); }, - function(){ + function() { $(this).removeClass("ui-state-hover"); } ); -- cgit v1.2.3 From 4d0099e7165a4a1508eea58613cdc75e116464ff Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 06:24:10 -0700 Subject: Fix a bug where we're referring to $photo when we just uploaded a $movie, that causes the simpler uploader to throw an error for all movies. --- modules/gallery/controllers/simple_uploader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index a059f986..75a7b810 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -58,13 +58,13 @@ class Simple_Uploader_Controller extends Controller { $path_info = @pathinfo($temp_filename); if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) { - $movie = movie::create($album, $temp_filename, $name, $title); + $item = movie::create($album, $temp_filename, $name, $title); log::success("content", t("Added a movie"), - html::anchor("movies/$movie->id", t("view movie"))); + html::anchor("movies/$item->id", t("view movie"))); } else { - $photo = photo::create($album, $temp_filename, $name, $title); + $item = photo::create($album, $temp_filename, $name, $title); log::success("content", t("Added a photo"), - html::anchor("photos/$photo->id", t("view photo"))); + html::anchor("photos/$item->id", t("view photo"))); } } catch (Exception $e) { Kohana::log("alert", $e->__toString()); @@ -76,7 +76,7 @@ class Simple_Uploader_Controller extends Controller { return; } unlink($temp_filename); - print "FILEID: $photo->id"; + print "FILEID: $item->id"; } else { header("HTTP/1.1 400 Bad Request"); print "ERROR: Invalid Upload"; -- cgit v1.2.3 From 214d977f4dc9ac78f4571a7cc89109fd95f5a2eb Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 06:51:21 -0700 Subject: Don't close the dialog window after we successfully complete an action. The expectation is that we're going to reload the page (or redirect to a new url). If we close the dialog, then we can trigger the onhover for items we've just deleted causing errors. Simplify the API while we're at it by getting rid of the no-longer-used on_success argument to openDialog() This fixes #528. --- lib/gallery.dialog.js | 13 +++++-------- modules/gallery/js/quick.js | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index fc66323e..74c2f20e 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -11,23 +11,20 @@ function handleDialogEvent(event) { event.preventDefault(); } -function ajaxify_dialog(on_success) { +function ajaxify_dialog() { $("#gDialog form").ajaxForm({ dataType: "json", success: function(data) { if (data.form) { $("#gDialog form").replaceWith(data.form); - ajaxify_dialog(on_success); + ajaxify_dialog(); on_form_loaded(); if (typeof data.reset == 'function') { eval(data.reset + '()'); } } if (data.result == "success") { - $("#gDialog").dialog("close"); - if (on_success) { - on_success(); - } else if (data.location) { + if (data.location) { window.location = data.location; } else { window.location.reload(); @@ -46,7 +43,7 @@ function ajaxify_dialog(on_success) { * @see handleDialogEvent() * @see showLoading() */ -function openDialog(element, on_success) { +function openDialog(element) { var sHref = $(element).attr("href"); var sTitle = $(element).attr("title"); var eDialog = '
      '; @@ -92,7 +89,7 @@ function openDialog(element, on_success) { $("#gDialog").dialog('option', 'title', $("#gDialog fieldset legend:eq(0)").html()); } - ajaxify_dialog(on_success); + ajaxify_dialog(); }); return false; } diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js index 2dcb1c36..3ac97f8e 100644 --- a/modules/gallery/js/quick.js +++ b/modules/gallery/js/quick.js @@ -46,7 +46,7 @@ var quick_do = function(cont, pane, img) { return false; } if (pane.hasClass("gDialogLink")) { - openDialog(pane, function() { window.location.reload(); }); + openDialog(pane); } else { img.css("opacity", "0.1"); cont.addClass("gLoadingLarge"); -- cgit v1.2.3