From 4b662d65b3c47996cdaf27f1d02638d54f0b6e32 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 2 Jun 2022 16:29:22 +0100 Subject: [PATCH] PluginManager: check graylist before doing any loadability checks fixes #5087 --- src/plugin/PluginManager.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugin/PluginManager.php b/src/plugin/PluginManager.php index 36dcd9195..2fbe3bb71 100644 --- a/src/plugin/PluginManager.php +++ b/src/plugin/PluginManager.php @@ -270,6 +270,17 @@ class PluginManager{ $name = $description->getName(); + if($this->graylist !== null && !$this->graylist->isAllowed($name)){ + $this->server->getLogger()->notice($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError( + $name, + $this->graylist->isWhitelist() ? KnownTranslationFactory::pocketmine_plugin_disallowedByWhitelist() : KnownTranslationFactory::pocketmine_plugin_disallowedByBlacklist() + ))); + //this does NOT increment loadErrorCount, because using the graylist to prevent a plugin from + //loading is not considered accidental; this is the same as if the plugin were manually removed + //this means that the server will continue to boot even if some plugins were blocked by graylist + continue; + } + if(($loadabilityError = $loadabilityChecker->check($description)) !== null){ $this->server->getLogger()->critical($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError($name, $loadabilityError))); $loadErrorCount++; @@ -286,17 +297,6 @@ class PluginManager{ $this->server->getLogger()->warning($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_spacesDiscouraged($name))); } - if($this->graylist !== null && !$this->graylist->isAllowed($name)){ - $this->server->getLogger()->notice($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_loadError( - $name, - $this->graylist->isWhitelist() ? KnownTranslationFactory::pocketmine_plugin_disallowedByWhitelist() : KnownTranslationFactory::pocketmine_plugin_disallowedByBlacklist() - ))); - //this does NOT increment loadErrorCount, because using the graylist to prevent a plugin from - //loading is not considered accidental; this is the same as if the plugin were manually removed - //this means that the server will continue to boot even if some plugins were blocked by graylist - continue; - } - $triage->plugins[$name] = new PluginLoadTriageEntry($file, $loader, $description); $triage->softDependencies[$name] = array_merge($triage->softDependencies[$name] ?? [], $description->getSoftDepend());