private function clear_caches() { $cache_service = AppContext::get_cache_service(); $cache_service->clear_phpboost_cache(); $cache_service->clear_syndication_cache(); CLIOutput::writeln('Caches cleared'); }
function execute(HTTPRequestCustom $request) { session_start(); $data = PersistenceContext::get_querier()->select_single_row(PREFIX . 'member', array('user_id'), 'WHERE login=:user_login', array('user_login' => $_SESSION['wpimport']['default_author'])); $_SESSION['wpimport']['wppath'] = substr($_SESSION['wpimport']['wppath'], -1) != '/' ? $_SESSION['wpimport']['wppath'] . '/' : $_SESSION['wpimport']['wppath']; $_SESSION['wpimport']['phpboostpath'] = substr($_SESSION['wpimport']['phpboostpath'], -1) != '/' ? $_SESSION['wpimport']['phpboostpath'] . '/' : $_SESSION['wpimport']['phpboostpath']; define('WP_PATH', $_SESSION['wpimport']['wppath']); define('PBOOST_PATH', $_SESSION['wpimport']['phpboostpath']); define('IMPORTER_LIST', $_SESSION['wpimport']['importer']); define('PHPBOOST_CAT_IMAGE', $_SESSION['wpimport']['default_cat_image']); define('FILESYSTEM_IMPORT_LOCATION', $_SESSION['wpimport']['import_location']); define('DEFAULT_AUTHOR_ID', $data['user_id']); ini_set('max_execution_time', 0); if (function_exists('xdebug_disable')) { xdebug_disable(); } ob_start(); echo 'Start import : ' . date('H:i:s') . PHP_EOL; echo '-----' . PHP_EOL . PHP_EOL; $success = (require_once __DIR__ . '/../WP2PhpBoost/wp2phpboost.php'); echo 'Clean cache...' . PHP_EOL; AppContext::get_cache_service()->clear_cache(); echo PHP_EOL . PHP_EOL; echo '-----' . PHP_EOL; echo 'End import : ' . date('H:i:s'); $logs = ob_get_clean(); return new JSONResponse(array('success' => $success, 'logs' => utf8_decode($logs))); }
private function clear() { $cache_service = AppContext::get_cache_service(); CLIOutput::writeln('[clear] phpboost cache'); $cache_service->clear_phpboost_cache(); CLIOutput::writeln('[clear] templates cache'); $cache_service->clear_template_cache(); CLIOutput::writeln('[clear] syndication cache'); $cache_service->clear_syndication_cache(); CLIOutput::writeln('[clear] CSS cache'); $cache_service->clear_css_cache(); CLIOutput::writeln('cache has been successfully cleared'); }
private function regenerate_htaccess_file() { $apc_enabled = DataStoreFactory::is_apc_enabled(); if ($apc_enabled) { DataStoreFactory::set_apc_enabled(false); HtaccessFileCache::regenerate(); AppContext::get_cache_service()->clear_cache(); DataStoreFactory::set_apc_enabled(true); } else { AppContext::get_cache_service()->clear_cache(); HtaccessFileCache::regenerate(); } }
/** * @desc Clear the cache of the specified module_id. * @param mixed $module_id the module module_id or false. If false, * Clear all feeds data from the cache * @static */ public static function clear_cache($module_id = false) { $folder = new Folder(FEEDS_PATH); $files = null; if ($module_id !== false) { // Clear only this module cache $files = $folder->get_files('`' . $module_id . '_.*`'); foreach ($files as $file) { $file->delete(); } } else { // Clear the whole cache AppContext::get_cache_service()->clear_syndication_cache(); } }
protected function handle_submit() { AppContext::get_cache_service()->clear_syndication_cache(); }
public static function upgrade_module($module_identifier) { if (!empty($module_identifier) && is_dir(PATH_TO_ROOT . '/' . $module_identifier)) { if (self::is_module_installed($module_identifier)) { if (self::module_is_upgradable($module_identifier)) { $module = self::get_module($module_identifier); $version_upgrading = self::execute_module_upgrade($module_identifier, $module->get_installed_version()); if ($version_upgrading !== null) { $module->set_installed_version($version_upgrading); ModulesConfig::load()->update($module); ModulesConfig::save(); AppContext::get_cache_service()->clear_cache(); try { if (ServerEnvironmentConfig::load()->is_url_rewriting_enabled()) { HtaccessFileCache::regenerate(); } } catch (IOException $ex) { } } else { return self::UPGRADE_FAILED; } } else { return self::MODULE_NOT_UPGRADABLE; } } else { return self::NOT_INSTALLED_MODULE; } } else { return self::UNEXISTING_MODULE; } return self::MODULE_UPDATED; }
public function regenerate_cache() { AppContext::get_cache_service()->clear_cache(); }
private function generate_cache() { AppContext::get_cache_service()->clear_cache(); AppContext::init_extension_provider_service(); }
private function clear_cache() { AppContext::get_cache_service()->clear_cache(); }
$db_utils->optimize($tables_list); $db_utils->repair($tables_list); AppContext::get_cache_service()->clear_cache(); AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=success', '', '&')); } } elseif (!empty($post_file)) { if ($post_file['size'] < 10485760 && preg_match('`[^/]+\\.sql$`', $post_file['name'])) { $file_path = PATH_TO_ROOT . '/cache/backup/' . $post_file['name']; if (!is_file($file_path) && move_uploaded_file($post_file['tmp_name'], $file_path)) { Environment::try_to_increase_max_execution_time(); $db_utils = PersistenceContext::get_dbms_utils(); $db_utils->parse_file(new File($file_path)); $tables_list = $db_utils->list_tables(); $db_utils->optimize($tables_list); $db_utils->repair($tables_list); AppContext::get_cache_service()->clear_cache(); AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=success', '', '&')); } elseif (is_file($file_path)) { //Le fichier existe déjà, on ne peut pas le copier AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=file_already_exists', '', '&')); } else { AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=upload_failure', '', '&')); } } else { AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=failure', '', '&')); } } $tpl->put_all(array('C_DATABASE_FILES' => true, 'L_LIST_FILES' => $LANG['db_file_list'], 'L_CONFIRM_RESTORE' => $LANG['db_confirm_restore'], 'L_CONFIRM_DEL' => $LANG['db_confirm_delete_file'], 'L_NAME' => $LANG['db_file_name'], 'L_WEIGHT' => $LANG['db_file_weight'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_DOWNLOAD' => $LANG['db_download'], 'L_RESTORE' => $LANG['db_restore'], 'L_DATE' => LangLoader::get_message('date', 'date-common'))); if (!empty($error)) { switch ($error) { case 'success':
protected function handle_submit() { AppContext::get_cache_service()->clear_cache(); HtaccessFileCache::regenerate(); }
private function create_phpboost_tables() { AppContext::get_cache_service()->clear_cache(); try { $this->installation->create_phpboost_tables(DBFactory::MYSQL, $this->db_host, $this->db_port, $this->db_schema, $this->db_user, $this->db_password, $this->db_tables_prefix); return true; } catch (UnexistingDatabaseException $exception) { CLIOutput::writeln('Database ' . $this->db_schema . ' does not exist and attempt to create it failed. Create it and relaunch the installation'); } catch (DBConnectionException $exception) { CLIOutput::writeln('Connection to database failed, check your connection parameters'); } catch (IOException $exception) { CLIOutput::writeln('Can\'t write database configuration file informations to /kernel/db/config.php. ' . 'Check file or parent directory permissions.'); } return false; }
public static function uninstall($theme_id, $drop_files = false) { if (!empty($theme_id) && self::get_theme_existed($theme_id)) { $default_theme = self::get_default_theme(); if (self::get_theme($theme_id)->get_id() !== $default_theme) { PersistenceContext::get_querier()->update(DB_TABLE_MEMBER, array('theme' => $default_theme), 'WHERE theme=:old_theme', array('old_theme' => $theme_id)); ThemesConfig::load()->remove_theme_by_id($theme_id); ThemesConfig::save(); if ($drop_files) { $folder = new Folder(PATH_TO_ROOT . '/templates/' . $theme_id); $folder->delete(); } AppContext::get_cache_service()->clear_css_cache(); } } }
protected function save() { if ($this->is_apc_available()) { if ($this->form->get_value('enable_apc')) { DataStoreFactory::set_apc_enabled(true); } else { DataStoreFactory::set_apc_enabled(false); } } if ($this->form->get_value('enable_css_cache')) { $this->css_cache_config->enable(); } else { $this->css_cache_config->disable(); } if (!$this->form->field_is_disabled('level_css_cache')) { $this->css_cache_config->set_optimization_level($this->form->get_value('level_css_cache')->get_raw_value()); } CSSCacheConfig::save(); AppContext::get_cache_service()->clear_css_cache(); }