/** * Copies the extracted(!) package from the temp-folder * to the target-folder. * In most cases, this is either located at /core or at /templates. * The original should be deleted afterwards. * * @throws class_exception * @return void */ public function move2Filesystem() { $strSource = $this->objMetadata->getStrPath(); if (!is_dir(_realpath_ . $strSource)) { throw new class_exception("current package " . $strSource . " is not a folder.", class_exception::$level_ERROR); } $objFilesystem = new class_filesystem(); $objFilesystem->chmod($this->getStrTargetPath(), 0777); class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("moving " . $strSource . " to " . $this->getStrTargetPath(), class_logger::$levelInfo); $objFilesystem->folderCopyRecursive($strSource, $this->getStrTargetPath(), true); $this->objMetadata->setStrPath($this->getStrTargetPath()); $objFilesystem->chmod($this->getStrTargetPath()); $objFilesystem->folderDeleteRecursive($strSource); //shift the cache buster $objSetting = class_module_system_setting::getConfigByName("_system_browser_cachebuster_"); if ($objSetting != null) { $objSetting->setStrValue((int) $objSetting->getStrValue() + 1); $objSetting->updateObjectToDb(); } }
/** * @permissions edit * @return string */ protected function actionCopyPack() { $objForm = $this->getPackAdminForm(); $strPackName = $this->getParam("pack_name"); $strPackName = createFilename($strPackName, true); if ($strPackName != "" && is_dir(_realpath_ . _templatepath_ . "/" . $strPackName)) { $objForm->addValidationError("name", $this->getLang("pack_folder_existing")); } if (!$objForm->validateForm()) { return $this->actionNew($objForm); } $objFilesystem = new class_filesystem(); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/tpl"); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/css"); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/js"); $arrModules = $this->getParam("pack_modules"); foreach ($arrModules as $strName => $strValue) { if ($strValue != "") { $objFilesystem->folderCopyRecursive(class_resourceloader::getInstance()->getCorePathForModule($strName) . "/" . $strName . "/templates/default", _templatepath_ . "/" . $strPackName); } } class_resourceloader::getInstance()->flushCache(); class_classloader::getInstance()->flushCache(); class_reflection::flushCache(); $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "listTemplates")); return ""; }
/** * @return bool */ public function updateDefaultTemplate() { $objFilesystem = new class_filesystem(); class_logger::getInstance(class_logger::PACKAGEMANAGEMENT)->addLogRow("updating default template from /" . $this->objMetadata->getStrPath(), class_logger::$levelInfo); if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/js")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/js", "/templates/default/js", true); } if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/css")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/css", "/templates/default/css", true); } if (is_dir(_realpath_ . "/" . $this->objMetadata->getStrPath() . "/templates/default/pics")) { $objFilesystem->folderCopyRecursive($this->objMetadata->getStrPath() . "/templates/default/pics", "/templates/default/pics", true); } return true; }