Caching fixes and cleanups.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7c11f087d
commit
43fca5536b
|
@ -134,6 +134,7 @@ function wp_insert_category($catarr) {
|
|||
}
|
||||
|
||||
wp_cache_delete($cat_ID, 'category');
|
||||
wp_cache_delete('get_categories', 'category');
|
||||
|
||||
if ($update) {
|
||||
do_action('edit_category', $cat_ID);
|
||||
|
@ -214,6 +215,7 @@ function wp_delete_category($cat_ID) {
|
|||
|
||||
wp_cache_delete($cat_ID, 'category');
|
||||
wp_cache_delete('all_category_ids', 'category');
|
||||
wp_cache_delete('get_categories', 'category');
|
||||
|
||||
do_action('delete_category', $cat_ID);
|
||||
|
||||
|
@ -408,6 +410,7 @@ function wp_delete_link($link_id) {
|
|||
foreach ( $categories as $category ) {
|
||||
$wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'");
|
||||
wp_cache_delete($category, 'category');
|
||||
do_action('edit_category', $cat_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,14 +130,6 @@ function &get_categories($args = '') {
|
|||
return apply_filters('get_categories', $categories, $r);
|
||||
}
|
||||
|
||||
function delete_get_categories_cache() {
|
||||
wp_cache_delete('get_categories', 'category');
|
||||
}
|
||||
add_action( 'wp_insert_post', 'delete_get_categories_cache' );
|
||||
add_action( 'edit_category', 'delete_get_categories_cache' );
|
||||
add_action( 'add_category', 'delete_get_categories_cache' );
|
||||
add_action( 'delete_category', 'delete_get_categories_cache' );
|
||||
|
||||
// Retrieves category data given a category ID or category object.
|
||||
// Handles category caching.
|
||||
function &get_category(&$category, $output = OBJECT) {
|
||||
|
|
|
@ -402,6 +402,7 @@ function wp_delete_post($postid = 0) {
|
|||
foreach ( $categories as $cat_id ) {
|
||||
$wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'");
|
||||
wp_cache_delete($cat_id, 'category');
|
||||
do_action('edit_category', $cat_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,8 +418,9 @@ function wp_delete_post($postid = 0) {
|
|||
|
||||
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");
|
||||
|
||||
if ( 'page' == $post->type ) {
|
||||
wp_cache_delete('all_page_ids', 'pages');
|
||||
if ( 'page' == $post->post_type ) {
|
||||
wp_cache_delete( 'all_page_ids', 'pages' );
|
||||
wp_cache_delete( 'get_pages', 'page' );
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
|
@ -677,7 +679,8 @@ function wp_insert_post($postarr = array()) {
|
|||
wp_schedule_single_event(time(), 'do_pings');
|
||||
}
|
||||
} else if ($post_type == 'page') {
|
||||
wp_cache_delete('all_page_ids', 'pages');
|
||||
wp_cache_delete( 'all_page_ids', 'pages' );
|
||||
wp_cache_delete( 'get_pages', 'page' );
|
||||
$wp_rewrite->flush_rules();
|
||||
|
||||
if ( !empty($page_template) )
|
||||
|
@ -807,6 +810,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
|||
do_action('edit_category', $cat_id);
|
||||
}
|
||||
|
||||
wp_cache_delete('get_categories', 'category');
|
||||
|
||||
do_action('edit_post', $post_ID);
|
||||
} // wp_set_post_categories()
|
||||
|
||||
|
@ -1139,11 +1144,6 @@ function &get_pages($args = '') {
|
|||
return $pages;
|
||||
}
|
||||
|
||||
function delete_get_pages_cache() {
|
||||
wp_cache_delete( 'get_pages', 'page' );
|
||||
}
|
||||
add_action( 'save_post', 'delete_get_pages_cache' );
|
||||
|
||||
function generate_page_uri_index() {
|
||||
global $wpdb;
|
||||
|
||||
|
|
Loading…
Reference in New Issue