[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/phpbb/console/command/extension/ -> enable.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  namespace phpbb\console\command\extension;
  14  
  15  use Symfony\Component\Console\Input\InputArgument;
  16  use Symfony\Component\Console\Input\InputInterface;
  17  use Symfony\Component\Console\Output\OutputInterface;
  18  use Symfony\Component\Console\Style\SymfonyStyle;
  19  
  20  class enable extends command
  21  {
  22  	protected function configure()
  23      {
  24          $this
  25              ->setName('extension:enable')
  26              ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION'))
  27              ->addArgument(
  28                  'extension-name',
  29                  InputArgument::REQUIRED,
  30                  $this->user->lang('CLI_EXTENSION_NAME')
  31              )
  32          ;
  33      }
  34  
  35  	protected function execute(InputInterface $input, OutputInterface $output)
  36      {
  37          $io = new SymfonyStyle($input, $output);
  38  
  39          $name = $input->getArgument('extension-name');
  40  
  41          if (!$this->manager->is_available($name))
  42          {
  43              $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name));
  44              return 1;
  45          }
  46  
  47          $extension = $this->manager->get_extension($name);
  48  
  49          if (($enableable = $extension->is_enableable()) !== true)
  50          {
  51              $message = !empty($enableable) ? $enableable : $this->user->lang('CLI_EXTENSION_NOT_ENABLEABLE', $name);
  52              $message = is_array($message) ? implode(PHP_EOL, $message) : $message;
  53              $io->error($message);
  54              return 1;
  55          }
  56  
  57          if ($this->manager->is_enabled($name))
  58          {
  59              $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name));
  60              return 1;
  61          }
  62  
  63          $this->manager->enable($name);
  64          $this->manager->load_extensions();
  65  
  66          if ($this->manager->is_enabled($name))
  67          {
  68              $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
  69              $this->check_apcu_cache($io);
  70              $io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name));
  71              return 0;
  72          }
  73          else
  74          {
  75              $io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name));
  76              return 1;
  77          }
  78      }
  79  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1