public function onRowUpdatesFinished(Kwf_Events_Event_Row_UpdatesFinished $event) { if ($this->_constraints) { Kwf_Component_Cache_Url_Abstract::getInstance()->delete($this->_constraints); $this->_constraints = array(); } }
protected function _clearCache($options) { if (!Kwf_Setup::hasDb()) { $this->_output("skipped: (no db configured)\n"); return; } Kwf_Component_Cache_Url_Abstract::getInstance()->clear(); }
public static function clearInstance() { self::$_instance = null; }
private static function _clearComponentSettingsCache($componentClasses, $setting = null) { Kwf_Component_Abstract::resetSettingsCache(); $settings = Kwf_Component_Settings::_getSettingsCached(); $dependenciesChanged = false; $generatorssChanged = false; $menuConfigChanged = false; foreach ($componentClasses as $c) { Kwf_Component_Settings::$_rebuildingSettings = true; if ($setting) { //a single setting changed $newSettings = $settings[$c]; $newSettings[$setting] = Kwc_Abstract::getSetting($c, $setting); } else { //all settings might have changed $newSettings = Kwf_Component_Settings::_getSettingsIncludingPreComputed($c); } Kwf_Component_Settings::$_rebuildingSettings = false; if ($newSettings['assets'] != $settings[$c]['assets'] || $newSettings['assetsAdmin'] != $settings[$c]['assetsAdmin']) { $dependenciesChanged = true; } if ($newSettings['generators'] != $settings[$c]['generators']) { $generatorssChanged = true; $oldChildComponentClasses = self::_getComponentClassesFromGeneratorsSetting($settings[$c]['generators']); $newChildComponentClasses = self::_getComponentClassesFromGeneratorsSetting($newSettings['generators']); } if (isset($newSettings['menuConfig']) && $newSettings['menuConfig'] != $settings[$c]['menuConfig']) { $menuConfigChanged = true; } $settings[$c] = $newSettings; } echo "refreshed component settings cache...\n"; if ($dependenciesChanged) { echo "assets changed...\n"; self::_clearAssetsDependencies(); self::_clearAssetsAll(); } $clearCacheSimpleStatic = array('has-', 'cs-', 'flag-', 'componentClasses-', 'recCCGen-', 'genInst-', 'childComponentClasses-'); if ($generatorssChanged) { echo "generators changed...\n"; echo count(Kwc_Abstract::getComponentClasses()) . " component classes (previously)\n"; Kwf_Component_Cache_Url_Abstract::getInstance()->clear(); foreach ($newChildComponentClasses as $cmpClass) { if (!in_array($cmpClass, Kwc_Abstract::getComponentClasses())) { self::_loadSettingsRecursive($settings, $cmpClass); } } $removedComponentClasses = array_diff($oldChildComponentClasses, $newChildComponentClasses); foreach ($removedComponentClasses as $removedCls) { self::_removeSettingsRecursive($settings, $removedCls); } } file_put_contents('build/component/settings', serialize($settings)); echo "cleared component settings apc cache...\n"; if (Kwf_Util_Apc::isAvailable()) { self::_clearApcCache(array('clearCacheSimpleStatic' => $clearCacheSimpleStatic)); } else { foreach ($clearCacheSimpleStatic as $i) { Kwf_Cache_SimpleStatic::clear($i); } } echo "\n"; if ($menuConfigChanged) { echo "menu config changed...\n"; Kwf_Acl::clearCache(); echo "cleared acl cache...\n"; } $dependentComponentClasses = array(); foreach (Kwc_Abstract::getComponentClasses() as $c) { if (strpos($c, '.') !== false) { $params = substr($c, strpos($c, '.') + 1); foreach ($componentClasses as $i) { if (strpos($params, $i) !== false) { $dependentComponentClasses[] = $c; } } } } if ($dependentComponentClasses) { echo "dependent componentClasses: " . count($dependentComponentClasses) . " (Cc, Trl)\n"; echo implode(', ', $dependentComponentClasses) . "\n"; self::_clearComponentSettingsCache($dependentComponentClasses, $setting); } }
public function getPageByUrl($url, $acceptLanguage, &$exactMatch = true) { $parsedUrl = parse_url($url); if (!isset($parsedUrl['path'])) { return null; } if (!isset($parsedUrl['host'])) { throw new Kwf_Exception("Host is missing in url '{$url}'"); } if (substr($parsedUrl['host'], 0, 4) == 'dev.') { $parsedUrl['host'] = 'www.' . substr($parsedUrl['host'], 4); } foreach ($this->getPlugins('Kwf_Component_PluginRoot_Interface_PreResolveUrl') as $p) { $parsedUrl = $p->preFormatPath($parsedUrl); } $cacheUrl = $parsedUrl['host'] . $parsedUrl['path']; if ($ret = Kwf_Component_Cache_Url_Abstract::getInstance()->load($cacheUrl)) { $exactMatch = true; } else { $path = $this->getComponent()->formatPath($parsedUrl); if (is_null($path)) { return null; } $baseUrl = Kwf_Setup::getBaseUrl(); if ($baseUrl) { if (substr($path, 0, strlen($baseUrl)) != $baseUrl) { return null; } else { $path = substr($path, strlen($baseUrl)); } } $path = trim($path, '/'); $ret = $this->getComponent()->getPageByUrl($path, $acceptLanguage); if ($ret && rawurldecode($ret->url) == $parsedUrl['path']) { //nur cachen wenn kein redirect gemacht wird $exactMatch = true; if ($ret->isVisible()) { Kwf_Component_Cache_Url_Abstract::getInstance()->save($cacheUrl, $ret); } } else { $exactMatch = false; } } return $ret; }
public function indexAction() { Kwf_Component_Cache::getInstance()->collectGarbage($this->_getParam('debug')); Kwf_Component_Cache_Url_Abstract::getInstance()->collectGarbage($this->_getParam('debug')); exit; }