/** * 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); }
/** * 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; } }