Example #1
0
/**
 * Retrieve the contents of the filepath cache.
 *
 * @param string $type The type of cache to load
 * @return string
 */
function elgg_filepath_cache_load($type)
{
    global $CONFIG;
    if ($CONFIG->viewpath_cache_enabled) {
        $cache = elgg_get_filepath_cache();
        $cached_data = $cache->load($type);
        if ($cached_data) {
            return $cached_data;
        }
    }
    return NULL;
}
Example #2
0
/**
 * For now, loads plugins directly
 *
 * @todo Add proper plugin handler that launches plugins in an admin-defined order and activates them on admin request
 * @package Elgg
 * @subpackage Core
 */
function load_plugins()
{
    global $CONFIG;
    $cache = elgg_get_filepath_cache();
    if (!empty($CONFIG->pluginspath)) {
        // See if we have cached values for things
        $cached_view_paths = $cache->load('view_paths');
        if ($cached_view_paths) {
            $CONFIG->views = unserialize($cached_view_paths);
        }
        // temporary disable all plugins if there is a file called 'disabled' in the plugin dir
        if (file_exists($CONFIG->pluginspath . "disabled")) {
            return;
        }
        $plugins = get_plugin_list();
        if (sizeof($plugins)) {
            foreach ($plugins as $mod) {
                if (is_plugin_enabled($mod)) {
                    if (file_exists($CONFIG->pluginspath . $mod)) {
                        if (!(include $CONFIG->pluginspath . $mod . "/start.php")) {
                            throw new PluginException(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod));
                        }
                        if (!$cached_view_paths) {
                            if (is_dir($CONFIG->pluginspath . $mod . "/views")) {
                                if ($handle = opendir($CONFIG->pluginspath . $mod . "/views")) {
                                    while ($viewtype = readdir($handle)) {
                                        if (!in_array($viewtype, array('.', '..', '.svn', 'CVS')) && is_dir($CONFIG->pluginspath . $mod . "/views/" . $viewtype)) {
                                            autoregister_views("", $CONFIG->pluginspath . $mod . "/views/" . $viewtype, $CONFIG->pluginspath . $mod . "/views/", $viewtype);
                                        }
                                    }
                                }
                            }
                        }
                        if (is_dir($CONFIG->pluginspath . $mod . "/languages")) {
                            register_translations($CONFIG->pluginspath . $mod . "/languages/");
                        }
                    }
                }
            }
        }
        // Cache results
        if (!$cached_view_paths) {
            $cache->save('view_paths', serialize($CONFIG->views));
        }
    }
}
/**
 * Plugin Installer (this is a copy of enable actions of core)
 * 
 * @package plugin_installer
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
// block non-admin users
admin_gatekeeper();
// Validate the action
action_gatekeeper();
// Get the plugin
$plugin = get_input('plugin');
if (!is_array($plugin)) {
    $plugin = array($plugin);
}
foreach ($plugin as $p) {
    // Re enable
    if (disable_plugin($p) && enable_plugin($p)) {
        system_message(sprintf(elgg_echo('plugin_installer:plugin_admin:reactivate:yes'), $p));
    } else {
        register_error(sprintf(elgg_echo('plugin_installer:plugin_admin:reactivate:no'), $p));
    }
}
elgg_view_regenerate_simplecache();
$cache = elgg_get_filepath_cache();
$cache->delete('view_paths');
forward($vars['url'] . "pg/admin/plugins/");
exit;
/**
 * Retrieve the contents of the filepath cache.
 *
 */
function elgg_filepath_cache_load()
{
    global $CONFIG;
    if ($CONFIG->viewpath_cache_enabled) {
        $cache = elgg_get_filepath_cache();
        $cached_view_paths = $cache->load('view_paths');
        if ($cached_view_paths) {
            return $cached_view_paths;
        }
    }
    return NULL;
}