diff --git a/compile_php.sh b/compile_php.sh index 7a7bc25d1..b1538e089 100644 --- a/compile_php.sh +++ b/compile_php.sh @@ -15,12 +15,12 @@ DIR=`pwd` date > "$DIR/install.log" 2>&1 uname -a >> "$DIR/install.log" 2>&1 echo "[INFO] Checking dependecies" -type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; exit 1; } -type autoconf >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; exit 1; } -type automake >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; exit 1; } -type libtool >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"libtool\""; exit 1; } -type gcc >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"gcc\""; exit 1; } -type m4 >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; exit 1; } +type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; read -p "Press [Enter] to continue..."; exit 1; } +type autoconf >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; read -p "Press [Enter] to continue..."; exit 1; } +type automake >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; read -p "Press [Enter] to continue..."; exit 1; } +type libtool >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"libtool\""; read -p "Press [Enter] to continue..."; exit 1; } +type gcc >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"gcc\""; read -p "Press [Enter] to continue..."; exit 1; } +type m4 >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; read -p "Press [Enter] to continue..."; exit 1; } rm -r -f install_data/ >> "$DIR/install.log" 2>&1 rm -r -f php5/ >> "$DIR/install.log" 2>&1 diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index 1e9f58a77..e73d49ef3 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -229,7 +229,7 @@ class ServerAPI{ "protocol" => CURRENT_PROTOCOL, "online" => count($this->server->clients), "max" => $this->server->maxClients, - )); + ), 10); } public function __destruct(){ diff --git a/src/Async.php b/src/Async.php index fe3f62034..b25c245a3 100644 --- a/src/Async.php +++ b/src/Async.php @@ -26,9 +26,6 @@ the Free Software Foundation, either version 3 of the License, or */ class Async extends Thread { - /** - * Provide a passthrough to call_user_func_array - **/ public function __construct($method, $params = array()){ $this->method = $method; $this->params = $params; @@ -36,9 +33,6 @@ class Async extends Thread { $this->joined = false; } - /** - * The smallest thread in the world - **/ public function run(){ if(($this->result=call_user_func_array($this->method, $this->params))){ return true; @@ -47,21 +41,15 @@ class Async extends Thread { } } - /** - * Static method to create your threads from functions ... - **/ public static function call($method, $params = array()){ $thread = new Async($method, $params); if($thread->start()){ return $thread; - } /** else throw Nastyness **/ + } } - /** - * Do whatever, result stored in $this->result, don't try to join twice - **/ public function __toString(){ - if(!$this->joined) { + if(!$this->joined){ $this->joined = true; $this->join(); } diff --git a/src/utils/Utils.php b/src/utils/Utils.php index baa23a81a..df549dcf3 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -354,10 +354,11 @@ class Utils extends Thread{ return microtime(true); } - public static function curl_get($page){ + public static function curl_get($page, $timeout = 10){ if(Utils::$online === false){ return false; } + $ch = curl_init($page); curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP")); curl_setopt($ch, CURLOPT_AUTOREFERER, true); @@ -365,7 +366,7 @@ class Utils extends Thread{ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int) $timeout); $ret = curl_exec($ch); curl_close($ch); return $ret; @@ -375,6 +376,7 @@ class Utils extends Thread{ if(Utils::$online === false){ return false; } + $ch = curl_init($page); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $args);