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;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
PackageManagerUninstallValidator::validate public function Overrides ModuleUninstallValidatorInterface::validate
PackageManagerUninstallValidator::__construct public function
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

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