From b310959fd1676ef12a51dc16103ac9e4fbac6248 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Sep 2017 19:57:38 +0100 Subject: [PATCH 1/2] Added --php parameter to start.ps1 --- start.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/start.ps1 b/start.ps1 index 62dca7128..ef3c1221f 100644 --- a/start.ps1 +++ b/start.ps1 @@ -1,8 +1,11 @@ param ( + [string]$php = "", [switch]$Loop = $false ) -if(Test-Path "bin\php\php.exe"){ +if($php -ne ""){ + $binary = $php +}elseif(Test-Path "bin\php\php.exe"){ $env:PHPRC = "" $binary = "bin\php\php.exe" }else{ From 2215543e39ae47e5e234b706e37892bd6354dbc0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Sep 2017 20:04:19 +0100 Subject: [PATCH 2/2] Fixed not being able to remove logger attachments, closes #1141 --- src/pocketmine/PocketMine.php | 7 +++++++ src/pocketmine/utils/MainLogger.php | 7 +++++-- src/spl | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 43a2d0e4b..33179006d 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -123,6 +123,13 @@ namespace pocketmine { define('pocketmine\PATH', realpath(getcwd()) . DIRECTORY_SEPARATOR); } + $requiredSplVer = "0.0.1"; + if(!is_file(\pocketmine\PATH . "src/spl/version.php") or version_compare($requiredSplVer, require(\pocketmine\PATH . "src/spl/version.php")) > 0){ + echo "[CRITICAL] Incompatible PocketMine-SPL submodule version ($requiredSplVer is required)." . PHP_EOL; + echo "[CRITICAL] Please update your submodules or use provided builds." . PHP_EOL; + exit(1); + } + if(!class_exists("ClassLoader", false)){ if(!is_file(\pocketmine\PATH . "src/spl/ClassLoader.php")){ echo "[CRITICAL] Unable to find the PocketMine-SPL library." . PHP_EOL; diff --git a/src/pocketmine/utils/MainLogger.php b/src/pocketmine/utils/MainLogger.php index 93b20db76..686f68344 100644 --- a/src/pocketmine/utils/MainLogger.php +++ b/src/pocketmine/utils/MainLogger.php @@ -47,6 +47,7 @@ class MainLogger extends \AttachableThreadedLogger{ * @throws \RuntimeException */ public function __construct(string $logFile, bool $logDebug = false){ + parent::__construct(); if(static::$logger instanceof MainLogger){ throw new \RuntimeException("MainLogger has been already created"); } @@ -214,8 +215,10 @@ class MainLogger extends \AttachableThreadedLogger{ echo $message . PHP_EOL; } - if($this->attachment instanceof \ThreadedLoggerAttachment){ - $this->attachment->call($level, $message); + foreach($this->attachments as $attachment){ + if($attachment instanceof \ThreadedLoggerAttachment){ + $attachment->call($level, $message); + } } $this->logStream[] = date("Y-m-d", $now) . " " . $cleanMessage . PHP_EOL; diff --git a/src/spl b/src/spl index a5127b224..c4d484158 160000 --- a/src/spl +++ b/src/spl @@ -1 +1 @@ -Subproject commit a5127b224ec35ef6f54d0eae2a69a02d53842640 +Subproject commit c4d4841586a19d95f25cc02b23baa00dbbc0b0d7