mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 00:29:54 +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(){
|
private function extraData(){
|
||||||
global $arguments;
|
global $arguments;
|
||||||
$this->data["parameters"] = (array) $arguments;
|
|
||||||
$this->data["server.properties"] = @file_get_contents($this->server->getDataPath() . "server.properties");
|
if($this->server->getProperty("auto-report.send-settings", true) !== false){
|
||||||
$this->data["server.properties"] = preg_replace("#^rcon\\.password=(.*)$#m", "rcon.password=******", $this->data["server.properties"]);
|
$this->data["parameters"] = (array) $arguments;
|
||||||
$this->data["pocketmine.yml"] = @file_get_contents($this->server->getDataPath() . "pocketmine.yml");
|
$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 = [];
|
$extensions = [];
|
||||||
foreach(get_loaded_extensions() as $ext){
|
foreach(get_loaded_extensions() as $ext){
|
||||||
$extensions[$ext] = phpversion($ext);
|
$extensions[$ext] = phpversion($ext);
|
||||||
}
|
}
|
||||||
$this->data["extensions"] = $extensions;
|
$this->data["extensions"] = $extensions;
|
||||||
ob_start();
|
|
||||||
phpinfo();
|
if($this->server->getProperty("auto-report.send-phpinfo", true) !== false){
|
||||||
$this->data["phpinfo"] = ob_get_contents();
|
ob_start();
|
||||||
ob_end_clean();
|
phpinfo();
|
||||||
|
$this->data["phpinfo"] = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function baseCrash(){
|
private function baseCrash(){
|
||||||
@ -162,7 +172,7 @@ class CrashDump{
|
|||||||
$this->addLine();
|
$this->addLine();
|
||||||
$this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN");
|
$this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN");
|
||||||
$this->data["plugin"] = true;
|
$this->data["plugin"] = true;
|
||||||
|
|
||||||
$reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase");
|
$reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase");
|
||||||
$file = $reflection->getProperty("file");
|
$file = $reflection->getProperty("file");
|
||||||
$file->setAccessible(true);
|
$file->setAccessible(true);
|
||||||
@ -181,11 +191,15 @@ class CrashDump{
|
|||||||
$this->addLine();
|
$this->addLine();
|
||||||
$this->addLine("Code:");
|
$this->addLine("Code:");
|
||||||
$this->data["code"] = [];
|
$this->data["code"] = [];
|
||||||
$file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES);
|
|
||||||
for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10; ++$l){
|
if($this->server->getProperty("auto-report.send-code", true) !== false){
|
||||||
$this->addLine("[" . ($l + 1) . "] " . @$file[$l]);
|
$file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES);
|
||||||
$this->data["code"][$l + 1] = @$file[$l];
|
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();
|
||||||
$this->addLine("Backtrace:");
|
$this->addLine("Backtrace:");
|
||||||
foreach(($this->data["trace"] = $error["trace"]) as $line){
|
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");
|
$this->logger->emergency("An unrecoverable error has occurred and the server has crashed. Creating a crash dump");
|
||||||
$dump = new CrashDump($this);
|
$dump = new CrashDump($this);
|
||||||
|
|
||||||
if($this->getProperty("settings.send-crash", true) !== false){
|
if($this->getProperty("auto-report.enabled", true) !== false){
|
||||||
$reply = Utils::postURL("http://crash.pocketmine.net/submit/api", [
|
$reply = Utils::postURL("http://".$this->getProperty("auto-report.host", "crash.pocketmine.net")."/submit/api", [
|
||||||
"report" => "yes",
|
"report" => "yes",
|
||||||
"name" => "PocketMine-MP ".$this->getPocketMineVersion(),
|
"name" => "PocketMine-MP ".$this->getPocketMineVersion(),
|
||||||
"email" => "crash@pocketmine.net",
|
"email" => "crash@pocketmine.net",
|
||||||
|
@ -10,7 +10,6 @@ settings:
|
|||||||
advanced-cache: false
|
advanced-cache: false
|
||||||
upnp-forwarding: false
|
upnp-forwarding: false
|
||||||
send-usage: true
|
send-usage: true
|
||||||
send-crash: true
|
|
||||||
async-workers: 4
|
async-workers: 4
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
@ -44,6 +43,13 @@ spawn-limits:
|
|||||||
water-animals: 5
|
water-animals: 5
|
||||||
ambient: 15
|
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:
|
auto-updater:
|
||||||
enabled: true
|
enabled: true
|
||||||
on-update:
|
on-update:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user