Fixed double loading of PluginDescription

closes #4593
closes #6723
This commit is contained in:
Dylan K. Taylor 2025-06-08 19:09:12 +01:00
parent 215da7e3f4
commit 6b5ff5016e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
5 changed files with 7 additions and 13 deletions

View File

@ -41,12 +41,9 @@ class FolderPluginLoader implements PluginLoader{
/** /**
* Loads the plugin contained in $file * Loads the plugin contained in $file
*/ */
public function loadPlugin(string $path) : void{ public function loadPlugin(string $path, PluginDescription $description) : void{
$description = $this->getPluginDescription($path);
if($description !== null){
$this->loader->addPath($description->getSrcNamespacePrefix(), "$path/src"); $this->loader->addPath($description->getSrcNamespacePrefix(), "$path/src");
} }
}
/** /**
* Gets the PluginDescription from the file * Gets the PluginDescription from the file

View File

@ -42,12 +42,9 @@ class PharPluginLoader implements PluginLoader{
/** /**
* Loads the plugin contained in $file * Loads the plugin contained in $file
*/ */
public function loadPlugin(string $path) : void{ public function loadPlugin(string $path, PluginDescription $description) : void{
$description = $this->getPluginDescription($path);
if($description !== null){
$this->loader->addPath($description->getSrcNamespacePrefix(), "$path/src"); $this->loader->addPath($description->getSrcNamespacePrefix(), "$path/src");
} }
}
/** /**
* Gets the PluginDescription from the file * Gets the PluginDescription from the file

View File

@ -36,7 +36,7 @@ interface PluginLoader{
/** /**
* Loads the plugin contained in $file * Loads the plugin contained in $file
*/ */
public function loadPlugin(string $path) : void; public function loadPlugin(string $path, PluginDescription $description) : void;
/** /**
* Gets the PluginDescription from the file * Gets the PluginDescription from the file

View File

@ -150,7 +150,7 @@ class PluginManager{
} }
$prefixed = $loader->getAccessProtocol() . $path; $prefixed = $loader->getAccessProtocol() . $path;
$loader->loadPlugin($prefixed); $loader->loadPlugin($prefixed, $description);
$mainClass = $description->getMain(); $mainClass = $description->getMain();
if(!class_exists($mainClass, true)){ if(!class_exists($mainClass, true)){

View File

@ -46,7 +46,7 @@ class ScriptPluginLoader implements PluginLoader{
/** /**
* Loads the plugin contained in $file * Loads the plugin contained in $file
*/ */
public function loadPlugin(string $path) : void{ public function loadPlugin(string $path, PluginDescription $description) : void{
include_once $path; include_once $path;
} }