/** * Install Tenplate Caches * * @return void */ public function install_template_caches() { //----------------------------------------- // INIT //----------------------------------------- $this->settings['base_url'] = IPSSetUp::getSavedData('install_url'); $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $skinId = intval($this->request['skinId']); $skinData = array(); $output = array(); //----------------------------------------- // Recache skins: Moved here so they are // build after hooks are added //----------------------------------------- /* Load skin classes */ require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php'; /*noLibHook*/ require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php'; /*noLibHook*/ require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php'; /*noLibHook*/ $skinFunctions = new skinImportExport($this->registry); /* Grab skin data */ $skinData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => 'set_id > ' . $skinId . ' AND set_parent_id=0', 'order' => 'set_id ASC', 'limit' => array(0, 1))); if ($skinData['set_id']) { $skinFunctions->rebuildPHPTemplates($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildCSS($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildReplacementsCache($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $output[] = "Обновлен кеш стиля " . $skinData['set_name'] . "..."; /* Go for the next */ $this->_finishStep($output, "Обновление: Кеш стилей", 'upgrade&do=templatecache&skinId=' . $skinData['set_id']); } else { /* All diddly done */ $output[] = "Кеш стилей обновлен"; $skinFunctions->rebuildSkinSetsCache(); /* Rebuild FURL & GLOBAL caches */ try { IPSLib::cacheFurlTemplates(); IPSLib::cacheGlobalCaches(); } catch (Exception $error) { } /* Clear out minify files */ try { if (is_dir(DOC_IPS_ROOT_PATH . 'cache/tmp')) { foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/tmp') as $cache) { if ($cache->getMTime() < time() - 60 * 60 * 24 * 7 and $cache->getFilename() != 'index.html') { @unlink($cache->getPathname()); } } } } catch (Exception $e) { } /* Show message and go */ $this->_finishStep($output, "Upgrade: Skin Caches", 'done'); } }
/** * Install Tenplate Caches * * @return void */ public function install_template_caches() { //----------------------------------------- // INIT //----------------------------------------- $this->settings['base_url'] = IPSSetUp::getSavedData('install_url'); $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $skinId = intval($this->request['skinId']); $skinData = array(); $output = array(); //----------------------------------------- // Recache skins: Moved here so they are // build after hooks are added //----------------------------------------- /* Load skin classes */ require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php'; require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php'; require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php'; $skinFunctions = new skinImportExport($this->registry); /* Grab skin data */ $skinData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => 'set_id > ' . $skinId . ' AND set_parent_id=0', 'order' => 'set_id ASC', 'limit' => array(0, 1))); if ($skinData['set_id']) { $skinFunctions->rebuildPHPTemplates($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildCSS($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildReplacementsCache($skinData['set_id']); $output = array_merge($output, $skinFunctions->fetchMessages(TRUE)); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $output[] = "Recached skin " . $skinData['set_name'] . "..."; /* Go for the next */ $this->_finishStep($output, "Upgrade: Skin Caches", 'upgrade&do=templatecache&skinId=' . $skinData['set_id']); } else { /* All diddly done */ $output[] = "All skins recached"; $skinFunctions->rebuildSkinSetsCache(); /* Rebuild FURL cache */ try { IPSLib::cacheFurlTemplates(); } catch (Exception $error) { } $this->_finishStep($output, "Upgrade: Skin Caches", 'done'); } }