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