diff --git a/includes/cache.inc b/includes/cache.inc index 2f656541d88c15249eeab4ef31d4a1b1c38503c3..e7774a10bc4c99be71cd7465dd3fee9c13c0a7d3 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -17,11 +17,11 @@ function cache_get($key, $table = 'cache') { $cache_flush = variable_get('cache_flush', 0); if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= time())) { // Time to flush old cache data - db_query("DELETE FROM {%s} WHERE expire != %d AND expire <= %d", $table, CACHE_PERMANENT, $cache_flush); + db_query("DELETE FROM {$table} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush); variable_set('cache_flush', 0); } - $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {%s} WHERE cid = '%s'", $table, $key)); + $cache = db_fetch_object(db_query("SELECT data, created, headers, expire FROM {$table} WHERE cid = '%s'", $key)); if (isset($cache->data)) { // If the data is permanent or we're not enforcing a minimum cache lifetime // always return the cached data. @@ -92,9 +92,9 @@ function cache_get($key, $table = 'cache') { */ function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) { db_lock_table($table); - db_query("UPDATE {%s} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $table, $data, time(), $expire, $headers, $cid); + db_query("UPDATE {$table} SET data = %b, created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid); if (!db_affected_rows()) { - @db_query("INSERT INTO {%s} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $table, $cid, $data, time(), $expire, $headers); + @db_query("INSERT INTO {$table} (cid, data, created, expire, headers) VALUES ('%s', %b, %d, %d, '%s')", $cid, $data, time(), $expire, $headers); } db_unlock_tables(); } @@ -141,26 +141,26 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) { else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. - db_query("DELETE FROM {%s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time()); + db_query("DELETE FROM {$table} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); variable_set('cache_flush', 0); } } else { // No minimum cache lifetime, flush all temporary cache entries now. - db_query("DELETE FROM {%s} WHERE expire != %d AND expire < %d", $table, CACHE_PERMANENT, time()); + db_query("DELETE FROM {$table} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); } } else { if ($wildcard) { if ($cid == '*') { - db_query("DELETE FROM {%s}", $table); + db_query("DELETE FROM {$table}"); } else { - db_query("DELETE FROM {%s} WHERE cid LIKE '%s%%'", $table, $cid); + db_query("DELETE FROM {$table} WHERE cid LIKE '%s%%'", $cid); } } else { - db_query("DELETE FROM {%s} WHERE cid = '%s'", $table, $cid); + db_query("DELETE FROM {$table} WHERE cid = '%s'", $cid); } } }