本文整理匯總了PHP中Util_Environment::is_flushable_post方法的典型用法代碼示例。如果您正苦於以下問題:PHP Util_Environment::is_flushable_post方法的具體用法?PHP Util_Environment::is_flushable_post怎麽用?PHP Util_Environment::is_flushable_post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::is_flushable_post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: on_post_change
/**
* Post changed action
*
* @param integer $post_id
* @param null $post
* @return void
*/
function on_post_change($post_id, $post = null)
{
if (is_null($post)) {
$post = get_post($post_id);
}
// if attachment changed - parent post has to be flushed
// since there are usually attachments content like title
// on the page (gallery)
if ($post->post_type == 'attachment') {
$post_id = $post->post_parent;
$post = get_post($post_id);
}
if (!Util_Environment::is_flushable_post($post, 'posts', Dispatcher::config())) {
return;
}
$cacheflush = Dispatcher::component('CacheFlush');
$cacheflush->flush_post($post_id);
}
示例2: on_post_change
/**
* Change post action
*/
function on_post_change($post_id = 0, $post = null)
{
static $flushed = false;
if (!$flushed) {
if (is_null($post)) {
$post = $post_id;
}
if ($post_id > 0 && !Util_Environment::is_flushable_post($post, 'dbcache', $this->_config)) {
return;
}
$flusher = Dispatcher::component('CacheFlush');
$flusher->dbcache_flush();
$flushed = true;
}
}