You are here

class MongoDbWatchdogCommands in MongoDB 8.2

Drush 9 commands service for the mongodb_watchdog module.

Hierarchy

Expanded class hierarchy of MongoDbWatchdogCommands

1 string reference to 'MongoDbWatchdogCommands'
drush.services.yml in modules/mongodb_watchdog/drush.services.yml
modules/mongodb_watchdog/drush.services.yml
1 service uses MongoDbWatchdogCommands
mongodb_watchdog.commands in modules/mongodb_watchdog/drush.services.yml
\Drupal\mongodb_watchdog\Commands\MongoDbWatchdogCommands

File

modules/mongodb_watchdog/src/Commands/MongoDbWatchdogCommands.php, line 13

Namespace

Drupal\mongodb_watchdog\Commands
View source
class MongoDbWatchdogCommands extends DrushCommands {

  /**
   * The mongodb.watchdog.sanity_check service.
   *
   * @var \Drupal\mongodb_watchdog\Install\SanityCheck
   */
  protected $sanityCheck;

  /**
   * MongodbWatchdogCommands constructor.
   *
   * @param \Drupal\mongodb_watchdog\Install\SanityCheck $sanityCheck
   *   The mongodb.watchdog.sanity_check service.
   */
  public function __construct(SanityCheck $sanityCheck) {
    $this->sanityCheck = $sanityCheck;
  }

  /**
   * Run a sanity check on the contents of the logger database in MongoDB.
   *
   * @param array $options
   *   A Drush-magic parameter enabling Drush to choose the output format.
   *
   * @return array
   *   An array of collection by document count range. A high number of single
   *   document collections is a hint of a problem with the application code
   *   using the logger subsystem.
   *
   * @usage mongodb:watchdog:sanitycheck
   *   Report on the site of the event collections, per size bucket.
   *
   * The "unused" $options allows Drush to know the command should support the
   * --format option, with the chosen default.
   *
   * @command mongodb:watchdog:sanitycheck
   * @aliases mdbwsc,mowd-sc
   */
  public function sanityCheck(array $options = [
    'format' => 'yaml',
  ]) : array {
    return $this->sanityCheck
      ->buildCollectionstats();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MongoDbWatchdogCommands::$sanityCheck protected property The mongodb.watchdog.sanity_check service.
MongoDbWatchdogCommands::sanityCheck public function Run a sanity check on the contents of the logger database in MongoDB.
MongoDbWatchdogCommands::__construct public function MongodbWatchdogCommands constructor.