Example #1
0
 /**
  * Enable a set of default plugins
  *
  * @return void
  */
 protected function enablePlugins()
 {
     _elgg_generate_plugin_entities();
     $plugins = elgg_get_plugins('any');
     foreach ($plugins as $plugin) {
         if ($plugin->getManifest()) {
             if ($plugin->getManifest()->getActivateOnInstall()) {
                 $plugin->activate();
             }
             if (in_array('theme', $plugin->getManifest()->getCategories())) {
                 $plugin->setPriority('last');
             }
         }
     }
 }
<?php

/**
 * Elgg 1.11.2 upgrade 2015062900
 * discussion_plugin
 *
 * Discussion feature was pulled from groups plugin into its
 * own plugin, so we need to update references of subtype
 * 'groupforumtopic' into 'discussion'.
 */
$dbprefix = elgg_get_config('dbprefix');
// Update subtype "groupforumtopic" into "discussion"
update_data("UPDATE {$dbprefix}entity_subtypes\n\tSET subtype = 'discussion'\n\tWHERE type = 'object' AND subtype = 'groupforumtopic'");
// Update river items to use the new view and subtype
update_data("UPDATE {$dbprefix}river\n\tSET view = 'river/object/discussion/create', subtype = 'discussion'\n\tWHERE type = 'object' AND subtype = 'groupforumtopic'");
// Update system log to use the new subtype
update_data("UPDATE {$dbprefix}system_log\n\tSET object_subtype = 'discussion'\n\tWHERE object_type = 'object' AND object_subtype = 'groupforumtopic'");
// If groups plugin is enabled, enable also the discussion plugin
// so the feature won't disappear from groups that are using it.
if (elgg_is_active_plugin('groups')) {
    // Force Elgg to discover the new plugin in plugins directory
    // and create a new \ElggPlugin entity for it so it can be
    // found with elgg_get_plugin_from_id().
    _elgg_generate_plugin_entities();
    $plugin = elgg_get_plugin_from_id('discussions');
    $plugin->activate();
}
Example #3
0
/**
 * 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();
    }
}
Example #4
0
 /**
  * Enable a set of default plugins
  *
  * @return void
  */
 protected function enablePlugins()
 {
     _elgg_generate_plugin_entities();
     $plugins = elgg_get_plugins('any');
     foreach ($plugins as $plugin) {
         if ($plugin->getManifest()) {
             if ($plugin->getManifest()->getActivateOnInstall()) {
                 $plugin->activate();
             }
         }
     }
 }