/** * Invokes the installer, if given. * The installer itself is capable of detecting whether an update or a plain installation is required. * * @throws class_exception * @return string */ public function installOrUpdate() { $strReturn = ""; if (uniStrpos($this->getObjMetadata()->getStrPath(), "core") === false) { throw new class_exception("Current module not located at /core*.", class_exception::$level_ERROR); } if (!$this->isInstallable()) { throw new class_exception("Current module isn't installable, not all requirements are given", class_exception::$level_ERROR); } //search for an existing installer $objFilesystem = new class_filesystem(); $arrInstaller = $objFilesystem->getFilelist($this->objMetadata->getStrPath() . "/installer/", array(".php")); if ($arrInstaller === false) { $strReturn .= "Updating default template pack...\n"; $this->updateDefaultTemplate(); class_cache::flushCache(); return $strReturn; } //proceed with elements foreach ($arrInstaller as $strOneInstaller) { //skip samplecontent files if (uniStrpos($strOneInstaller, "element") !== false) { class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("triggering updateOrInstall() on installer " . $strOneInstaller . ", all requirements given", class_logger::$levelInfo); //trigger update or install $strName = uniSubstr($strOneInstaller, 0, -4); /** @var $objInstaller interface_installer */ $objInstaller = new $strName(); $strReturn .= $objInstaller->installOrUpdate(); } } $strReturn .= "Updating default template pack...\n"; $this->updateDefaultTemplate(); return $strReturn; }
/** * Triggered as soon as a record is updated * * @param string $strEventName * @param array $arrArguments * * @return bool */ public function handleEvent($strEventName, array $arrArguments) { $objRecord = $arrArguments[0]; if ($objRecord instanceof class_module_packagemanager_template) { if ($objRecord->getIntRecordStatus() == 1) { $objOrm = new class_orm_objectlist(); $objOrm->addWhereRestriction(new class_orm_objectlist_systemstatus_restriction(class_orm_comparator_enum::Equal(), 1)); $arrPacks = $objOrm->getObjectList("class_module_packagemanager_template"); foreach ($arrPacks as $objPack) { if ($objPack->getSystemid() != $objRecord->getSystemid()) { $objPack->setIntRecordStatus(0); $objPack->updateObjectToDb(); } } //update the active-pack constant $objSetting = class_module_system_setting::getConfigByName("_packagemanager_defaulttemplate_"); if ($objSetting !== null) { $objSetting->setStrValue($objRecord->getStrName()); $objSetting->updateObjectToDb(); } class_cache::flushCache("class_element_portal"); } } return true; }
/** * @see interface_admin_systemtask::executeTask() * @return string */ public function executeTask() { if (!class_module_system_module::getModuleByName("system")->rightRight2()) { return $this->getLang("commons_error_permissions"); } //increase the cachebuster, so browsers are forced to reload JS and CSS files $objCachebuster = class_module_system_setting::getConfigByName("_system_browser_cachebuster_"); $objCachebuster->setStrValue((int) $objCachebuster->getStrValue() + 1); $objCachebuster->updateObjectToDb(); if (class_cache::flushCache($this->getParam("cacheSource"))) { return $this->objToolkit->getTextRow($this->getLang("systemtask_flushcache_success")); } else { return $this->objToolkit->getTextRow($this->getLang("systemtask_flushcache_error")); } }
public function testCacheFlushing() { $objCache = class_cache::createNewInstance(self::$strCacheSource); $objCache->setStrHash1("testClean"); $objCache->setStrContent("test"); $objCache->setIntLeasetime(time() + 2); $objCache->updateObjectToDb(); $this->flushDBCache(); $objEntry = class_cache::getCachedEntry(self::$strCacheSource, "testClean"); $this->assertNotNull($objEntry); $this->flushDBCache(); class_cache::flushCache(self::$strCacheSource); $this->flushDBCache(); $objEntry = class_cache::getCachedEntry(self::$strCacheSource, "testClean"); $this->assertNull($objEntry); }
/** * Deletes the complete Pages-Cache * * @return bool */ public function flushCompletePagesCache() { return class_cache::flushCache("class_element_portal"); }
/** * Deletes the element from the system-tables, also from the foreign-element-tables. * This takes care of reordering the internal sort-ids. * * @return bool */ public function deleteObjectFromDatabase() { //fix the internal sorting $arrElements = $this->getSortedElementsAtPlaceholder(); $arrIds = array(); $bitHit = false; foreach ($arrElements as $arrOneSibling) { if ($bitHit) { $arrIds[] = $arrOneSibling["system_id"]; } if ($arrOneSibling["system_id"] == $this->getSystemid()) { $bitHit = true; } } if (count($arrIds) > 0) { $strQuery = "UPDATE " . _dbprefix_ . "system SET system_sort = system_sort-1 where system_id IN (" . implode(",", array_map(function ($strVal) { return "?"; }, $arrIds)) . ")"; $this->objDB->_pQuery($strQuery, $arrIds); } //Load the Element-Data $objElement = $this->getConcreteAdminInstance(); if ($objElement != null) { //Fetch the table $strElementTable = $objElement->getTable(); //Delete the entry in the Element-Table if ($strElementTable != "") { $strQuery = "DELETE FROM " . $strElementTable . " WHERE content_id= ?"; if (!$this->objDB->_pQuery($strQuery, array($this->getSystemid()))) { return false; } } } //Delete from page_element table parent::deleteObjectFromDatabase(); //Loading the data of the corresponding site $objPage = new class_module_pages_page($this->getPrevId()); class_cache::flushCache("class_element_portal", $objPage->getStrName()); return true; }
/** * Removes one page from the cache * * @param string $strPagename * @return bool */ public function flushPageFromPagesCache($strPagename) { return class_cache::flushCache("class_element_portal", $strPagename); }
/** * Deletes all entries currently saved to the cache * * @return bool */ public function flushCache() { return class_cache::flushCache(__CLASS__); }