function SandboxManagerBase::isDirectWrite

Indicates whether the active directory will be changed directly.

This can only happen if direct-write is globally enabled by the `package_manager_allow_direct_write` setting, AND this class explicitly allows it (by adding the AllowDirectWrite attribute).

Return value

bool TRUE if the sandbox manager is operating in direct-write mode, otherwise FALSE.

5 calls to SandboxManagerBase::isDirectWrite()
SandboxManagerBase::apply in core/modules/package_manager/src/SandboxManagerBase.php
Applies staged changes to the active directory.
SandboxManagerBase::claim in core/modules/package_manager/src/SandboxManagerBase.php
Attempts to claim the stage.
SandboxManagerBase::create in core/modules/package_manager/src/SandboxManagerBase.php
Copies the active code base into the stage directory.
SandboxManagerBase::destroy in core/modules/package_manager/src/SandboxManagerBase.php
Deletes the stage directory.
SandboxManagerBase::getSandboxDirectory in core/modules/package_manager/src/SandboxManagerBase.php
Returns the path of the directory where changes should be staged.

File

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

Class

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

Namespace

Drupal\package_manager

Code

public final function isDirectWrite() : bool {
    // The use of direct-write is stored as part of the lock so that it will
    // remain consistent during the sandbox's entire life cycle, even if the
    // underlying global settings are changed.
    if ($this->lock) {
        return $this->lock[3];
    }
    $reflector = new \ReflectionClass($this);
    return Settings::get('package_manager_allow_direct_write', FALSE) && $reflector->getAttributes(AllowDirectWrite::class);
}

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