use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
+use Drupal\Console\Core\Command\ContainerAwareCommand;
use Drupal\Core\Database\Database;
-use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\system\SystemManager;
use Drupal\Core\Site\Settings;
use Drupal\Core\Config\ConfigFactory;
*
* @category site
*/
-class StatusCommand extends Command
+class StatusCommand extends ContainerAwareCommand
{
- use ContainerAwareCommandTrait;
-
/* @var $connectionInfoKeys array */
protected $connectionInfoKeys = [
'driver',
* @param $appRoot
*/
public function __construct(
- SystemManager $systemManager,
+ SystemManager $systemManager = null,
Settings $settings,
ConfigFactory $configFactory,
ThemeHandler $themeHandler,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.site.status.options.format'),
'table'
- );
+ )
+ ->setAliases(['ss']);
}
/**
// Make sure all modules are loaded.
$this->container->get('module_handler')->loadAll();
- $io = new DrupalStyle($input, $output);
-
$systemData = $this->getSystemData();
$connectionData = $this->getConnectionData();
$themeInfo = $this->getThemeData();
$format = $input->getOption('format');
if ('table' === $format) {
- $this->showDataAsTable($io, $siteData);
+ $this->showDataAsTable($siteData);
}
if ('json' === $format) {
} catch (\Exception $e) {
$hashSalt = '';
}
- $systemData['system'][$this->trans('commands.site.status.messages.hash_salt')] = $hashSalt;
+ $systemData['system'][$this->trans('commands.site.status.messages.hash-salt')] = $hashSalt;
$systemData['system'][$this->trans('commands.site.status.messages.console')] = $this->getApplication()->getVersion();
}
return [
'theme' => [
- 'theme_default' => $config->get('default'),
- 'theme_admin' => $config->get('admin'),
+ $this->trans('commands.site.status.messages.theme_default') => $config->get('default'),
+ $this->trans('commands.site.status.messages.theme_admin') => $config->get('admin'),
],
];
}
return [
'directory' => [
- $this->trans('commands.site.status.messages.directory_root') => $this->appRoot,
- $this->trans('commands.site.status.messages.directory_temporary') => $systemFile->get('path.temporary'),
- $this->trans('commands.site.status.messages.directory_theme_default') => $themeDefaultDirectory,
- $this->trans('commands.site.status.messages.directory_theme_admin') => $themeAdminDirectory,
+ $this->trans('commands.site.status.messages.directory-root') => $this->appRoot,
+ $this->trans('commands.site.status.messages.directory-temporary') => $systemFile->get('path.temporary'),
+ $this->trans('commands.site.status.messages.directory-theme-default') => $themeDefaultDirectory,
+ $this->trans('commands.site.status.messages.directory-theme-admin') => $themeAdminDirectory,
],
];
}
- protected function showDataAsTable(DrupalStyle $io, $siteData)
+ protected function showDataAsTable($siteData)
{
if (empty($siteData)) {
return [];
}
- $io->newLine();
+ $this->getIo()->newLine();
foreach ($this->groups as $group) {
$tableRows = [];
$groupData = $siteData[$group];
- $io->comment($this->trans('commands.site.status.messages.'.$group));
+ $this->getIo()->comment($this->trans('commands.site.status.messages.'.$group));
foreach ($groupData as $key => $item) {
$tableRows[] = [$key, $item];
}
- $io->table([], $tableRows, 'compact');
+ $this->getIo()->table([], $tableRows, 'compact');
}
}
}