SanityCheckCommand.php in MongoDB 8.2
File
modules/mongodb_watchdog/src/Command/SanityCheckCommand.php
View source
<?php
declare (strict_types=1);
namespace Drupal\mongodb_watchdog\Command;
use Drupal\Component\Serialization\Yaml;
use Drupal\Console\Annotations\DrupalCommand;
use Drupal\Console\Core\Command\ContainerAwareCommand;
use Drupal\mongodb_watchdog\Install\SanityCheck;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SanityCheckCommand extends ContainerAwareCommand {
protected $sanityCheck;
protected $yaml;
public function __construct(Sanitycheck $sanityCheck, Yaml $yaml) {
parent::__construct();
$this->sanityCheck = $sanityCheck;
$this->yaml = $yaml;
}
protected function configure() : void {
$this
->setName('mongodb:watchdog:sanitycheck')
->setDescription($this
->trans('commands.mongodb.watchdog.sanitycheck.description'))
->setHelp($this
->trans('commands.mongodb.watchdog.sanitycheck.help'))
->setAliases([
'mdbwsc',
'mowd-sc',
]);
}
protected function execute(InputInterface $input, OutputInterface $output) : void {
$buckets = $this->sanityCheck
->buildCollectionstats();
$this
->getIo()
->writeln($this->yaml
->encode($buckets));
}
}
Classes
Name |
Description |
SanityCheckCommand |
Class SanityCheckCommand provides the mongodb:watchdog:sanitycheck command. |