use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Core\Command\ContainerAwareCommand;
use Drupal\Core\State\StateInterface;
use Drupal\Console\Core\Utils\ChainQueue;
-class MaintenanceCommand extends Command
+class MaintenanceCommand extends ContainerAwareCommand
{
- use ContainerAwareCommandTrait;
-
-
/**
* @var StateInterface
*/
->addArgument(
'mode',
InputArgument::REQUIRED,
- $this->trans('commands.site.maintenance.arguments.mode').'[on/off]'
- );
+ $this->trans('commands.site.maintenance.arguments.mode')
+ )
+ ->setAliases(['sma']);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$mode = $input->getArgument('mode');
$stateName = 'system.maintenance_mode';
$modeMessage = null;
$cacheRebuild = false;
}
- $io->info($this->trans($modeMessage));
+ $this->getIo()->info($this->trans($modeMessage));
if ($cacheRebuild) {
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);