Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Site / StatusCommand.php
index c07a758dd1bb35c851c68de214bc2ce176f283dd..be38be1aa2120b3fbacb6b78cb8a10f0a085f107 100644 (file)
@@ -10,10 +10,8 @@ namespace Drupal\Console\Command\Site;
 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;
@@ -24,10 +22,8 @@ use Drupal\Core\Extension\ThemeHandler;
  *
  *  @category site
  */
-class StatusCommand extends Command
+class StatusCommand extends ContainerAwareCommand
 {
-    use ContainerAwareCommandTrait;
-
     /* @var $connectionInfoKeys array */
     protected $connectionInfoKeys = [
       'driver',
@@ -80,7 +76,7 @@ class StatusCommand extends Command
      * @param $appRoot
      */
     public function __construct(
-        SystemManager $systemManager,
+        SystemManager $systemManager = null,
         Settings $settings,
         ConfigFactory $configFactory,
         ThemeHandler $themeHandler,
@@ -108,7 +104,8 @@ class StatusCommand extends Command
                 InputOption::VALUE_OPTIONAL,
                 $this->trans('commands.site.status.options.format'),
                 'table'
-            );
+            )
+            ->setAliases(['ss']);
     }
 
     /**
@@ -119,8 +116,6 @@ class StatusCommand extends Command
         // 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();
@@ -136,7 +131,7 @@ class StatusCommand extends Command
         $format = $input->getOption('format');
 
         if ('table' === $format) {
-            $this->showDataAsTable($io, $siteData);
+            $this->showDataAsTable($siteData);
         }
 
         if ('json' === $format) {
@@ -169,7 +164,7 @@ class StatusCommand extends Command
             } 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();
         }
 
@@ -209,8 +204,8 @@ class StatusCommand extends Command
 
         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'),
           ],
         ];
     }
@@ -238,30 +233,30 @@ class StatusCommand extends Command
 
         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');
         }
     }
 }