// delete folder if empty @rmdir($_file->getPathname()); } } else { $_parts = explode($_dir_sep, str_replace('\\', '/', substr((string)$_file, $_dir_length))); $_parts_count = count($_parts); // check name if (isset($resource_name)) { if ($_parts[$_parts_count-1] != $_resourcename_parts) { continue; } } // check compile id if (isset($_compile_id) && (!isset($_parts[$_parts_count-2 - $_compile_id_offset]) || $_parts[$_parts_count-2 - $_compile_id_offset] != $_compile_id)) { continue; } // check cache id if (isset($_cache_id)) { // count of cache id parts $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset : $_parts_count - 1 - $_compile_id_offset; if ($_parts_count < $_cache_id_parts_count) { continue; } for ($i = 0; $i < $_cache_id_parts_count; $i++) { if ($_parts[$i] != $_cache_id_parts[$i]) continue 2; } } // expired ? if (isset($exp_time) && $_time - @filemtime($_file) < $exp_time) { continue; } $_count += @unlink((string) $_file) ? 1 : 0; } } } return $_count; } /** * Check is cache is locked for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object * @return booelan true or false if cache is locked */ public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) { clearstatcache(true, $cached->lock_id); } else { clearstatcache(); } $t = @filemtime($cached->lock_id); return $t && (time() - $t < $smarty->locking_timeout); } /** * Lock cache for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object */ public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = true; touch($cached->lock_id); } /** * Unlock cache for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object */ public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = false; @unlink($cached->lock_id); } } ?>