Elgg  Version 3.0
deactivate_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('active');
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 foreach ($plugins as $plugin) {
27  if (!$plugin->isActive()) {
28  continue;
29  }
30 
31  if (!$plugin->deactivate()) {
32  $msg = $plugin->getError();
33  $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
34 
35  return elgg_error_response(elgg_echo($string, [$plugin->getDisplayName(), $msg]));
36  }
37 }
38 
39 return elgg_ok_response();
$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
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
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
Disable all specified installed plugins.