Checking for GIT now stops the update on the latest version

This commit is contained in:
Shoghi Cervantes Pueyo 2013-03-20 14:51:06 +01:00
parent 518902caf4
commit 4ff9753ede

View File

@ -113,9 +113,10 @@ class ServerAPI{
self::$serverRequest = $this->server; self::$serverRequest = $this->server;
$this->setProperty("server-id", $this->server->serverID); $this->setProperty("server-id", $this->server->serverID);
$this->server->api = $this; $this->server->api = $this;
$gitsha1 = false;
if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information! if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information!
$sha1 = trim(file_get_contents(FILE_PATH.".git/refs/heads/master")); $gitsha1 = trim(file_get_contents(FILE_PATH.".git/refs/heads/master"));
console("[GIT] Commit \x1b[33m".$sha1); console("[GIT] Commit \x1b[33m".$gitsha1);
} }
if($this->getProperty("upnp-forwarding") === true){ if($this->getProperty("upnp-forwarding") === true){
@ -134,7 +135,7 @@ class ServerAPI{
console("[ERROR] PocketMine API error"); console("[ERROR] PocketMine API error");
}else{ }else{
$last = $info["development"]["date"]; $last = $info["development"]["date"];
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false){ if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and $gitsha1 != $info["development"]["commit"]){
console("[NOTICE] \x1b[33mA new DEVELOPMENT version of PocketMine-MP has been released"); 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[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"]); console("[NOTICE] \x1b[36mIf you want to update, get the latest version at ".$info["development"]["download"]);