Elgg  Version 3.0
PluginsDeactivateCommand.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Cli;
4 
8 
13 
14  use PluginsHelper;
15 
19  protected function configure() {
20  $this->setName('plugins:deactivate')
21  ->setDescription('Deactivate plugin(s)')
22  ->addOption('force', 'f', InputOption::VALUE_NONE,
23  'Force deactivation of all dependent plugins'
24  )
25  ->addArgument('plugins', InputArgument::REQUIRED | InputArgument::IS_ARRAY,
26  'Plugin IDs to be deactivated'
27  );
28  }
29 
33  protected function command() {
34 
35  $ids = (array) $this->argument('plugins');
36  $force = (bool) $this->option('force');
37 
38  $helper = _elgg_services()->cli_progress;
39 
40  $progress = $helper->start('Deactivating plugins', count($ids));
41 
42  foreach ($ids as $id) {
43  try {
44  $this->deactivate($id, $force);
45  } catch (\Exception $ex) {
47  }
48 
49  $progress->advance();
50  }
51 
52  $helper->finish($progress);
53 
54  return 0;
55  }
56 }
$id
River item delete action.
Definition: delete.php:6
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:786
Abstract command with some utility methods.
Definition: Command.php:12
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
elgg ajax ERROR
Definition: ajax.js:33
argument($name)
Returns argument value.
option($name)
Returns option value.