Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions modules/system/classes/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,6 @@ public function registerPlugin(PluginBase $plugin, ?string $pluginId = null): vo
View::addNamespace($pluginNamespace, $viewsPath);
}

/*
* Register namespace aliases for any replaced plugins
*/
if ($replaces = $plugin->getReplaces()) {
foreach ($replaces as $replace) {
$replaceNamespace = $this->getNamespace($replace);

$this->app->make(ClassLoader::class)->addNamespaceAliases([
// class_alias() expects order to be $real, $alias
$this->getNamespace($pluginId) => $replaceNamespace,
]);
}
}

/**
* Disable plugin registration for restricted pages, unless elevated
*/
Expand Down Expand Up @@ -734,6 +720,12 @@ protected function registerPluginReplacements(): void
foreach ($this->replacementMap as $target => $replacement) {
// Alias the replaced plugin to the replacing plugin
$this->aliasPluginAs($replacement, $target);

// Register namespace aliases for any replaced plugins
$this->app->make(ClassLoader::class)->addNamespaceAliases([
// class_alias() expects order to be $real, $alias
$this->getNamespace($replacement) => $this->getNamespace($target),
]);
}
}

Expand Down