本文整理汇总了PHP中IPSLib::cacheGlobalCaches方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::cacheGlobalCaches方法的具体用法?PHP IPSLib::cacheGlobalCaches怎么用?PHP IPSLib::cacheGlobalCaches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::cacheGlobalCaches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finish
/**
* Finalizes installation and rebuilds caches
*
* @return @e void
*/
public function finish()
{
/* INIT */
$vars = $this->getVars();
$output = array();
$errors = array();
/* Init Data */
$data = IPSSetUp::fetchXmlAppInformation($vars['app_directory'], $this->settings['gb_char_set']);
$_numbers = IPSSetUp::fetchAppVersionNumbers($vars['app_directory']);
/* Grab Data */
$data['app_directory'] = $vars['app_directory'];
$data['current_version'] = $_numbers['current'][0] ? $_numbers['current'][0] : $this->lang->words['cur_version_none'];
$data['latest_version'] = $_numbers['latest'][1];
$data['next_version'] = $_numbers['next'][0];
/* Rebuild applications and modules cache */
$this->cache->rebuildCache('app_cache', 'global');
$this->cache->rebuildCache('module_cache', 'global');
$this->cache->rebuildCache('app_menu_cache', 'global');
$this->cache->rebuildCache('group_cache', 'global');
$this->cache->rebuildCache('notifications', 'global');
$this->cache->rebuildCache('report_plugins', 'global');
/* Rebuild application specific caches */
$_file = $this->app_full_path . 'extensions/coreVariables.php';
if (is_file($_file)) {
$CACHE = array();
require $_file;
/*noLibHook*/
if (is_array($CACHE) and count($CACHE)) {
foreach ($CACHE as $key => $cdata) {
$this->cache->rebuildCache($key, $vars['app_directory']);
}
}
}
/* Rebuild GLOBAL CACHES! */
try {
IPSLib::cacheGlobalCaches();
} catch (Exception $e) {
// Show an error?
}
/* Rebuild FURLs */
$furltemplatesfile = $this->app_full_path;
if (IPB_USE_ONLY_ID_FURL && is_file($furltemplatesfile . '/extensions/furlTemplatesID.php')) {
$furltemplatesfile .= '/extensions/furlTemplatesID.php';
} else {
$furltemplatesfile .= '/extensions/furlTemplates.php';
}
if (is_file($furltemplatesfile)) {
try {
IPSLib::cacheFurlTemplates();
} catch (Exception $e) {
// Show an error?
}
}
/* Show completed screen... */
$this->registry->output->html .= $this->html->setup_completed_screen($data, $vars['type']);
}
示例2: _hookSave
//.........这里部分代码省略.........
if (!$id) {
$this->registry->output->showError($this->lang->words['h_noedit'], 1118);
}
$hookData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id));
if (!$hookData['hook_id']) {
$this->registry->output->showError($this->lang->words['h_noedit'], 1119);
}
$extraKey = ' AND hook_id != ' . $hookData['hook_id'];
}
/* Error Checking */
if (!$this->request['hook_name']) {
$errors[] = $this->lang->words['hook_form_no_title'];
}
if (empty($this->request['hook_key'])) {
$errors[] = $this->lang->words['hook_form_no_key'];
} else {
$keyCheck = $this->DB->buildAndFetch(array('select' => 'count(*) as found', 'from' => 'core_hooks', 'where' => "hook_key='" . $this->DB->addSlashes($this->request['hook_key']) . "'" . $extraKey));
if ($keyCheck['found'] > 0) {
$errors[] = $this->lang->words['hook_form_dupe_key'];
}
}
/* Got any errors? */
if (is_array($errors) && count($errors)) {
$this->registry->output->global_error = implode('<br />', $errors);
$this->_hookForm();
return;
}
/* Not IN_DEV? */
if (!IN_DEV) {
$this->DB->build(array('select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . intval($this->request['hook_id'])));
$this->DB->execute();
while ($_r = $this->DB->fetch()) {
$_hookFiles[$_r['hook_classname']] = $_r['hook_file_stored'];
}
}
/* Check for requirements */
if (is_array($this->request['requireApp']) and count($this->request['requireApp'])) {
foreach ($this->request['requireApp'] as $_index => $app_key) {
if ($app_key) {
$minVersion = intval($this->request['minVersion'][$_index]);
$maxVersion = intval($this->request['maxVersion'][$_index]);
$requireApp[$app_key] = array('app_name' => ipsRegistry::$applications[$app_key]['app_title'], 'min_version' => $minVersion, 'max_version' => $maxVersion);
}
}
}
/* Check for files */
if (is_array($this->request['file']) and count($this->request['file'])) {
foreach ($this->request['file'] as $index => $file) {
if ($file) {
$newFiles[$index] = array('hook_file_real' => $file, 'hook_type' => $this->request['hook_type'][$index], 'hook_classname' => $this->request['hook_classname'][$index], 'hook_data' => serialize(array('dataLocation' => trim($this->request['dataLocation'][$index]), 'libApplication' => trim($this->request['libApplication'][$index]), 'classToOverload' => trim($this->request['classToOverload'][$index]), 'skinGroup' => $this->request['skinGroup'][$index], 'skinFunction' => $this->request['skinFunction'][$index], 'type' => $this->request['type'][$index], 'id' => $this->request['id'][$index], 'position' => $this->request['position'][$index])));
/**
* @link http://community.invisionpower.com/tracker/issue-22084-hook-edit-does-not-preserve-correct-name/
* We don't want to reset the stored name if you are not in developer mode
*/
if (IN_DEV) {
$newFiles[$index]['hook_file_stored'] = $file;
// During import this is a random name, but for devs it's actual file
} else {
$newFiles[$index]['hook_file_stored'] = $_hookFiles[$this->request['hook_classname'][$index]] ? $_hookFiles[$this->request['hook_classname'][$index]] : $file;
}
}
}
}
/* Get position */
if ($type == 'add') {
$position = $this->DB->buildAndFetch(array('select' => 'MAX(hook_position) as newPos', 'from' => 'core_hooks'));
$position['newPos'] = intval($position['newPos']) + 1;
} else {
$position['newPos'] = $hookData['hook_position'];
}
$mainHookRecord = array('hook_name' => trim($this->request['hook_name']), 'hook_key' => substr(trim($this->request['hook_key']), 0, 32), 'hook_global_caches' => is_array($this->request['hook_global_caches']) && count($this->request['hook_global_caches']) ? implode(',', $this->request['hook_global_caches']) : '', 'hook_desc' => trim($this->request['hook_desc']), 'hook_version_human' => trim($this->request['hook_version_human']), 'hook_version_long' => trim($this->request['hook_version_long']), 'hook_author' => trim($this->request['hook_author']), 'hook_email' => trim($this->request['hook_email']), 'hook_website' => trim($this->request['hook_website']), 'hook_update_check' => trim($this->request['hook_update_check']), 'hook_enabled' => $type == 'add' ? 1 : $hookData['hook_enabled'], 'hook_installed' => $type == 'add' ? IPS_UNIX_TIME_NOW : $hookData['hook_installed'], 'hook_updated' => $type == 'add' ? 0 : IPS_UNIX_TIME_NOW, 'hook_position' => $position['newPos'], 'hook_requirements' => serialize(array('required_applications' => $requireApp, 'hook_php_version_min' => trim($this->request['hook_php_version_min']), 'hook_php_version_max' => trim($this->request['hook_php_version_max']))));
if ($type == 'edit') {
$this->DB->update('core_hooks', $mainHookRecord, 'hook_id=' . $hookData['hook_id']);
$this->DB->delete('core_hooks_files', 'hook_hook_id=' . $hookData['hook_id']);
} else {
$this->DB->insert('core_hooks', $mainHookRecord);
$hookData['hook_id'] = $this->DB->getInsertId();
}
foreach ($newFiles as $index => $toInsert) {
$toInsert['hook_hook_id'] = $hookData['hook_id'];
$this->DB->insert('core_hooks_files', $toInsert);
}
/* Rebuild cache */
$this->rebuildHooksCache();
/* Rebuild global caches */
try {
IPSLib::cacheGlobalCaches();
} catch (Exception $e) {
}
/* Flag skins for recache */
require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
/*noLibHook*/
$skinCaching = new skinCaching($this->registry);
$skinCaching->flagSetForRecache();
/* Redirect */
$this->registry->output->setMessage($this->lang->words['h_saved']);
$this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . $this->form_code . '&do=hooks_overview');
}
示例3: globalCachesRecache
/**
* Recache the global caches
*
* @return @e void [Outputs to screen]
*/
public function globalCachesRecache()
{
try {
IPSLib::cacheGlobalCaches();
$msg = $this->lang->words['gcaches_cache_rebuilt'];
} catch (Exception $e) {
$msg = $e->getMessage();
switch ($msg) {
case 'CANNOT_WRITE':
$msg = $this->lang->words['gcaches_cannot_write'];
break;
case 'NO_DATA_TO_WRITE':
$msg = $this->lang->words['gcaches_no_data'];
break;
}
}
$this->registry->output->global_message = $msg;
$this->cacheOverview();
}
示例4: install_template_caches
/**
* 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');
}
}
示例5: install_caches
//.........这里部分代码省略.........
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');
}
}
示例6: applicationSave
//.........这里部分代码省略.........
$this->applicationForm($type);
return;
}
if ((empty($app_enabled) || empty($app_public)) && in_array($app_directory, array('core', 'forums', 'members'))) {
$this->registry->output->showError($this->lang->words['cannot_toggle_defaults'], 111161.2);
}
/* $etup update array */
$array = array('app_title' => $app_title, 'app_public_title' => $app_public, 'app_enabled' => $app_enabled, 'app_hide_tab' => intval($this->request['app_hide_tab']), 'app_description' => trim($this->request['app_description']), 'app_author' => trim($this->request['app_author']), 'app_version' => trim($this->request['app_version']), 'app_directory' => $app_directory, 'app_website' => trim($this->request['app_website']), 'app_update_check' => trim($this->request['app_update_check']), 'app_global_caches' => is_array($this->request['app_global_caches']) && count($this->request['app_global_caches']) ? implode(',', $this->request['app_global_caches']) : '', 'app_tab_groups' => is_array($this->request['app_tab_groups']) && count($this->request['app_tab_groups']) ? implode(',', $this->request['app_tab_groups']) : '');
//-----------------------------------------
// IN DEV?
//-----------------------------------------
if (IN_DEV) {
$array['app_protected'] = intval($this->request['app_protected']);
}
//-----------------------------------------
// Save...
//-----------------------------------------
if ($type == 'add') {
$array['app_added'] = IPS_UNIX_TIME_NOW;
$array['app_location'] = 'other';
$max = $this->DB->buildAndFetch(array('select' => 'MAX(app_position) as position', 'from' => 'core_applications'));
$array['app_position'] = intval($max['position']) + 1;
$this->DB->insert('core_applications', $array);
$this->registry->output->global_message = $this->lang->words['a_newapp'];
} else {
/* We're disabling the app? */
if (empty($app_enabled)) {
$array['app_position'] = 0;
} else {
if (empty($application['app_enabled'])) {
$appsCount = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'core_applications', 'where' => 'app_enabled=1'));
$array['app_position'] = $appsCount['total'] + 1;
}
}
/* Update the application record */
$this->DB->update('core_applications', $array, 'app_id=' . $application['app_id']);
/* Update modules and tasks, if the application directory changed */
if ($application['app_directory'] != $app_directory) {
$sphinxRebuild = true;
$this->DB->update('task_manager', array('task_application' => $app_directory), "task_application='{$application['app_directory']}'");
$this->DB->update('core_sys_module', array('sys_module_application' => $app_directory), "sys_module_application='{$application['app_directory']}'");
$this->DB->update('admin_logs', array('appcomponent' => $app_directory), "appcomponent='{$application['app_directory']}'");
$this->DB->update('core_editor_autosave', array('eas_app' => $app_directory), "eas_app='{$application['app_directory']}'");
$this->DB->update('core_incoming_emails', array('rule_app' => $app_directory), "rule_app='{$application['app_directory']}'");
$this->DB->update('core_item_markers', array('item_app' => $app_directory), "item_app='{$application['app_directory']}'");
$this->DB->update('core_like', array('like_app' => $app_directory), "like_app='{$application['app_directory']}'");
$this->DB->update('core_like_cache', array('like_cache_app' => $app_directory), "like_cache_app='{$application['app_directory']}'");
$this->DB->update('core_share_links_log', array('log_data_app' => $app_directory), "log_data_app='{$application['app_directory']}'");
$this->DB->update('core_sys_lang_words', array('word_app' => $app_directory), "word_app='{$application['app_directory']}'");
$this->DB->update('core_sys_settings_titles', array('conf_title_app' => $app_directory), "conf_title_app='{$application['app_directory']}'");
$this->DB->update('core_tags', array('tag_meta_app' => $app_directory), "tag_meta_app='{$application['app_directory']}'");
$this->DB->update('custom_bbcode', array('bbcode_app' => $app_directory), "bbcode_app='{$application['app_directory']}'");
$this->DB->update('faq', array('app' => $app_directory), "app='{$application['app_directory']}'");
$this->DB->update('inline_notifications', array('notify_meta_app' => $app_directory), "notify_meta_app='{$application['app_directory']}'");
$this->DB->update('permission_index', array('app' => $app_directory), "app='{$application['app_directory']}'");
$this->DB->update('reputation_cache', array('app' => $app_directory), "app='{$application['app_directory']}'");
$this->DB->update('reputation_index', array('app' => $app_directory), "app='{$application['app_directory']}'");
$this->DB->update('skin_css', array('css_app' => $app_directory), "css_app='{$application['app_directory']}'");
$this->DB->update('skin_css_previous', array('p_css_app' => $app_directory), "p_css_app='{$application['app_directory']}'");
$this->DB->update('upgrade_history', array('upgrade_app' => $app_directory), "upgrade_app='{$application['app_directory']}'");
}
/* Set the message */
$this->registry->output->global_message = $this->lang->words['a_editappdone'];
}
/* Have we toggled this? */
if ($app_enabled != $application['app_enabled']) {
$sphinxRebuild = true;
}
//-----------------------------------------
// Recache
//-----------------------------------------
$this->applicationsRecache();
$this->applicationsMenuDataRecache();
try {
IPSLib::cacheFurlTemplates();
IPSLib::cacheGlobalCaches();
} catch (Exception $e) {
}
/**
* Re-enable the tasks if app is active
* (more effective than checking per-case)
*/
if ($app_enabled) {
$this->DB->update('task_manager', array('task_enabled' => 1), "task_application='{$app_directory}'");
}
/* Check for possible hook warnings */
if ($type == 'edit' && $application['app_enabled'] && !$app_enabled) {
// Switch the enabled value here or check will fail with the current cache!
ipsRegistry::$applications[$application['app_directory']]['app_enabled'] = 0;
$this->_checkHooksWarnings($application['app_directory']);
}
//-----------------------------------------
// Sphinx involved?
//-----------------------------------------
if ($sphinxRebuild and $this->settings['search_method'] == 'sphinx' && is_file(IPSLib::getAppDir($app_directory) . '/extensions/sphinxTemplate.php')) {
$this->registry->output->global_message .= sprintf($this->lang->words['rebuild_sphinx'], $this->settings['_base_url']);
}
/* All done */
$this->applicationsOverview();
}