[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/console/command/db/ -> list_command.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\db;
  14  
  15  use Symfony\Component\Console\Input\InputInterface;
  16  use Symfony\Component\Console\Input\InputOption;
  17  use Symfony\Component\Console\Output\OutputInterface;
  18  use Symfony\Component\Console\Style\SymfonyStyle;
  19  
  20  class list_command extends \phpbb\console\command\db\migration_command
  21  {
  22  	protected function configure()
  23      {
  24          $this
  25              ->setName('db:list')
  26              ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_LIST'))
  27              ->addOption(
  28                  'available',
  29                  'u',
  30                  InputOption::VALUE_NONE,
  31                  $this->user->lang('CLI_MIGRATIONS_ONLY_AVAILABLE')
  32              )
  33          ;
  34      }
  35  
  36  	protected function execute(InputInterface $input, OutputInterface $output)
  37      {
  38          $io = new SymfonyStyle($input, $output);
  39  
  40          $show_installed = !$input->getOption('available');
  41          $installed = $available = array();
  42  
  43          foreach ($this->load_migrations() as $name)
  44          {
  45              if ($this->migrator->migration_state($name) !== false)
  46              {
  47                  $installed[] = $name;
  48              }
  49              else
  50              {
  51                  $available[] = $name;
  52              }
  53          }
  54  
  55          if ($show_installed)
  56          {
  57              $io->section($this->user->lang('CLI_MIGRATIONS_INSTALLED'));
  58  
  59              if (!empty($installed))
  60              {
  61                  $io->listing($installed);
  62              }
  63              else
  64              {
  65                  $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
  66                  $io->newLine();
  67              }
  68          }
  69  
  70          $io->section($this->user->lang('CLI_MIGRATIONS_AVAILABLE'));
  71          if (!empty($available))
  72          {
  73              $io->listing($available);
  74          }
  75          else
  76          {
  77              $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
  78              $io->newLine();
  79          }
  80      }
  81  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1