/** * 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_regenerate_simplecache(); * elgg_reset_system_cache(); * * @deprecated 1.8 Use elgg_generate_plugin_entities() and elgg_set_plugin_priorities() * * @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) { $msg = 'regenerate_plugin_list() is (sorta) deprecated by elgg_generate_plugin_entities() and' . ' elgg_set_plugin_priorities().'; elgg_deprecated_notice($msg, 1.8); // they're probably trying to set it? if ($pluginorder) { if (_elgg_generate_plugin_entities()) { // sort the plugins by the index numerically since we used // weird indexes in the old system. ksort($pluginorder, SORT_NUMERIC); return _elgg_set_plugin_priorities($pluginorder); } return false; } else { // they're probably trying to regenerate from disk? return _elgg_generate_plugin_entities(); } }
/** * Reindexes all plugin priorities starting at 1. * * @todo Can this be done in a single sql command? * @return bool * @access private */ function reindexPriorities() { return _elgg_set_plugin_priorities(array()); }
$r = update_data($q); // rewrite all plugin:setting:* to ELGG_PLUGIN_USER_SETTING_PREFIX . * $q = "UPDATE {$db_prefix}private_settings\n\tSET name = replace(name, 'plugin:settings:', '" . ELGG_PLUGIN_USER_SETTING_PREFIX . "')\n\tWHERE name LIKE 'plugin:settings:%'"; $r = update_data($q); // grab current plugin GUIDs to add a temp priority $q = "SELECT * FROM {$db_prefix}entities e\n\tJOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid\n\tWHERE e.type = 'object' AND e.subtype = {$plugin_subtype_id}"; $plugins = get_data($q); foreach ($plugins as $plugin) { $priority = _elgg_namespace_plugin_private_setting('internal', 'priority'); set_private_setting($plugin->guid, $priority, 0); } // force regenerating plugin entities _elgg_generate_plugin_entities(); // set the priorities for all plugins // this function rewrites it to a normal index so use the current one. _elgg_set_plugin_priorities($old_plugin_order); // add relationships for enabled plugins if ($old_enabled_plugins) { // they might only have one plugin enabled. if (!is_array($old_enabled_plugins)) { $old_enabled_plugins = array($old_enabled_plugins); } // sometimes there were problems and you'd get 1000s of enabled plugins. $old_enabled_plugins = array_unique($old_enabled_plugins); foreach ($old_enabled_plugins as $plugin_id) { $plugin = elgg_get_plugin_from_id($plugin_id); if ($plugin) { $plugin->activate(); } } }