Elgg  Version 2.3
activate_all.php
Go to the documentation of this file.
1 <?php
12 $guids = get_input('guids');
13 
14 if (empty($guids)) {
15  $plugins = elgg_get_plugins('inactive');
16 } else {
17  $plugins = elgg_get_entities([
18  'type' => 'object',
19  'subtype' => 'plugin',
20  'guids' => explode(',', $guids),
21  'limit' => false
22  ]);
23 }
24 
25 if (empty($plugins)) {
27 }
28 
29 do {
30  $additional_plugins_activated = false;
31  foreach ($plugins as $key => $plugin) {
32  if ($plugin->isActive()) {
33  unset($plugins[$key]);
34  continue;
35  }
36 
37  if (!$plugin->activate()) {
38  // plugin could not be activated in this loop, maybe in the next loop
39  continue;
40  }
41 
42  $ids = array(
43  'cannot_start' . $plugin->getID(),
44  'invalid_and_deactivated_' . $plugin->getID()
45  );
46 
47  foreach ($ids as $id) {
49  }
50 
51  // mark that something has changed in this loop
52  $additional_plugins_activated = true;
53  unset($plugins[$key]);
54  }
55 
56  if (!$additional_plugins_activated) {
57  // no updates in this pass, break the loop
58  break;
59  }
60 } while (count($plugins) > 0);
61 
62 if (count($plugins) > 0) {
63  foreach ($plugins as $plugin) {
64  $msg = $plugin->getError();
65  $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
66  register_error(elgg_echo($string, array($plugin->getFriendlyName(), $msg)));
67  }
68 }
69 
70 // don't regenerate the simplecache because the plugin won't be
71 // loaded until next run. Just invalidate and let it regnerate as needed
73 
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:92
$plugin
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:425
$string
$key
Definition: summary.php:34
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2123
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:326
$guids
elgg_get_plugins($status= 'active', $site_guid=null)
Returns an ordered list of plugins.
Definition: plugins.php:132
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:399
if(!$collection_name) $id
Definition: add.php:17
elgg_flush_caches()
Flush all the registered caches.
Definition: cache.php:225