You are here

public function Logger::uninstall in MongoDB 8

Drop the logger collections.

Return value

int The number of collections dropped.

File

src/Logger/Logger.php, line 141
Logger functionality (watchdog).

Class

Logger
MongoDB logger implementation for watchdog().

Namespace

Drupal\mongodb\Logger

Code

public function uninstall() {
  $count = 0;
  $collections = $this
    ->listCollections();
  foreach ($collections as $collection) {
    $name = $collection
      ->getName();
    if (preg_match(static::EVENT_COLLECTIONS_PATTERN, $name)) {
      $status = $collection
        ->drop();
      if ($status['ok'] == 1) {
        ++$count;
      }
    }
  }
  $status = $this->message_templates
    ->drop();
  if ($status['ok'] == 1) {
    ++$count;
  }
  return $count;
}