private function updateGeocacheAfterLogRemove(GeoCacheLog $log, OcDb $db) { $geoCache = $log->getGeoCache(); if ($log->getType() == GeoCacheLog::LOGTYPE_FOUNDIT || $log->getType() == GeoCacheLog::LOGTYPE_ATTENDED) { $geoCache->setFounds($geoCache->getFounds() - 1); } elseif ($log->getType() == GeoCacheLog::LOGTYPE_DIDNOTFIND || $log->getType() == 8) { $geoCache->setNotFounds($geoCache->getNotFounds() - 1); } elseif ($log->getType() == GeoCacheLog::LOGTYPE_COMMENT) { $geoCache->setNotesCount($geoCache->getNotesCount() - 1); } //Update last found $lastfoundQuery = "SELECT MAX(`cache_logs`.`date`) AS `date` FROM `cache_logs` WHERE ((cache_logs.`type`=1) AND (cache_logs.`cache_id`= :1 ))"; $s = $db->multiVariableQuery($lastfoundQuery, $geoCache->getCacheId()); $lastfoundRecord = $db->dbResultFetchOneRowOnly($s); if ($lastfoundRecord['date'] === NULL) { $lastFound = null; } else { $lastFound = $lastfoundRecord['date']; } $geoCache->setLastFound($lastFound)->updateGeocacheLogenteriesStats(); }