Skip to content
Snippets Groups Projects

Issue #3508631: Refactor Project Data Fetching into a new Window-Scoped QueryManager

Compare and
12 files
+ 227
63
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -25,8 +25,8 @@ final class ModuleActivator implements InstructionsInterface, TasksInterface {
public function __construct(
private readonly ModuleInstallerInterface $moduleInstaller,
private readonly ModuleExtensionList $moduleList,
private readonly ModuleHandlerInterface $moduleHandler,
private ModuleExtensionList $moduleList,
private ModuleHandlerInterface $moduleHandler,
private readonly FileUrlGeneratorInterface $fileUrlGenerator,
private readonly RequestStack $requestStack,
private readonly AccountInterface $currentUser,
@@ -36,7 +36,7 @@ final class ModuleActivator implements InstructionsInterface, TasksInterface {
* {@inheritdoc}
*/
public function getStatus(Project $project): ActivationStatus {
if (array_key_exists($project->machineName, $this->moduleList->getAllInstalledInfo())) {
if ($this->moduleHandler->moduleExists($project->machineName)) {
return ActivationStatus::Active;
}
elseif (array_key_exists($project->machineName, $this->moduleList->getAllAvailableInfo())) {
@@ -57,6 +57,14 @@ final class ModuleActivator implements InstructionsInterface, TasksInterface {
*/
public function activate(Project $project): null {
$this->moduleInstaller->install([$project->machineName]);
// The container has changed, so we need to reload the module handler and
// module list from the global service wrapper.
// @phpstan-ignore-next-line
$this->moduleHandler = \Drupal::moduleHandler();
// @phpstan-ignore-next-line
$this->moduleList = \Drupal::service(ModuleExtensionList::class);
return NULL;
}
Loading