mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
Added extra crash dump settings, added way to disable parts of it or change the host
This commit is contained in:
parent
b10e63b951
commit
10c67a57a7
@ -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){
|
||||
|
@ -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",
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user