class PackageManagerUninstallValidator

Prevents any module from being uninstalled if update is in process.

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.

Hierarchy

Expanded class hierarchy of PackageManagerUninstallValidator

File

core/modules/package_manager/src/PackageManagerUninstallValidator.php, line 26

Namespace

Drupal\package_manager
View source
final class PackageManagerUninstallValidator implements ModuleUninstallValidatorInterface {
    use StringTranslationTrait;
    public function __construct(PathLocator $pathLocator, BeginnerInterface $beginner, StagerInterface $stager, CommitterInterface $committer, QueueFactory $queueFactory, EventDispatcherInterface $eventDispatcher, SharedTempStoreFactory $sharedTempStoreFactory, TimeInterface $time, PathFactoryInterface $pathFactory, FailureMarker $failureMarker) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function validate($module) {
        $stage = new class ($this->pathLocator, $this->beginner, $this->stager, $this->committer, $this->queueFactory, $this->eventDispatcher, $this->sharedTempStoreFactory, $this->time, $this->pathFactory, $this->failureMarker) extends StageBase {

};
        $reasons = [];
        if (!$stage->isAvailable() && $stage->isApplying()) {
            $reasons[] = $this->t('Modules cannot be uninstalled while Package Manager is applying staged changes to the active code base.');
        }
        return $reasons;
    }

}

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