Elgg  Version 1.9
activate_all.php
Go to the documentation of this file.
1 <?php
12 $guids = get_input('guids');
13 $guids = explode(',', $guids);
14 
15 $plugins = array();
16 foreach ($guids as $guid) {
17  $plugin = get_entity($guid);
18  if (!$plugin->isActive()) {
19  $plugins[$plugin->getId()] = $plugin;
20  }
21 }
22 
23 do {
24  $additional_plugins_activated = false;
25  foreach ($plugins as $key => $plugin) {
26  if ($plugin->activate()) {
27 
28  $ids = array(
29  'cannot_start' . $plugin->getID(),
30  'invalid_and_deactivated_' . $plugin->getID()
31  );
32 
33  foreach ($ids as $id) {
35  }
36 
37  $additional_plugins_activated = true;
38  unset($plugins[$key]);
39  }
40  }
41  if (!$additional_plugins_activated) {
42  // no updates in this pass, break the loop
43  break;
44  }
45 } while (count($plugins) > 0);
46 
47 if (count($plugins) > 0) {
48  foreach ($plugins as $key => $plugin) {
49  $msg = $plugin->getError();
50  $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
51  register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
52  }
53 }
54 
55 // don't regenerate the simplecache because the plugin won't be
56 // loaded until next run. Just invalidate and let it regnerate as needed
59 
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:116
elgg_reset_system_cache()
Reset the system cache by deleting the caches.
Definition: cache.php:40
$plugin
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_invalidate_simplecache()
Deletes all cached views in the simplecache and sets the lastcache and lastupdate time to 0 for every...
Definition: cache.php:278
$guid
Removes an admin notice.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
$string
$plugins
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$key
Definition: summary.php:34
const REFERER
Definition: elgglib.php:2162
$guids
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
if(!$collection_name) $id
Definition: add.php:17
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604