mx error check

This commit is contained in:
kremsy 2014-01-14 13:57:10 +01:00 committed by Steffen Schröder
parent 2a44665668
commit 8dfed19991

View File

@ -161,12 +161,19 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
// $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil // $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil
$mapInfo = $this->get_file($url); $mapInfo = $this->get_file($url);
// TODO errors
/* if($mapInfo === false) {
* if ($file === false) { $this->error = 'Connection or response error on ' . $url; return array(); } elseif ($file === -1) { $this->error = $this->error = 'Connection or response error on ' . $url;
* 'Timed out while reading data from ' . $url; return array(); } elseif ($file == '') { if (empty($maps)) { $this->error = 'No data returned return array();
* from ' . $url; return array(); } else { break; } } } elseif($mapInfo === -1) {
*/ $this->error = 'Timed out while reading data from ' . $url;
return array();
} elseif($mapInfo == '') {
if(empty($maps)) {
$this->error = 'No data returned from ' . $url;
return array();
}
}
$mxMapList = json_decode($mapInfo); $mxMapList = json_decode($mapInfo);
if($mxMapList === null) { if($mxMapList === null) {
@ -224,12 +231,18 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
// $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil // $mapInfo = FileUtil::loadFile($url, "application/json"); //TODO use mc fileutil
$mapInfo = $this->get_file($url); $mapInfo = $this->get_file($url);
// TODO errors if($mapInfo === false) {
/* $this->error = 'Connection or response error on ' . $url;
* if ($file === false) { $this->error = 'Connection or response error on ' . $url; return array(); } elseif ($file === -1) { $this->error = return array();
* 'Timed out while reading data from ' . $url; return array(); } elseif ($file == '') { if (empty($maps)) { $this->error = 'No data returned } elseif($mapInfo === -1) {
* from ' . $url; return array(); } else { break; } } $this->error = 'Timed out while reading data from ' . $url;
*/ return array();
} elseif($mapInfo == '') {
if(empty($maps)) {
$this->error = 'No data returned from ' . $url;
return array();
}
}
$mxMapList = json_decode($mapInfo); $mxMapList = json_decode($mapInfo);
if($mxMapList === null) { if($mxMapList === null) {