Merge branch 'master' of git@github.com:/gallery/gallery3

This commit is contained in:
Bharat Mediratta
2009-07-17 16:58:15 -07:00
6 changed files with 11 additions and 7 deletions

View File

@@ -205,6 +205,7 @@ class access_Core {
}
self::_update_htaccess_files($album, $group, $perm_name, $value);
model_cache::clear();
}
/**
@@ -256,6 +257,7 @@ class access_Core {
}
}
}
model_cache::clear();
}
/**
@@ -426,6 +428,7 @@ class access_Core {
$cache_table = $perm_name == "view" ? "items" : "access_caches";
$db->query("ALTER TABLE {{$cache_table}} DROP `$field`");
$db->query("ALTER TABLE {access_intents} DROP `$field`");
model_cache::clear();
ORM::factory("access_intent")->clear_cache();
}
@@ -443,6 +446,7 @@ class access_Core {
$db->query("ALTER TABLE {{$cache_table}} ADD `$field` SMALLINT NOT NULL DEFAULT 0");
$db->query("ALTER TABLE {access_intents} ADD `$field` BOOLEAN DEFAULT NULL");
$db->update("access_intents", array($field => 0), array("item_id" => 1));
model_cache::clear();
ORM::factory("access_intent")->clear_cache();
}

View File

@@ -53,7 +53,7 @@ class item_Core {
access::required("view", $parent);
access::required("edit", $parent);
model_cache::clear("item", $parent->album_cover_item_id);
model_cache::clear();
$parent->album_cover_item_id = $item->is_album() ? $item->album_cover_item_id : $item->id;
$parent->thumb_dirty = 1;
$parent->save();
@@ -69,7 +69,7 @@ class item_Core {
access::required("edit", $album);
@unlink($album->thumb_path());
model_cache::clear("item", $album->album_cover_item_id) ;
model_cache::clear();
$album->album_cover_item_id = null;
$album->thumb_width = 0;
$album->thumb_height = 0;

View File

@@ -32,10 +32,8 @@ class model_cache_Core {
return self::$cache->$model_name->$field_name->$id;
}
static function clear($model_name, $id, $field_name="id") {
if (!empty(self::$cache->$model_name->$field_name->$id)) {
unset(self::$cache->$model_name->$field_name->$id);
}
static function clear() {
self::$cache = new stdClass();
}
static function set($model) {

View File

@@ -32,7 +32,7 @@ class ORM extends ORM_Core {
}
public function save() {
model_cache::clear($this->object_name, $this->{$this->primary_key}, $this->primary_key);
model_cache::clear();
$result = parent::save();
$this->original = $this->object;
return $result;

View File

@@ -285,6 +285,7 @@ class ORM_MPTT_Core extends ORM {
// Lets reload to get the changes.
$this->reload();
$target->reload();
return $this;
}

View File

@@ -140,6 +140,7 @@ class Item_Model extends ORM_MPTT {
$original_parent = $this->parent();
parent::move_to($target, true);
model_cache::clear();
$this->relative_path_cache = null;
rename($original_path, $this->file_path());