本文整理汇总了PHP中model_cache::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP model_cache::clear方法的具体用法?PHP model_cache::clear怎么用?PHP model_cache::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model_cache
的用法示例。
在下文中一共展示了model_cache::clear方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
model_cache::clear();
$result = parent::save();
$this->original = $this->object;
return $result;
}
示例2: remove_album_cover
static function remove_album_cover($album)
{
access::required("edit", $album);
@unlink($album->thumb_path());
model_cache::clear("item", $album->album_cover_item_id);
$album->album_cover_item_id = null;
$album->thumb_width = 0;
$album->thumb_height = 0;
$album->thumb_dirty = 1;
$album->save();
graphics::generate($album);
}
示例3: save
public function save($source_id)
{
access::verify_csrf();
$source = ORM::factory("item", $source_id);
$target = ORM::factory("item", Input::instance()->post("target_id"));
access::required("view", $source);
access::required("view", $target);
access::required("edit", $target);
model_cache::clear();
$target->album_cover_item_id = $source->is_album() ? $source->album_cover_item_id : $source->id;
$target->thumb_dirty = 1;
$target->save();
graphics::generate($target);
$grand_parent = $target->parent();
if ($grand_parent && access::can("edit", $grand_parent) && $grand_parent->album_cover_item_id == null) {
item::make_album_cover($target);
}
$msg = t("Made <b>%title</b> album's cover for <b>%album</b>", array("title" => html::purify($source->title), "album" => html::purify($target->title)));
message::success($msg);
json::reply(array("result" => "success"));
}
示例4: move_to
/**
* Move this item to the specified target.
* @chainable
* @param Item_Model $target Target item (must be an album)
* @return ORM_MPTT
*/
function move_to($target)
{
if (!$target->is_album()) {
throw new Exception("@todo INVALID_MOVE_TYPE {$target->type}");
}
if ($this->id == 1) {
throw new Exception("@todo INVALID_SOURCE root album");
}
$original_path = $this->file_path();
$original_resize_path = $this->resize_path();
$original_thumb_path = $this->thumb_path();
$original_parent = $this->parent();
parent::move_to($target, true);
model_cache::clear();
$this->relative_path_cache = null;
rename($original_path, $this->file_path());
if ($this->is_album()) {
@rename(dirname($original_resize_path), dirname($this->resize_path()));
@rename(dirname($original_thumb_path), dirname($this->thumb_path()));
Database::instance()->update("items", array("relative_path_cache" => null), array("left_ptr >" => $this->left_ptr, "right_ptr <" => $this->right_ptr));
} else {
@rename($original_resize_path, $this->resize_path());
@rename($original_thumb_path, $this->thumb_path());
}
module::event("item_moved", $this, $original_parent);
return $this;
}
示例5: _add_columns
/**
* Internal method to add Permission/Group columns
*
* @param Group_Model $group
* @param string $perm_name
* @return void
*/
private static function _add_columns($perm_name, $group)
{
$db = Database::instance();
$field = "{$perm_name}_{$group->id}";
$cache_table = $perm_name == "view" ? "items" : "access_caches";
$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();
}
示例6: _add_columns
/**
* Internal method to add Permission/Group columns
*
* @param Group_Model $group
* @param string $perm_name
* @return void
*/
private static function _add_columns($perm_name, $group)
{
$db = Database::instance();
$field = "{$perm_name}_{$group->id}";
$cache_table = $perm_name == "view" ? "items" : "access_caches";
$not_null = $cache_table == "items" ? "" : "NOT NULL";
$db->query("ALTER TABLE {{$cache_table}} ADD `{$field}` BINARY {$not_null} DEFAULT FALSE");
$db->query("ALTER TABLE {access_intents} ADD `{$field}` BINARY DEFAULT NULL");
$db->update("access_intents", array($field => self::DENY), array("item_id" => 1));
model_cache::clear();
ORM::factory("access_intent")->clear_cache();
}
示例7: remove_album_cover
static function remove_album_cover($album)
{
access::required("view", $album);
access::required("edit", $album);
model_cache::clear();
$album->album_cover_item_id = null;
$album->save();
graphics::generate($album);
}
示例8: _add_columns
/**
* Internal method to add Permission/Group columns
*
* @param Group_Model $group
* @param string $perm_name
* @return void
*/
private static function _add_columns($perm_name, $group)
{
$field = "{$perm_name}_{$group->id}";
$cache_table = $perm_name == "view" ? "items" : "access_caches";
$not_null = $cache_table == "items" ? "" : "NOT NULL";
Database::instance()->query("ALTER TABLE {{$cache_table}} ADD `{$field}` BINARY {$not_null} DEFAULT FALSE");
Database::instance()->query("ALTER TABLE {access_intents} ADD `{$field}` BINARY DEFAULT NULL");
db::build()->update("access_intents")->set($field, access::DENY)->where("item_id", "=", 1)->execute();
model_cache::clear();
ORM::factory("access_intent")->clear_cache();
}
示例9: save
public function save()
{
model_cache::clear();
return parent::save();
}
示例10: save
public function save()
{
model_cache::clear($this->object_name, $this->{$this->primary_key}, $this->primary_key);
return parent::save();
}
示例11: move_to
/**
* Move this item to the specified target.
* @chainable
* @param Item_Model $target Target item (must be an album)
* @return ORM_MPTT
*/
function move_to($target)
{
if (!$target->is_album()) {
throw new Exception("@todo INVALID_MOVE_TYPE {$target->type}");
}
if (file_exists($target_file = "{$target->file_path()}/{$this->name}")) {
throw new Exception("@todo INVALID_MOVE_TARGET_EXISTS: {$target_file}");
}
if ($this->id == 1) {
throw new Exception("@todo INVALID_SOURCE root album");
}
$original_path = $this->file_path();
$original_resize_path = $this->resize_path();
$original_thumb_path = $this->thumb_path();
$original_parent = $this->parent();
parent::move_to($target, true);
model_cache::clear();
$this->relative_path_cache = null;
rename($original_path, $this->file_path());
if ($this->is_album()) {
@rename(dirname($original_resize_path), dirname($this->resize_path()));
@rename(dirname($original_thumb_path), dirname($this->thumb_path()));
db::build()->update("items")->set("relative_path_cache", null)->set("relative_url_cache", null)->where("left_ptr", ">", $this->left_ptr)->where("right_ptr", "<", $this->right_ptr)->execute();
} else {
@rename($original_resize_path, $this->resize_path());
@rename($original_thumb_path, $this->thumb_path());
}
module::event("item_moved", $this, $original_parent);
return $this;
}