Changeset 965
- Timestamp:
- 11/23/08 16:19:59 (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
common/cache.php (modified) (7 diffs)
-
common/db/job.php (modified) (1 diff)
-
scripts/ia_job_reindex (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/cache.php
r852 r965 7 7 // 8 8 // Only returns true/false. 9 10 // Used internally to determine file path from cache_id 11 function _disk_cache_path($cache_id) { 12 return IA_ROOT_DIR . "cache/" . $cache_id; 13 } 14 15 // Recursively delete directories 16 function _recursive_delete($path) { 17 foreach (glob($path . "/*") as $file_name) { 18 if (is_dir($file_name)) { 19 _recursive_delete($file_name); 20 } else if (is_file($file_name)) { 21 unlink($file_name); 22 } 23 } 24 rmdir($path); 25 } 26 9 27 function disk_cache_has($cache_id, $date = null) { 10 $file_name = IA_ROOT_DIR . 'cache/' . $cache_id;28 $file_name = _disk_cache_path($cache_id); 11 29 12 30 if (!@is_readable($file_name)) { … … 32 50 // Get an object from the cache, or FALSE if nothing is found. 33 51 function disk_cache_get($cache_id) { 34 $file_name = IA_ROOT_DIR . 'cache/' . $cache_id;52 $file_name = _disk_cache_path($cache_id); 35 53 36 54 if (@is_readable($file_name)) { … … 51 69 function disk_cache_serve($cache_id, $http_file_name, $mime_type = null) { 52 70 require_once(IA_ROOT_DIR . 'www/utilities.php'); 53 $file_name = IA_ROOT_DIR . 'cache/' . $cache_id;71 $file_name = _disk_cache_path($cache_id); 54 72 55 73 if (IA_LOG_DISK_CACHE) { … … 63 81 // Always returns $buffer. 64 82 function disk_cache_set($cache_id, $buffer, $ttl = 0) { 65 $file_name = IA_ROOT_DIR . 'cache/' . $cache_id; 66 83 $file_name = _disk_cache_path($cache_id); 84 85 @mkdir(dirname($file_name), 0777, true); 67 86 $ret = @file_put_contents($file_name, $buffer, LOCK_EX); 68 87 … … 80 99 // Delete something from the disk cache. 81 100 function disk_cache_delete($cache_id) { 82 $file_name = IA_ROOT_DIR . 'cache/' . $cache_id;101 $file_name = _disk_cache_path($cache_id); 83 102 @unlink($file_name); 84 103 } … … 86 105 // Delete the entire disk cache 87 106 function disk_cache_purge() { 88 foreach (glob(IA_ROOT_DIR . 'cache/[^.]*') as $file_name) { 89 @unlink($file_name); 107 foreach (glob(IA_ROOT_DIR . "cache/*", GLOB_ONLYDIR) as $dir_name) { 108 _recursive_delete($dir_name); 109 } 110 111 foreach (glob(IA_ROOT_DIR . "cache/*") as $file_name) { 112 unlink($file_name); 90 113 } 91 114 } … … 167 190 168 191 // Purge the entire SHM cache. 169 // FIXME: does this actually work?192 // FIXME: This does not work 170 193 function mem_cache_purge() { 171 194 if (IA_LOG_MEM_CACHE) { -
trunk/common/db/job.php
r963 r965 257 257 if (!isset($wheres[1])) { 258 258 // if we have no filters outside of `ia_job` table then optimize query 259 $subquery = sprintf("259 $subquery = " 260 260 SELECT `job`.`id` AS `ID` 261 261 FROM `ia_job` as `job` 262 262 WHERE (" . implode(") AND (", $wheres_job) . ") 263 ORDER BY `id` DESC LIMIT %s, %s", 264 $start, $range); 263 ORDER BY `id` DESC LIMIT {$start}, {$range}"; 265 264 266 265 $job_ids_fetched = db_fetch_all($subquery); -
trunk/scripts/ia_job_reindex
r963 r965 4 4 5 5 db_connect(); 6 $query = "ALTER TABLE ` webdb`.`ia_job`6 $query = "ALTER TABLE `ia_job` 7 7 DROP INDEX `by_round`, 8 8 ADD INDEX by_round USING BTREE(`round_id`, `id`),
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)