/** * should be called in beforeRender() * */ public static function init(View $View) { $params = $View->request->params; if (Configure::read('UrlCache.pageFiles')) { $cachePageKey = '_misc'; if (is_object($View)) { $path = $View->request->here; if ($path == '/') { $path = 'uc_homepage'; } else { $path = strtolower(Inflector::slug($path)); } if (empty($path)) { $path = 'uc_error'; } $cachePageKey = '_' . $path; } self::$cachePageKey = self::$cacheKey . $cachePageKey; self::$cachePage = Cache::read(self::$cachePageKey, '_cake_core_'); } self::$cache = Cache::read(self::$cacheKey, '_cake_core_'); # still old "prefix true/false" syntax? if (Configure::read('UrlCache.verbosePrefixes')) { unset(self::$paramFields[3]); self::$paramFields = array_merge(self::$paramFields, (array) Configure::read('Routing.prefixes')); } self::$extras = array_intersect_key($params, array_combine(self::$paramFields, self::$paramFields)); $defaults = array(); foreach (self::$paramFields as $field) { $defaults[$field] = ''; } self::$extras = array_merge($defaults, self::$extras); }
public function tearDown() { Cache::delete(UrlCacheManager::$cacheKey, '_cake_core_'); Cache::delete(UrlCacheManager::$cachePageKey, '_cake_core_'); UrlCacheManager::$cache = []; UrlCacheManager::$cachePage = []; Configure::delete('UrlCache'); parent::tearDown(); }