function StatusCommand::__invoke

Same name and namespace in other branches
  1. main core/modules/system/src/Command/StatusCommand.php \Drupal\system\Command\StatusCommand::__invoke()

Show system status.

File

core/modules/system/src/Command/StatusCommand.php, line 40

Class

StatusCommand
Prints status information about the site.

Namespace

Drupal\system\Command

Code

public function __invoke(InputInterface $input, OutputInterface $output) : int {
  $io = new SymfonyStyle($input, $output);
  $rows = [
    [
      (string) $this->t('Drupal version') => ': ' . \Drupal::VERSION,
    ],
    [
      (string) $this->t('Site URL') => ': ' . Url::fromRoute('<front>')->setAbsolute()
        ->toString(),
    ],
    [
      (string) $this->t('PHP binary') => ': ' . Path::canonicalize(PHP_BINARY),
    ],
    [
      (string) $this->t('PHP version') => ': ' . PHP_VERSION,
    ],
    [
      (string) $this->t('PHP OS') => ': ' . PHP_OS,
    ],
    [
      (string) $this->t('Default theme') => ': ' . $this->config
        ->get('system.theme')
        ->get('default'),
    ],
    [
      (string) $this->t('Admin theme') => ': ' . $this->config
        ->get('system.theme')
        ->get('admin'),
    ],
  ];
  $io->definitionList(...$rows);
  return Command::SUCCESS;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.