/** * Rebuilds language from XML files * * @return @e void */ public function rebuildFromXml() { //----------------------------------------- // Init //----------------------------------------- $apps = array(); $previous = trim($this->request['previous']); $type = trim($this->request['type']); $id = intval($this->request['id']); $_word = $type == 'admin' ? 'admin' : 'public'; //----------------------------------------- // Verify writable //----------------------------------------- if (!is_writeable(IPS_CACHE_PATH . 'cache/lang_cache/' . $id)) { $this->registry->output->global_error = $this->lang->words['cannot_write_to_cache'] ? sprintf($this->lang->words['cannot_write_to_cache'], $id) : "Cannot write to cache/lang_cache/" . $id; $this->languagesList(); return; } //----------------------------------------- // Get setup class //----------------------------------------- require_once IPS_ROOT_PATH . "setup/sources/base/setup.php"; /*noLibHook*/ //----------------------------------------- // Get apps //----------------------------------------- foreach (ipsRegistry::$applications as $appDir => $appData) { $apps[] = $appDir; } //----------------------------------------- // Klude for setup class //----------------------------------------- IPSSetUp::setSavedData('install_apps', implode(',', $apps)); //----------------------------------------- // Get next app //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']); if ($next['key']) { $msg = $next['title'] . sprintf($this->lang->words['importing_x_langs'], $_word); $_PATH = IPSLib::getAppDir($next['key']) . '/xml/'; //----------------------------------------- // Try to import all the lang packs //----------------------------------------- try { foreach (new DirectoryIterator($_PATH) as $f) { if (preg_match("#" . $_word . "_(.+?)_language_pack.xml#", $f->getFileName())) { $this->request['file_location'] = $_PATH . $f->getFileName(); $this->imprtFromXML(1, true, true, $next['key']); } } } catch (Exception $e) { } //----------------------------------------- // Off to next setp //----------------------------------------- $this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&id={$id}&type={$type}&previous=" . $next['key'], $msg . '<br>' . $this->registry->output->global_message); $this->registry->output->global_message = ''; return; } else { if ($type == 'public') { //----------------------------------------- // Onto admin languages //----------------------------------------- $this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . "do=rebuildFromXml&id={$id}&type=admin", $this->lang->words['starting_admin_import']); return; } else { //----------------------------------------- // And we're done //----------------------------------------- $this->registry->output->redirect($this->settings['base_url'] . $this->form_code, $this->lang->words['lang_reimport_done']); } } }
/** * Install Caches * * @return void */ public function install_caches() { //----------------------------------------- // INIT //----------------------------------------- $this->settings['base_url'] = IPSSetUp::getSavedData('install_url'); $this->settings['ipb_reg_number'] = IPSSetUp::getSavedData('lkey'); $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']); /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Install SYSTEM Templates on first cycle //----------------------------------------- if (!$previous) { //----------------------------------------- // Global caches... //----------------------------------------- # Grab cache master file require_once IPS_ROOT_PATH . 'extensions/coreVariables.php'; /*noLibHook*/ /* Add handle */ $_tmp = new coreVariables(); $_cache = $_tmp->fetchCaches(); $CACHE = $_cache['caches']; //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('caches'); } //----------------------------------------- // Continue //----------------------------------------- if (is_array($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { $output[] = "Обновление {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, 'global'); } } //------------------------------------------------------------- // Systemvars //------------------------------------------------------------- $output[] = "Обновление кеша системных переменных"; $cache = array('mail_queue' => 0, 'task_next_run' => time() + 3600); ipsRegistry::cache()->setCache('systemvars', $cache, array('array' => 1)); //------------------------------------------------------------- // Stats //------------------------------------------------------------- $output[] = "Обновление кеша статистики"; $cache = array('total_replies' => 0, 'total_topics' => 1, 'mem_count' => 1, 'last_mem_name' => IPSSetUp::getSavedData('admin_user'), 'last_mem_id' => 1); ipsRegistry::cache()->setCache('stats', $cache, array('array' => 1)); //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('caches'); } $output[] = "Все кеши обновлены"; //----------------------------------------- // 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 */ $this->DB->build(array('select' => '*', 'from' => 'skin_collections')); $this->DB->execute(); while ($row = $this->DB->fetch()) { /* Bit of jiggery pokery... */ if ($row['set_key'] == 'default') { $row['set_key'] = 'root'; $row['set_id'] = 0; } $skinSets[$row['set_key']] = $row; } foreach ($skinSets as $skinKey => $skinData) { /* Bit of jiggery pokery... */ if ($skinData['set_key'] == 'root') { $skinData['set_key'] = 'default'; $skinData['set_id'] = 1; $skinKey = 'default'; } $skinFunctions->rebuildPHPTemplates($skinData['set_id']); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildCSS($skinData['set_id']); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } $skinFunctions->rebuildReplacementsCache($skinData['set_id']); if ($skinFunctions->fetchErrorMessages() !== FALSE) { $this->registry->output->addWarning(implode("<br />", $skinFunctions->fetchErrorMessages())); } } $skinFunctions->rebuildSkinSetsCache(); $output[] = "Кеш стиля обновлен"; /* Rebuild FURL & GLOBAL caches */ try { IPSLib::cacheFurlTemplates(); IPSLib::cacheGlobalCaches(); } catch (Exception $error) { } } //----------------------------------------- // Now install other caches //----------------------------------------- if ($next['key']) { $_PATH = IPSLib::getAppDir($next['key']) . '/extensions/'; if (is_file($_PATH . 'coreVariables.php')) { //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'before_inserts_run')) { $q = $extra_install->before_inserts_run('caches'); } # Grab cache master file require_once $_PATH . 'coreVariables.php'; /*noLibHook*/ if (is_array($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { $output[] = $next['title'] . ": Обновление {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, $next['key']); } } else { $output[] = $next['title'] . ": Нет кешей для обновления..."; } //----------------------------------------- // Adjust the table? //----------------------------------------- if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('caches'); } } else { $output[] = $next['title'] . ": Нет кешей для обновления..."; } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Установка: кеш", 'install&do=caches&previous=' . $next['key']); } else { $this->_finishStep($output, "Установка: кеш", 'done'); } }
/** * Install Caches * * @return void */ public function install_caches() { //----------------------------------------- // INIT //----------------------------------------- $this->settings['base_url'] = IPSSetUp::getSavedData('install_url'); $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']); //----------------------------------------- // Install SYSTEM Templates //----------------------------------------- if ($next['key']) { $_PATH = IPSLib::getAppDir($next['key']) . '/extensions/'; if (is_file($_PATH . 'coreVariables.php')) { # Grab cache master file $CACHE = array(); require_once $_PATH . 'coreVariables.php'; /*noLibHook*/ if (is_array($CACHE) && count($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { if (empty($cs_data['skip_rebuild_when_upgrading'])) { $output[] = $next['title'] . ": Обновление {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, $next['key']); } } } else { $output[] = $next['title'] . ": Нет кешей для обновления"; } } else { $output[] = $next['title'] . ": Нет кешей для обновления"; } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Обновление: Кеш", 'upgrade&do=caches&previous=' . $next['key']); } else { //----------------------------------------- // Global caches... //----------------------------------------- # Grab cache master file require_once IPS_ROOT_PATH . 'extensions/coreVariables.php'; /*noLibHook*/ /* Add handle */ $_tmp = new coreVariables(); $_cache = $_tmp->fetchCaches(); $CACHE = $_cache['caches']; //----------------------------------------- // Continue //----------------------------------------- if (is_array($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { if (empty($cs_data['skip_rebuild_when_upgrading'])) { $output[] = "Обновление {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, 'global'); } } } //------------------------------------------------------------- // Systemvars //------------------------------------------------------------- $output[] = "Обновление кеша системных переменных"; $cache = ipsRegistry::cache()->getCache('systemvars'); $cache['task_next_run'] = time() + 3600; $cache['mail_queue'] = 0; ipsRegistry::cache()->setCache('systemvars', $cache, array('array' => 1)); /* Reset IPSNews cache */ ipsRegistry::cache()->setCache('ipsNewsData', array(), array('array' => 1)); //----------------------------------------- // Output //----------------------------------------- $output[] = "Весь кеш обновлен"; $this->_finishStep($output, "Обновление: Кеш", 'upgrade&do=templatecache'); } }
/** * Install Caches * * @return void */ public function install_caches() { //----------------------------------------- // INIT //----------------------------------------- $this->settings['base_url'] = IPSSetUp::getSavedData('install_url'); $previous = $_REQUEST['previous']; //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous); //----------------------------------------- // Install SYSTEM Templates //----------------------------------------- if ($next['key']) { $_PATH = IPS_ROOT_PATH . 'applications/' . $next['key'] . '/extensions/'; if (file_exists($_PATH . 'coreVariables.php')) { # Grab cache master file require_once $_PATH . 'coreVariables.php'; if (is_array($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { $output[] = $next['title'] . ": Building {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, $next['key']); } } else { $output[] = $next['title'] . ": No caches to build..."; } } else { $output[] = $next['title'] . ": No caches to build..."; } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $this->_finishStep($output, "Upgrade: Caches", 'upgrade&do=caches&previous=' . $next['key']); } else { //----------------------------------------- // Global caches... //----------------------------------------- # Grab cache master file require_once IPS_ROOT_PATH . 'extensions/coreVariables.php'; /* Add handle */ $_tmp = new coreVariables(); $_cache = $_tmp->fetchCaches(); $CACHE = $_cache['caches']; //----------------------------------------- // Continue //----------------------------------------- if (is_array($CACHE)) { foreach ($CACHE as $cs_key => $cs_data) { $output[] = "System Building {$cs_key}..."; ipsRegistry::cache()->rebuildCache($cs_key, 'global'); } } //------------------------------------------------------------- // Systemvars //------------------------------------------------------------- $output[] = "Rebuilding system variables cache..."; $cache = array('mail_queue' => 0, 'task_next_run' => time() + 3600); ipsRegistry::cache()->setCache('systemvars', $cache, array('array' => 1, 'deletefirst' => 1)); $output[] = "Global: All caches upgraded"; $this->_finishStep($output, "Upgrade: Caches", 'upgrade&do=templatecache'); } }