Resolved #151 MX Map update check failed

This commit is contained in:
kremsy 2017-06-21 19:06:26 +02:00
parent 652f46703b
commit ba67ea6911
2 changed files with 11 additions and 4 deletions

View File

@ -367,6 +367,8 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$this->maniaControl->getMapManager()->getMXManager()->fetchManiaExchangeMapInformation($map); $this->maniaControl->getMapManager()->getMXManager()->fetchManiaExchangeMapInformation($map);
$map->lastUpdate = time(); $map->lastUpdate = time();
//Update Map Timestamp in Database
$this->maniaControl->getMapManager()->updateMapTimestamp($map->uid);
// Message // Message
$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; $message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!';

View File

@ -215,12 +215,13 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
* @param string $uid * @param string $uid
* @return bool * @return bool
*/ */
private function updateMapTimestamp($uid) { public function updateMapTimestamp($uid) {
$mysqli = $this->maniaControl->getDatabase()->getMysqli(); $mysqli = $this->maniaControl->getDatabase()->getMysqli();
//TODO mxid was set to 0, verify what for
$mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET $mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET
mxid = 0, `changed` = NOW()
changed = NOW() WHERE `uid` LIKE ?";
WHERE 'uid' = ?";
$mapStatement = $mysqli->prepare($mapQuery); $mapStatement = $mysqli->prepare($mapQuery);
if ($mysqli->error) { if ($mysqli->error) {
trigger_error($mysqli->error); trigger_error($mysqli->error);
@ -471,7 +472,11 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
$this->maniaControl->getChat()->sendError('Server Error!', $login); $this->maniaControl->getChat()->sendError('Server Error!', $login);
return; return;
} }
$map->lastUpdate = time(); $map->lastUpdate = time();
//Update TimeStamp in Database
$this->updateMapTimestamp($mapInfo->uid);
//TODO messages for communication //TODO messages for communication
if ($login) { if ($login) {