本文整理汇总了PHP中elgg_reset_system_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_reset_system_cache函数的具体用法?PHP elgg_reset_system_cache怎么用?PHP elgg_reset_system_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_reset_system_cache函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subsite_manager_fix_piwik_settings
function subsite_manager_fix_piwik_settings()
{
global $SUBSITE_MANAGER_IGNORE_WRITE_ACCESS;
if (subsite_manager_on_subsite()) {
$site = elgg_get_site_entity();
if ($piwik_settings = $site->phloor_analytics_piwik_settings) {
$SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = true;
if ($site->canEdit()) {
// log to the error log that we did something
error_log("PIWIK saving settings for " . $site->name . " (" . $site->getGUID() . ")");
error_log("PIWIK settings: " . $piwik_settings);
if ($piwik_settings = json_decode($piwik_settings, true)) {
if (!empty($piwik_settings) && is_array($piwik_settings)) {
$enabled = elgg_extract("enable_tracking", $piwik_settings);
$piwik_url = elgg_extract("path_to_piwik", $piwik_settings);
$piwik_site_id = elgg_extract("site_guid", $piwik_settings);
if ($enabled == "true") {
if (!empty($piwik_url) && !empty($piwik_site_id)) {
// check if analytics is enabled
if (!elgg_is_active_plugin("analytics")) {
// not active so enable
if ($plugin = elgg_get_plugin_from_id("analytics")) {
$plugin->activate();
elgg_invalidate_simplecache();
elgg_reset_system_cache();
}
}
// save settings, if not exists
if (!elgg_get_plugin_setting("piwik_url", "analytics") && !elgg_get_plugin_setting("piwik_site_id", "analytics")) {
elgg_set_plugin_setting("piwik_url", $piwik_url, "analytics");
elgg_set_plugin_setting("piwik_site_id", $piwik_site_id, "analytics");
}
}
}
}
}
// remove the settings so we don't do this again
unset($site->phloor_analytics_piwik_settings);
}
// unset write access
$SUBSITE_MANAGER_IGNORE_WRITE_ACCESS = false;
}
}
}
示例2: run
/**
* Run the upgrade process
*
* @return array
*/
public function run()
{
$result = array('failure' => false, 'reason' => '');
// prevent someone from running the upgrade script in parallel (see #4643)
if (!$this->getUpgradeMutex()) {
$result['failure'] = true;
$result['reason'] = _elgg_services()->translator->translate('upgrade:locked');
return $result;
}
// disable the system log for upgrades to avoid exceptions when the schema changes.
_elgg_services()->events->unregisterHandler('log', 'systemlog', 'system_log_default_logger');
_elgg_services()->events->unregisterHandler('all', 'all', 'system_log_listener');
// turn off time limit
set_time_limit(0);
if ($this->getUnprocessedUpgrades()) {
$this->processUpgrades();
}
_elgg_services()->events->trigger('upgrade', 'system', null);
elgg_invalidate_simplecache();
elgg_reset_system_cache();
$this->releaseUpgradeMutex();
return $result;
}
示例3: foreach
}
foreach ($plugin_guids as $guid) {
$plugin = get_entity($guid);
if (!$plugin instanceof ElggPlugin) {
register_error(elgg_echo('admin:plugins:deactivate:no', array($guid)));
continue;
}
if ($plugin->deactivate()) {
//system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName())));
} else {
$msg = $plugin->getError();
$string = $msg ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
}
// don't regenerate the simplecache because the plugin won't be
// loaded until next run. Just invalidate and let it regnerate as needed
elgg_invalidate_simplecache();
elgg_reset_system_cache();
if (count($plugin_guids) == 1) {
$url = 'admin/plugins';
$query = (string) parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY);
if ($query) {
$url .= "?{$query}";
}
$plugin = get_entity($plugin_guids[0]);
$id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
forward("{$url}#{$id}");
} else {
forward(REFERER);
}
示例4: elgg_filepath_cache_reset
/**
* @access private
* @deprecated 1.9 Use elgg_reset_system_cache()
*/
function elgg_filepath_cache_reset()
{
elgg_deprecated_notice(__FUNCTION__ . ' is deprecated by elgg_reset_system_cache()', 1.9);
elgg_reset_system_cache();
}
示例5: subsite_manager_sync_plugins
/**
* Sync the plugins for a specific subsite
*
* @param ElggSite $subsite
*
* @return array ($sorted, $activated) number of sorted and activated plugins.
*/
function subsite_manager_sync_plugins(Subsite $subsite)
{
$main_site = elgg_get_config('site');
$plugins_by_id_map = elgg_get_config('plugins_by_id_map');
$global_order = subsite_manager_get_main_plugin_order();
$global_plugins_active = subsite_manager_get_global_enabled_plugins();
// pretend to be on the subsite
elgg_set_config('site', $subsite);
elgg_set_config('site_guid', $subsite->guid);
elgg_set_config('plugins_by_id_map', array());
// make sure all plugins exist in the database
elgg_generate_plugin_entities();
// mark plugins to activate
$private_setting = $subsite->getPrivateSetting('subsite_manager_plugins_activate');
if (isset($private_setting)) {
$to_activate = unserialize($private_setting);
} else {
$to_activate = array();
}
$sorted = 0;
$activated = 0;
// reorder plugins according to global order and activate global plugins
$plugins = subsite_manager_get_plugins();
foreach ($plugins as $plugin) {
$priority = array_search($plugin->getID(), $global_order) + 1;
if ($priority === false) {
$priority = 'last';
}
$priority_name = elgg_namespace_plugin_private_setting('internal', 'priority');
if ($plugin->get($priority_name) != $priority) {
$plugin->set($priority_name, $priority);
$sorted++;
}
if (!$plugin->isActive() && in_array($plugin->getID(), $global_plugins_active)) {
if (!in_array($plugin->getID(), $to_activate)) {
$to_activate[] = $plugin->getID();
$activated++;
}
}
}
$subsite->setPrivateSetting('subsite_manager_plugins_activate', serialize($to_activate));
// clean the caches
elgg_invalidate_simplecache();
elgg_reset_system_cache();
// restore original "main" site
elgg_set_config('site', $main_site);
elgg_set_config('site_guid', $main_site->guid);
elgg_set_config('plugins_by_id_map', $plugins_by_id_map);
return array($sorted, $activated);
}
示例6: upgrade
/**
* Elgg upgrade script.
*
* This script triggers any necessary upgrades. If the site has been upgraded
* to the most recent version of the code, no upgrades are run but the caches
* are flushed.
*
* Upgrades use a table {db_prefix}upgrade_lock as a mutex to prevent concurrent upgrades.
*
* The URL to forward to after upgrades are complete can be specified by setting $_GET['forward']
* to a relative URL.
*
* @return void
*/
public static function upgrade()
{
// we want to know if an error occurs
ini_set('display_errors', 1);
define('UPGRADING', 'upgrading');
self::start();
$site_url = elgg_get_config('url');
$site_host = parse_url($site_url, PHP_URL_HOST) . '/';
// turn any full in-site URLs into absolute paths
$forward_url = get_input('forward', '/admin', false);
$forward_url = str_replace(array($site_url, $site_host), '/', $forward_url);
if (strpos($forward_url, '/') !== 0) {
$forward_url = '/' . $forward_url;
}
if (get_input('upgrade') == 'upgrade') {
$upgrader = new \Elgg\UpgradeService();
$result = $upgrader->run();
if ($result['failure'] == true) {
register_error($result['reason']);
forward($forward_url);
}
} else {
$rewriteTester = new \ElggRewriteTester();
$url = elgg_get_site_url() . "__testing_rewrite?__testing_rewrite=1";
if (!$rewriteTester->runRewriteTest($url)) {
// see if there is a problem accessing the site at all
// due to ip restrictions for example
if (!$rewriteTester->runLocalhostAccessTest()) {
// note: translation may not be available until after upgrade
$msg = elgg_echo("installation:htaccess:localhost:connectionfailed");
if ($msg === "installation:htaccess:localhost:connectionfailed") {
$msg = "Elgg cannot connect to itself to test rewrite rules properly. Check " . "that curl is working and there are no IP restrictions preventing " . "localhost connections.";
}
echo $msg;
exit;
}
// note: translation may not be available until after upgrade
$msg = elgg_echo("installation:htaccess:needs_upgrade");
if ($msg === "installation:htaccess:needs_upgrade") {
$msg = "You must update your .htaccess file so that the path is injected " . "into the GET parameter __elgg_uri (you can use install/config/htaccess.dist as a guide).";
}
echo $msg;
exit;
}
$vars = array('forward' => $forward_url);
// reset cache to have latest translations available during upgrade
elgg_reset_system_cache();
echo elgg_view_page(elgg_echo('upgrading'), '', 'upgrade', $vars);
exit;
}
forward($forward_url);
}
示例7: elgg_disable_system_cache
/**
* Disables the system disk cache.
*
* Uses the 'system_cache_enabled' datalist with a boolean value.
* Resets the system cache.
*
* @return void
*/
function elgg_disable_system_cache()
{
global $CONFIG;
datalist_set('system_cache_enabled', 0);
$CONFIG->system_cache_enabled = 0;
elgg_reset_system_cache();
}
示例8: setMenuConfig
/**
* Saves the menu configuration
*
* @param array $config configuration of menu items
*/
public function setMenuConfig($config = [])
{
elgg_set_plugin_setting("menu_{$this->name}_config", json_encode($config), 'menu_builder');
elgg_reset_system_cache();
}
示例9: elgg_filepath_cache_reset
/**
* @access private
*/
function elgg_filepath_cache_reset()
{
return elgg_reset_system_cache();
}
示例10: disable
/**
* Disables the system disk cache.
*
* Uses the 'system_cache_enabled' datalist with a boolean value.
* Resets the system cache.
*
* @return void
*/
function disable()
{
_elgg_services()->datalist->set('system_cache_enabled', 0);
$this->CONFIG->system_cache_enabled = 0;
elgg_reset_system_cache();
}
示例11: subsite_manager_ready_system_handler
/**
* This event will be triggered when plugin are reordered in in 'boot' 'system'
*
* @param string $event
* @param string $type
* @param mixed $entity
*/
function subsite_manager_ready_system_handler($event, $type, $entity)
{
elgg_reset_system_cache();
elgg_invalidate_simplecache();
}