Elgg  Version 3.0
activate_all.php
Go to the documentation of this file.
1 <?php
9 $guids = get_input('guids');
10 
11 if (empty($guids)) {
12  $plugins = elgg_get_plugins('inactive');
13 } else {
15  'type' => 'object',
16  'subtype' => 'plugin',
17  'guids' => explode(',', $guids),
18  'limit' => false,
19  ]);
20 }
21 
22 if (empty($plugins)) {
23  return elgg_ok_response();
24 }
25 
26 do {
27  $additional_plugins_activated = false;
28  foreach ($plugins as $key => $plugin) {
29  if ($plugin->isActive()) {
30  unset($plugins[$key]);
31  continue;
32  }
33 
34  if (!$plugin->activate()) {
35  // plugin could not be activated in this loop, maybe in the next loop
36  continue;
37  }
38 
39  $ids = [
40  'cannot_start' . $plugin->getID(),
41  'invalid_and_deactivated_' . $plugin->getID()
42  ];
43 
44  foreach ($ids as $id) {
46  }
47 
48  // mark that something has changed in this loop
49  $additional_plugins_activated = true;
50  unset($plugins[$key]);
51  }
52 
53  if (!$additional_plugins_activated) {
54  // no updates in this pass, break the loop
55  break;
56  }
57 } while (count($plugins) > 0);
58 
59 if (count($plugins) > 0) {
60  foreach ($plugins as $plugin) {
61  $msg = $plugin->getError();
62  $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
63 
64  return elgg_error_response(elgg_echo($string, [$plugin->getDisplayName(), $msg]));
65  }
66 }
67 
68 return elgg_ok_response();
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:71
$plugin
$plugins
Definition: categories.php:3
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$id
River item delete action.
Definition: delete.php:6
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Definition: entities.php:545
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
elgg_get_plugins($status= 'active')
Returns an ordered list of plugins.
Definition: plugins.php:76
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:55
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
$guids
Activates all specified installed and inactive plugins.
Definition: activate_all.php:9