mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 21:45:35 +00:00
PluginLoadabilityChecker: fixed logic of extension compatibility check
if the extension doesn't specify any version, we can't do any constraint other than *.
This commit is contained in:
parent
3d9e19546f
commit
0793e7e094
@ -30,6 +30,7 @@ use pocketmine\utils\Utils;
|
|||||||
use pocketmine\utils\VersionString;
|
use pocketmine\utils\VersionString;
|
||||||
use function array_intersect;
|
use function array_intersect;
|
||||||
use function count;
|
use function count;
|
||||||
|
use function extension_loaded;
|
||||||
use function implode;
|
use function implode;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
use function phpversion;
|
use function phpversion;
|
||||||
@ -77,9 +78,13 @@ final class PluginLoadabilityChecker{
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(Utils::stringifyKeys($description->getRequiredExtensions()) as $extensionName => $versionConstrs){
|
foreach(Utils::stringifyKeys($description->getRequiredExtensions()) as $extensionName => $versionConstrs){
|
||||||
|
if(!extension_loaded($extensionName)){
|
||||||
|
return KnownTranslationFactory::pocketmine_plugin_extensionNotLoaded($extensionName);
|
||||||
|
}
|
||||||
$gotVersion = phpversion($extensionName);
|
$gotVersion = phpversion($extensionName);
|
||||||
if($gotVersion === false){
|
if($gotVersion === false){
|
||||||
return KnownTranslationFactory::pocketmine_plugin_extensionNotLoaded($extensionName);
|
//extensions may set NULL as the extension version, in which case phpversion() may return false
|
||||||
|
$gotVersion = "**UNKNOWN**";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($versionConstrs as $k => $constr){ // versionConstrs_loop
|
foreach($versionConstrs as $k => $constr){ // versionConstrs_loop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user