Send Usage data again

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-14 16:30:26 +02:00
parent 8442c0529e
commit 69b78a9dd6
2 changed files with 11 additions and 15 deletions

View File

@ -178,7 +178,7 @@ class ConsoleAPI{
} }
if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false
or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){ or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){
$output = "You don't have permissions\n"; $output = "You don't have permission to use this command.\n";
}else{ }else{
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){ if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
$output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias); $output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias);

View File

@ -245,7 +245,6 @@ class ServerAPI{
return false; return false;
} }
$ob = $this->asyncCalls[$id]; $ob = $this->asyncCalls[$id];
$this->asyncCalls[$id] = null;
unset($this->asyncCalls[$id]); unset($this->asyncCalls[$id]);
return $ob; return $ob;
} }
@ -256,19 +255,15 @@ class ServerAPI{
foreach($this->plugin->getList() as $p){ foreach($this->plugin->getList() as $p){
$plist .= str_replace(array(";", ":"), "", $p["name"]).":".str_replace(array(";", ":"), "", $p["version"]).";"; $plist .= str_replace(array(";", ":"), "", $p["name"]).":".str_replace(array(";", ":"), "", $p["version"]).";";
} }
$this->async("Utils::curl_post", array( Utils::curl_post("http://stats.pocketmine.net/usage.php",array(
0 => "http://stats.pocketmine.net/usage.php", "serverid" => $this->server->serverID,
1 => array( "os" => Utils::getOS(),
"serverid" => $this->server->serverID, "version" => MAJOR_VERSION,
"os" => Utils::getOS(), "protocol" => CURRENT_PROTOCOL,
"version" => MAJOR_VERSION, "online" => count($this->server->clients),
"protocol" => CURRENT_PROTOCOL, "max" => $this->server->maxClients,
"online" => count($this->server->clients), "plugins" => $plist,
"max" => $this->server->maxClients, ), 2);
"plugins" => $plist,
),
2 => 10
), true);
} }
public function __destruct(){ public function __destruct(){
@ -343,6 +338,7 @@ class ServerAPI{
if($this->getProperty("send-usage") !== false){ if($this->getProperty("send-usage") !== false){
$this->server->schedule(36000, array($this, "sendUsage"), array(), true); //Send usage data every 30 minutes $this->server->schedule(36000, array($this, "sendUsage"), array(), true); //Send usage data every 30 minutes
$this->server->schedule(6000, array($this, "sendUsage")); //Send the info after 5 minutes have passed $this->server->schedule(6000, array($this, "sendUsage")); //Send the info after 5 minutes have passed
$this->sendUsage();
} }
$this->server->init(); $this->server->init();
unregister_tick_function(array($this->server, "tick")); unregister_tick_function(array($this->server, "tick"));