function SandboxManagerBase::destroy

Same name and namespace in other branches
  1. 11.x core/modules/package_manager/src/SandboxManagerBase.php \Drupal\package_manager\SandboxManagerBase::destroy()

Releases the stage lock and marks the stage as available.

The sandbox directory is not deleted; it persists on disk for reuse by future stage operations. Cleanup of stale sandbox directories is handled by cron based on the configured maximum age.

Parameters

bool $force: (optional) If TRUE, the stage will be released even if it is not owned by the current user or session. Defaults to FALSE.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $message: (optional) A message about why the stage was released.

Throws

\Drupal\package_manager\Exception\SandboxException If the staged changes are being applied to the active directory.

\Drupal\Core\TempStore\TempStoreException

2 calls to SandboxManagerBase::destroy()
SandboxManagerBase::create in core/modules/package_manager/src/SandboxManagerBase.php
Copies the active code base into the stage directory.
SandboxManagerBase::require in core/modules/package_manager/src/SandboxManagerBase.php
Adds or updates packages in the sandbox directory.

File

core/modules/package_manager/src/SandboxManagerBase.php, line 587

Class

SandboxManagerBase
Creates and manages a sandbox directory in which to install or update code.

Namespace

Drupal\package_manager

Code

public function destroy(bool $force = FALSE, ?TranslatableMarkup $message = NULL) : void {
  if (!$force) {
    $this->checkOwnership();
  }
  if ($this->isApplying()) {
    throw new SandboxException($this, 'Cannot destroy the stage directory while it is being applied to the active directory.');
  }
  $this->storeDestroyInfo($force, $message);
  $this->markAsAvailable();
}

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