From 173784752ea04b6d49333fc2eefc573d7e0023ee Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Thu, 25 Apr 2013 17:54:32 +0200 Subject: [PATCH] Added GIT_COMMIT to the Error dump --- src/API/ServerAPI.php | 7 +------ src/PocketMinecraftServer.php | 1 + src/config.php | 8 +++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index 0099799c00..cd3c613f42 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -133,11 +133,6 @@ class ServerAPI{ $this->setProperty("server-id", $this->server->serverID); } $this->server->api = $this; - $gitsha1 = false; - if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information! - $gitsha1 = trim(file_get_contents(FILE_PATH.".git/refs/heads/master")); - console("[GIT] Commit \x1b[33m".$gitsha1); - } if($this->getProperty("upnp-forwarding") === true){ console("[INFO] [UPnP] Trying to port forward..."); @@ -155,7 +150,7 @@ class ServerAPI{ console("[ERROR] PocketMine API error"); }else{ $last = $info["development"]["date"]; - if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and $gitsha1 != $info["development"]["commit"]){ + if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and GIT_COMMIT != $info["development"]["commit"]){ console("[NOTICE] \x1b[33mA new DEVELOPMENT version of PocketMine-MP has been released"); console("[NOTICE] \x1b[33mVersion \"".$info["development"]["version"]."\" [".substr($info["development"]["commit"], 0, 10)."]"); console("[NOTICE] \x1b[36mIf you want to update, get the latest version at ".$info["development"]["download"]); diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 8199a50382..15599fa086 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -453,6 +453,7 @@ class PocketMinecraftServer{ $dump .= "\r\n\r\n"; $version = new VersionString(); $dump .= "PM Version: ".$version." #".$version->getNumber()." [Protocol ".CURRENT_PROTOCOL."]\r\n"; + $dump .= "Commit: ".GIT_COMMIT."\r\n"; $dump .= "uname -a: ".php_uname("a")."\r\n"; $dump .= "PHP Version: " .phpversion()."\r\n"; $dump .= "Zend version: ".zend_version()."\r\n"; diff --git a/src/config.php b/src/config.php index eaeb73d249..b64c43c0b6 100644 --- a/src/config.php +++ b/src/config.php @@ -48,4 +48,10 @@ define("CURRENT_STRUCTURE", 5); define("CURRENT_PROTOCOL", 9); define("CURRENT_MINECRAFT_VERSION", "0.6.1 alpha"); define("CURRENT_API_VERSION", 6); -define("CURRENT_PHP_VERSION", "5.5"); \ No newline at end of file +define("CURRENT_PHP_VERSION", "5.5"); +$gitsha1 = false; +if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information! + define(GIT_COMMIT, strtolower(trim(file_get_contents(FILE_PATH.".git/refs/heads/master")))); +}else{ //Unknown :( + define(GIT_COMMIT, str_repeat("00", 20)); +} \ No newline at end of file