Changeset 35824
- Timestamp:
- 03/22/08 08:45:34 (4 months ago)
- Files:
-
- worst-offenders/trunk/classes/litmus.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worst-offenders/trunk/classes/litmus.php
r35682 r35824 21 21 public static function runCachedMatchesQuery($name, $q) { 22 22 global $wpdb, $wo3_title; 23 24 echo("\n<!-- Query is: $q -->\n");25 26 23 $result = wp_cache_get($name, $wo3_title); 27 24 if($result == false) { 28 25 $result= $wpdb->get_results($q); 29 echo("<!-- cache miss $name -->\n");30 echo("<!-- query gave ".sizeof($result)." results -->\n");31 26 wp_cache_add($name, $result, $wo3_title); 32 } else { 33 echo("<!-- cache hit $name -->\n"); 34 } 35 27 } 36 28 self::updateCount($name, $result); 37 38 29 return $result; 39 30 } … … 42 33 private static function updateCount($name, $results) { 43 34 global $wo3_title; 44 echo("<!-- updating count from ".sizeof($results)." results -->\n");45 35 $ids = array(); 46 36 foreach($results as $result) { 47 37 if (isset($result->comment_id_list)) { 48 38 $ids = array_merge($ids, explode(",",$result->comment_id_list)); 49 echo("<!-- its a list of ".sizeof($ids)." -->\n");50 39 } 51 40 if (isset($result->comment_id)) { 52 echo("<!-- its an id -->\n");53 41 $ids[] = $result->comment_id; 54 42 } … … 56 44 $ids = array_unique($ids); 57 45 wp_cache_set($name."_count", sizeof($ids), $wo3_title); 58 echo("<!-- ".sizeof($results)." results gave ".sizeof($ids)." distinct ids -->\n");59 46 60 47 $current_ids = wp_cache_get("current_ids", $wo3_title); … … 64 51 wp_cache_set("current_ids", $current_ids, $wo3_title); 65 52 wp_cache_set("current_count", sizeof($current_ids), $wo3_title); 66 echo("<!-- current_count is now ".sizeof($current_ids)." -->\n");67 53 68 54 }
