function StageBase::checkOwnership

Validates the ownership of stage directory.

The stage is considered under valid ownership if it was created by current user or session, using the current class.

Throws

\LogicException If ::claim() has not been previously called.

\Drupal\package_manager\Exception\StageOwnershipException If the current user or session does not own the stage directory, or it was created by a different class.

6 calls to StageBase::checkOwnership()
StageBase::apply in core/modules/package_manager/src/StageBase.php
Applies staged changes to the active directory.
StageBase::destroy in core/modules/package_manager/src/StageBase.php
Deletes the stage directory.
StageBase::getMetadata in core/modules/package_manager/src/StageBase.php
Returns a specific piece of metadata associated with this stage.
StageBase::postApply in core/modules/package_manager/src/StageBase.php
Performs post-apply tasks.
StageBase::require in core/modules/package_manager/src/StageBase.php
Adds or updates packages in the stage directory.

... See full list

File

core/modules/package_manager/src/StageBase.php, line 705

Class

StageBase
Creates and manages a stage directory in which to install or update code.

Namespace

Drupal\package_manager

Code

protected final function checkOwnership() : void {
    if (empty($this->lock)) {
        throw new \LogicException('Stage must be claimed before performing any operations on it.');
    }
    $stored_lock = $this->tempStore
        ->getIfOwner(static::TEMPSTORE_LOCK_KEY);
    if ($stored_lock !== $this->lock) {
        throw new StageOwnershipException($this, 'Stage is not owned by the current user or session.');
    }
}

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