本文整理汇总了PHP中elgg_invalidate_simplecache函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_invalidate_simplecache函数的具体用法?PHP elgg_invalidate_simplecache怎么用?PHP elgg_invalidate_simplecache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_invalidate_simplecache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ckeditor_extended_plugins_settings_save_action_hook
/**
* Listen to the saving of plugin settings, if the plugin is this plugin invalidate simplecache
*
* @param string $hook 'action'
* @param string $type 'plugins/settings/save'
* @param bool $returnvalue false to stop the action
* @param null $params null
*
* @return void
*/
function ckeditor_extended_plugins_settings_save_action_hook($hook, $type, $returnvalue, $params)
{
$plugin_id = get_input("plugin_id");
if ($plugin_id === "ckeditor_extended") {
elgg_invalidate_simplecache();
}
}
示例2: target_blank_plugins_settings_save_action_hook
/**
* Listen to the saving of plugin settings, if the plugin is this plugin invalidate simplecache
*
* @param string $hook 'action'
* @param string $type 'plugins/settings/save'
* @param bool $returnvalue false to stop the action
* @param null $params null
*
* @return void
*/
function target_blank_plugins_settings_save_action_hook($hook, $type, $returnvalue, $params)
{
$plugin_id = get_input("plugin_id");
if ($plugin_id === "target_blank") {
elgg_invalidate_simplecache();
}
}
示例3: clearCache
/**
* Flushes simple cache after saving the settings
*
* @param string $hook hook name
* @param string $entity_type hook type
* @param bool $returnvalue current return value
* @param array $params parameters
*
* @return bool
*/
public static function clearCache($hook, $entity_type, $returnvalue, $params)
{
$plugin = elgg_extract('plugin', $params);
if (empty($plugin)) {
return;
}
if ($plugin->getID() !== 'event_manager') {
return;
}
elgg_invalidate_simplecache();
}
示例4: rijkshuisstijl_plugins_settings_save
function rijkshuisstijl_plugins_settings_save($hook, $type, $value, $params)
{
if (get_input('plugin_id') !== "rijkshuisstijl") {
return;
}
$params = get_input('params');
$params['colors'] = serialize($params['colors']);
$params['footer'] = serialize($params['footer']);
set_input('params', $params);
// re-render CSS (less)
elgg_invalidate_simplecache();
}
示例5: 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;
}
}
}
示例6: 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;
}
示例7: 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);
}
示例8: follow_tags_setting
/**
* Clear Cache after setting change
*
*/
function follow_tags_setting($hook_name, $entity_type, $return_value, $params)
{
if (!empty($params) && is_array($params)) {
if (($plugin = elgg_extract("plugin", $params)) && $plugin->getID() == "your_plugin_name") {
elgg_invalidate_simplecache();
}
}
}
示例9: unsetAllSettings
/**
* Removes all settings for this plugin.
*
* @todo Should be a better way to do this without dropping to raw SQL.
* @todo If we could namespace the plugin settings this would be cleaner.
* @return bool
*/
public function unsetAllSettings()
{
$db_prefix = get_config('dbprefix');
$ps_prefix = elgg_namespace_plugin_private_setting('internal', '');
$q = "DELETE FROM {$db_prefix}private_settings\n\t\t\tWHERE entity_guid = {$this->guid}\n\t\t\tAND name NOT LIKE '{$ps_prefix}%'\n\t\t\tAND name <> 'path'";
$result = delete_data($q);
// check memcache
if ($result !== false && is_memcache_available()) {
$private_setting_cache = new ElggMemcache("private_settings");
// remove settings from memcache
$private_setting_cache->delete($this->guid);
}
// unvalidate cache to reset to default behaviour
elgg_invalidate_simplecache();
return $result;
}
示例10: saveSiteSettings
/**
* Initialize the site including site entity, plugins, and configuration
*
* @param array $submissionVars Submitted vars
*
* @return bool
*/
protected function saveSiteSettings($submissionVars)
{
global $CONFIG;
// ensure that file path, data path, and www root end in /
$submissionVars['path'] = sanitise_filepath($submissionVars['path']);
$submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
$submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
$site = new ElggSite();
$site->name = $submissionVars['sitename'];
$site->url = $submissionVars['wwwroot'];
$site->access_id = ACCESS_PUBLIC;
$site->email = $submissionVars['siteemail'];
$guid = $site->save();
if (!$guid) {
register_error(elgg_echo('install:error:createsite'));
return FALSE;
}
// bootstrap site info
$CONFIG->site_guid = $guid;
$CONFIG->site = $site;
datalist_set('installed', time());
datalist_set('path', $submissionVars['path']);
datalist_set('dataroot', $submissionVars['dataroot']);
datalist_set('default_site', $site->getGUID());
datalist_set('version', get_version());
datalist_set('simplecache_enabled', 1);
datalist_set('viewpath_cache_enabled', 1);
// new installations have run all the upgrades
$upgrades = elgg_get_upgrade_files($submissionVars['path'] . 'engine/lib/upgrades/');
datalist_set('processed_upgrades', serialize($upgrades));
set_config('view', 'default', $site->getGUID());
set_config('language', 'en', $site->getGUID());
set_config('default_access', $submissionVars['siteaccess'], $site->getGUID());
set_config('allow_registration', TRUE, $site->getGUID());
set_config('walled_garden', FALSE, $site->getGUID());
$this->enablePlugins();
// reset the views path in case of installing over an old data dir.
$dataroot = $submissionVars['dataroot'];
$CONFIG->dataroot = $dataroot;
$cache = new ElggFileCache($dataroot);
$cache->delete('view_paths');
elgg_invalidate_simplecache();
elgg_regenerate_simplecache();
return TRUE;
}
示例11: complete
/**
* Controller for last step
*
* @return void
*/
protected function complete()
{
$params = array();
if ($this->autoLogin) {
$params['destination'] = 'admin';
} else {
$params['destination'] = 'index.php';
}
elgg_invalidate_simplecache();
$this->render('complete', $params);
}
示例12: event_calendar_invalidate_cache
function event_calendar_invalidate_cache($hook, $type, $return, $params)
{
if (isset($params["plugin"]) && $params["plugin"]->getID() == "event_calendar") {
elgg_invalidate_simplecache();
}
}
示例13: 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();
}
示例14: elgg_regenerate_simplecache
/**
* Regenerates the simple cache.
*
* Not required any longer since cached files are created on demand.
*
* @warning This does not invalidate the cache, but actively rebuilds it.
*
* @param string $viewtype Optional viewtype to regenerate. Defaults to all valid viewtypes.
*
* @return void
* @since 1.8.0
* @deprecated 1.9 Use elgg_invalidate_simplecache()
*/
function elgg_regenerate_simplecache($viewtype = NULL)
{
elgg_deprecated_notice(__FUNCTION__ . ' is deprecated by elgg_invalidate_simplecache()', 1.9);
elgg_invalidate_simplecache();
}
示例15: enable
/**
* Enables the simple cache.
*
* @see elgg_register_simplecache_view()
* @return void
*/
function enable()
{
_elgg_services()->datalist->set('simplecache_enabled', 1);
_elgg_services()->config->set('simplecache_enabled', 1);
elgg_invalidate_simplecache();
}