Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
deactivate_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('active');
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 foreach ($plugins as $plugin) {
30  if (!$plugin->isActive()) {
31  continue;
32  }
33 
34  if (!$plugin->deactivate()) {
35  $msg = $plugin->getError();
36  $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
37  register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
38  }
39 }
40 
41 // don't regenerate the simplecache because the plugin won't be
42 // loaded until next run. Just invalidate and let it regnerate as needed
44 
$plugin
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
$string
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:2029
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:316
elgg_get_plugins($status= 'active', $site_guid=null)
Returns an ordered list of plugins.
Definition: plugins.php:132
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
$guids
elgg_flush_caches()
Flush all the registered caches.
Definition: cache.php:225