diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index 426dd5e3c..5e35e0049 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -103,19 +103,29 @@ class CrashDump{ private function extraData(){ global $arguments; - $this->data["parameters"] = (array) $arguments; - $this->data["server.properties"] = @file_get_contents($this->server->getDataPath() . "server.properties"); - $this->data["server.properties"] = preg_replace("#^rcon\\.password=(.*)$#m", "rcon.password=******", $this->data["server.properties"]); - $this->data["pocketmine.yml"] = @file_get_contents($this->server->getDataPath() . "pocketmine.yml"); + + if($this->server->getProperty("auto-report.send-settings", true) !== false){ + $this->data["parameters"] = (array) $arguments; + $this->data["server.properties"] = @file_get_contents($this->server->getDataPath() . "server.properties"); + $this->data["server.properties"] = preg_replace("#^rcon\\.password=(.*)$#m", "rcon.password=******", $this->data["server.properties"]); + $this->data["pocketmine.yml"] = @file_get_contents($this->server->getDataPath() . "pocketmine.yml"); + }else{ + $this->data["pocketmine.yml"] = ""; + $this->data["server.properties"] = ""; + $this->data["parameters"] = []; + } $extensions = []; foreach(get_loaded_extensions() as $ext){ $extensions[$ext] = phpversion($ext); } $this->data["extensions"] = $extensions; - ob_start(); - phpinfo(); - $this->data["phpinfo"] = ob_get_contents(); - ob_end_clean(); + + if($this->server->getProperty("auto-report.send-phpinfo", true) !== false){ + ob_start(); + phpinfo(); + $this->data["phpinfo"] = ob_get_contents(); + ob_end_clean(); + } } private function baseCrash(){ @@ -162,7 +172,7 @@ class CrashDump{ $this->addLine(); $this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN"); $this->data["plugin"] = true; - + $reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase"); $file = $reflection->getProperty("file"); $file->setAccessible(true); @@ -181,11 +191,15 @@ class CrashDump{ $this->addLine(); $this->addLine("Code:"); $this->data["code"] = []; - $file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES); - for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10; ++$l){ - $this->addLine("[" . ($l + 1) . "] " . @$file[$l]); - $this->data["code"][$l + 1] = @$file[$l]; + + if($this->server->getProperty("auto-report.send-code", true) !== false){ + $file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES); + for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10; ++$l){ + $this->addLine("[" . ($l + 1) . "] " . @$file[$l]); + $this->data["code"][$l + 1] = @$file[$l]; + } } + $this->addLine(); $this->addLine("Backtrace:"); foreach(($this->data["trace"] = $error["trace"]) as $line){ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 2906bf985..bca6a9e52 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1792,8 +1792,8 @@ class Server{ $this->logger->emergency("An unrecoverable error has occurred and the server has crashed. Creating a crash dump"); $dump = new CrashDump($this); - if($this->getProperty("settings.send-crash", true) !== false){ - $reply = Utils::postURL("http://crash.pocketmine.net/submit/api", [ + if($this->getProperty("auto-report.enabled", true) !== false){ + $reply = Utils::postURL("http://".$this->getProperty("auto-report.host", "crash.pocketmine.net")."/submit/api", [ "report" => "yes", "name" => "PocketMine-MP ".$this->getPocketMineVersion(), "email" => "crash@pocketmine.net", diff --git a/src/pocketmine/resources/pocketmine.yml b/src/pocketmine/resources/pocketmine.yml index d1aecc4ba..a0ebd31a9 100644 --- a/src/pocketmine/resources/pocketmine.yml +++ b/src/pocketmine/resources/pocketmine.yml @@ -10,7 +10,6 @@ settings: advanced-cache: false upnp-forwarding: false send-usage: true - send-crash: true async-workers: 4 debug: @@ -44,6 +43,13 @@ spawn-limits: water-animals: 5 ambient: 15 +auto-report: #Send crash reports for processing + enabled: true + send-code: true + send-settings: true + send-phpinfo: true + host: crash.pocketmine.net + auto-updater: enabled: true on-update: