From ba67ea6911bfbb1e41c196b257603e9ab47fb36a Mon Sep 17 00:00:00 2001 From: kremsy Date: Wed, 21 Jun 2017 19:06:26 +0200 Subject: [PATCH] Resolved #151 MX Map update check failed --- core/Maps/DirectoryBrowser.php | 2 ++ core/Maps/MapManager.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/Maps/DirectoryBrowser.php b/core/Maps/DirectoryBrowser.php index 233144df..589761fb 100644 --- a/core/Maps/DirectoryBrowser.php +++ b/core/Maps/DirectoryBrowser.php @@ -367,6 +367,8 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $this->maniaControl->getMapManager()->getMXManager()->fetchManiaExchangeMapInformation($map); $map->lastUpdate = time(); + //Update Map Timestamp in Database + $this->maniaControl->getMapManager()->updateMapTimestamp($map->uid); // Message $message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; diff --git a/core/Maps/MapManager.php b/core/Maps/MapManager.php index c2514627..645ce786 100644 --- a/core/Maps/MapManager.php +++ b/core/Maps/MapManager.php @@ -215,12 +215,13 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform * @param string $uid * @return bool */ - private function updateMapTimestamp($uid) { + public function updateMapTimestamp($uid) { $mysqli = $this->maniaControl->getDatabase()->getMysqli(); + //TODO mxid was set to 0, verify what for $mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET - mxid = 0, - changed = NOW() - WHERE 'uid' = ?"; + `changed` = NOW() + WHERE `uid` LIKE ?"; + $mapStatement = $mysqli->prepare($mapQuery); if ($mysqli->error) { trigger_error($mysqli->error); @@ -471,7 +472,11 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform $this->maniaControl->getChat()->sendError('Server Error!', $login); return; } + $map->lastUpdate = time(); + //Update TimeStamp in Database + $this->updateMapTimestamp($mapInfo->uid); + //TODO messages for communication if ($login) {