function PackageManagerUninstallValidator::validate
Determines the reasons a module can not be uninstalled.
Parameters
string $module: A module name.
Return value
string[] An array of reasons the module can not be uninstalled, empty if it can. Each reason should not end with any punctuation since multiple reasons can be displayed together.
Overrides ModuleUninstallValidatorInterface::validate
File
-
core/
modules/ package_manager/ src/ PackageManagerUninstallValidator.php, line 46
Class
- PackageManagerUninstallValidator
- Prevents any module from being uninstalled if update is in process.
Namespace
Drupal\package_managerCode
public function validate($module) {
$sandbox_manager = new class ($this->pathLocator, $this->beginner, $this->stager, $this->committer, $this->queueFactory, $this->eventDispatcher, $this->sharedTempStoreFactory, $this->time, $this->pathFactory, $this->failureMarker) extends SandboxManagerBase {
};
$reasons = [];
if (!$sandbox_manager->isAvailable() && $sandbox_manager->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.