/** * Disables the views file paths disk cache. * * Uses the 'viewpath_cache_enabled' datalist with a boolean value. * Resets the views paths cache. * * @return null */ function elgg_disable_filepath_cache() { global $CONFIG; datalist_set('viewpath_cache_enabled', 0); $CONFIG->viewpath_cache_enabled = 0; elgg_filepath_cache_reset(); }
* @uses array $_REQUEST['activated_plugin_guids'] Array of plugin guids to activate. * * @since 1.8 * @package Elgg.Core * @subpackage Administration.Plugins */ $active_plugin_guids = get_input('active_plugin_guids', array()); $installed_plugins = elgg_get_plugins('any'); $success = TRUE; foreach ($installed_plugins as $plugin) { // this is only for simple plugins. if ($plugin->getManifest()->getAdminInterface() != 'simple') { continue; } // only effect changes to plugins not already in that state. if ($plugin->isActive() && !in_array($plugin->guid, $active_plugin_guids)) { $success = $success && $plugin->deactivate(); } elseif (!$plugin->isActive() && in_array($plugin->guid, $active_plugin_guids)) { $success = $success && $plugin->activate(); } } if ($success) { //system_message(elgg_echo('admin:plugins:simple_simple_success')); } else { register_error(elgg_echo('admin:plugins:simple_simple_fail')); } // 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_filepath_cache_reset(); forward(REFERER);
/** * Regenerates the list of known plugins and saves it to the current site * * Important: You should regenerate simplecache and the viewpath cache after executing this function * otherwise you may experience view display artifacts. Do this with the following code: * * elgg_view_regenerate_simplecache(); * elgg_filepath_cache_reset(); * * @param array $pluginorder Optionally, a list of existing plugins and their orders * @return array The new list of plugins and their orders */ function regenerate_plugin_list($pluginorder = false) { global $CONFIG; $CONFIG->pluginlistcache = null; if ($site = get_entity($CONFIG->site_guid)) { if (empty($pluginorder)) { $pluginorder = $site->pluginorder; $pluginorder = unserialize($pluginorder); } else { ksort($pluginorder); } if (empty($pluginorder)) { $pluginorder = array(); } $max = 0; if (sizeof($pluginorder)) { foreach ($pluginorder as $key => $plugin) { if (is_dir($CONFIG->pluginspath . "/" . $plugin)) { if ($key > $max) { $max = $key; } } else { unset($pluginorder[$key]); } } } // Add new plugins to the end if ($handle = opendir($CONFIG->pluginspath)) { while ($mod = readdir($handle)) { if (!in_array($mod, array('.', '..', '.svn', 'CVS')) && is_dir($CONFIG->pluginspath . "/" . $mod)) { if (!in_array($mod, $pluginorder)) { $max = $max + 10; $pluginorder[$max] = $mod; } } } } ksort($pluginorder); // Now reorder the keys .. $key = 10; $plugins = array(); if (sizeof($pluginorder)) { foreach ($pluginorder as $plugin) { $plugins[$key] = $plugin; $key = $key + 10; } } $plugins = serialize($plugins); $site->pluginorder = $plugins; // Regenerate caches elgg_view_regenerate_simplecache(); elgg_filepath_cache_reset(); return $plugins; } return false; }