summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-17 13:28:24 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-17 13:28:24 -0800
commitcfb27dde023e4f4d04fc9de687548501e607d371 (patch)
treefcb16ad4939d314233d1ebe20599da3fd7334ce3 /modules/gallery/helpers
parent9488684220cbf4121dea12a28083f6c34b648da8 (diff)
Adjust installers to work with model based validation.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery_installer.php33
1 files changed, 20 insertions, 13 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 1e0ad28c..aa297236 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -209,19 +209,26 @@ class gallery_installer {
t("Edit");
t("Add");
- $root = ORM::factory("item");
- $root->type = "album";
- $root->title = "Gallery";
- $root->description = "";
- $root->left_ptr = 1;
- $root->right_ptr = 2;
- $root->parent_id = 0;
- $root->level = 1;
- $root->thumb_dirty = 1;
- $root->resize_dirty = 1;
- $root->sort_column = "weight";
- $root->sort_order = "ASC";
- $root->save();
+ // Hardcode the first item to sidestep ORM validation rules
+ $now = time();
+ db::build()->insert(
+ "items",
+ array("created" => $now,
+ "description" => "",
+ "left_ptr" => 1,
+ "level" => 1,
+ "parent_id" => 0,
+ "resize_dirty" => 1,
+ "right_ptr" => 2,
+ "sort_column" => "weight",
+ "sort_order" => "ASC",
+ "thumb_dirty" => 1,
+ "title" => "Gallery",
+ "type" => "album",
+ "updated" => $now,
+ "weight" => 1))
+ ->execute();
+ $root = ORM::factory("item")->where("id", "=", 1)->find();
access::add_item($root);
module::set_var("gallery", "active_site_theme", "wind");