improvements on mx class
This commit is contained in:
parent
bafd167506
commit
57a6f40b74
@ -31,6 +31,8 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
|||||||
const SEARCH_ORDER_LENGHT_SHORTEST = 14;
|
const SEARCH_ORDER_LENGHT_SHORTEST = 14;
|
||||||
const SEARCH_ORDER_LENGHT_LONGEST = 15;
|
const SEARCH_ORDER_LENGHT_LONGEST = 15;
|
||||||
const MAPS_PER_MX_FETCH = 10;
|
const MAPS_PER_MX_FETCH = 10;
|
||||||
|
|
||||||
|
const MX_CHAR_LIMIT = 250;
|
||||||
/**
|
/**
|
||||||
* Private Propertieswc
|
* Private Propertieswc
|
||||||
*/
|
*/
|
||||||
@ -120,21 +122,24 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
|
|||||||
$map->lastUpdate = strtotime($changed);
|
$map->lastUpdate = strtotime($changed);
|
||||||
|
|
||||||
if($mxId != 0) {
|
if($mxId != 0) {
|
||||||
$mapIdString .= $mxId . ',';
|
$appendString = $mxId . ',';
|
||||||
//Set the mx id to the mxidmapvektor
|
//Set the mx id to the mxidmapvektor
|
||||||
$this->mxIdUidVector[$mxId] = $map->uid;
|
$this->mxIdUidVector[$mxId] = $map->uid;
|
||||||
} else {
|
} else {
|
||||||
$mapIdString .= $map->uid . ',';
|
$appendString = $map->uid . ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
$id++;
|
$id++;
|
||||||
|
|
||||||
//if($id % self::MAPS_PER_MX_FETCH == 0) {
|
//If Max Maplimit is reached, or string gets too long send the request
|
||||||
if($id % 6 == 0) { //TODO 6 is temporary
|
if(($id % self::MAPS_PER_MX_FETCH == 0) || ((strlen($mapIdString) + strlen($appendString)) > self::MX_CHAR_LIMIT)) {
|
||||||
$maps = $this->getMaplistByMixedUidIdString($mapIdString);
|
$maps = $this->getMaplistByMixedUidIdString($mapIdString);
|
||||||
$this->updateMapObjectsWithManiaExchangeIds($maps);
|
$this->updateMapObjectsWithManiaExchangeIds($maps);
|
||||||
$mapIdString = '';
|
$mapIdString = '';
|
||||||
|
$id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mapIdString .= $appendString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mapIdString != '') {
|
if($mapIdString != '') {
|
||||||
|
Loading…
Reference in New Issue
Block a user