Browse files

More category cache cleanups.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent d8ba4fd commit 74328576c69ae93e24c1fc568902cb184e717ef9 ryan committed Mar 31, 2005
Showing with 7 additions and 4 deletions.
  1. +1 −4 wp-admin/admin.php
  2. +6 −0 wp-includes/functions.php
View
5 wp-admin/admin.php
@@ -8,10 +8,7 @@
header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
-$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
-foreach ($dogs as $catt) {
- $cache_categories[$catt->cat_ID] = $catt;
-}
+update_category_cache();
get_currentuserinfo();
View
6 wp-includes/functions.php
@@ -615,6 +615,9 @@ function &get_page(&$page, $output = OBJECT) {
function &get_category(&$category, $output = OBJECT) {
global $cache_categories, $wpdb;
+ if ( ! isset($cache_categories))
+ update_category_cache();
+
if (is_object($category)) {
if ( ! isset($cache_categories[$category->cat_ID]))
$cache_categories[$category->cat_ID] = &$category;
@@ -1170,6 +1173,9 @@ function update_post_category_cache($post_ids) {
post_id, category_id FROM $wpdb->categories, $wpdb->post2cat
WHERE category_id = cat_ID AND post_id IN ($post_ids)");
+ if (! isset($cache_categories))
+ update_category_cache();
+
if ( !empty($dogs) ) {
foreach ($dogs as $catt) {
$category_cache[$catt->post_id][$catt->category_id] = &$cache_categories[$catt->category_id];

0 comments on commit 7432857

Please sign in to comment.