function SandboxDatabaseUpdatesValidator::checkForStagedDatabaseUpdates

Same name and namespace in other branches
  1. main core/modules/package_manager/src/Validator/SandboxDatabaseUpdatesValidator.php \Drupal\package_manager\Validator\SandboxDatabaseUpdatesValidator::checkForStagedDatabaseUpdates()

Checks that the staged update does not have changes to its install files.

Parameters

\Drupal\package_manager\Event\StatusCheckEvent $event: The event object.

File

core/modules/package_manager/src/Validator/SandboxDatabaseUpdatesValidator.php, line 40

Class

SandboxDatabaseUpdatesValidator
Flags a warning if there are database updates in a staged update.

Namespace

Drupal\package_manager\Validator

Code

public function checkForStagedDatabaseUpdates(StatusCheckEvent $event) : void {
  if (!$event->sandboxManager
    ->sandboxDirectoryExists()) {
    return;
  }
  $stage_dir = $event->sandboxManager
    ->getSandboxDirectory();
  $extensions_with_updates = $this->getExtensionsWithDatabaseUpdates($stage_dir);
  if ($extensions_with_updates) {
    // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
    $extensions_with_updates = array_map($this->t(...), $extensions_with_updates);
    $event->addWarning($extensions_with_updates, $this->t('Database updates have been detected in the following extensions.'));
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.