diff --git a/appinfo/info.xml b/appinfo/info.xml index 2990fef7c..a47f79018 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -37,7 +37,7 @@ exif - + diff --git a/css/style.scss b/css/style.scss index 97b1184d6..523237d89 100644 --- a/css/style.scss +++ b/css/style.scss @@ -50,8 +50,8 @@ margin-left: 56px !important; padding-top: 5px; border: 2px solid var(--color-border-dark) !important; - border-bottom-left-radius: var(--border-radius-large) !important; - border-bottom-right-radius: var(--border-radius-large) !important; + border-bottom-left-radius: var(--border-radius-element) !important; + border-bottom-right-radius: var(--border-radius-element) !important; border-top: 0 !important; background-color: var(--color-main-background); } @@ -90,7 +90,7 @@ } td:nth-child(3) { - color: var(--color-text-light); + color: var(--color-main-text); } tr:nth-child(odd) { @@ -132,7 +132,7 @@ .leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar { border: none; - border-radius: var(--border-radius); + border-radius: var(--border-radius-small); } /* Fix attribution overlapping map on mobile */ @@ -461,7 +461,7 @@ tr.selected td { .leaflet-marker-photo-suggestion, .leaflet-marker-photo, .leaflet-marker-photo-suggestion-selected { - border-radius: var(--border-radius); + border-radius: var(--border-radius-small); } .leaflet-marker-track.track-marker, @@ -479,7 +479,7 @@ tr.selected td { .photo-tooltip { max-width: 325px; max-height: 325px; - border-radius: var(--border-radius); + border-radius: var(--border-radius-small); } .easy-button-button { @@ -575,7 +575,7 @@ tr.selected td { text-align: center; } .tooltip-photo-name { - color: var(--color-text-light); + color: var(--color-main-text); } .tooltip-photo-date { font-weight: bold; diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php index 58225c052..1b1e4d747 100644 --- a/lib/Controller/ContactsController.php +++ b/lib/Controller/ContactsController.php @@ -679,7 +679,7 @@ private function setAddressCoordinates(float $lat, float $lng, string $adr, stri $req = $qb->execute(); $result = $req->fetchAll(); $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); if ($result and count($result) > 0) { $id = $result[0]['id']; $qb->update('maps_address_geo') @@ -702,7 +702,8 @@ private function setAddressCoordinates(float $lat, float $lng, string $adr, stri ]); $req = $qb->execute(); $id = $qb->getLastInsertId(); - }$qb = $qb->resetQueryParts(); + } + $qb = $this->dbconnection->getQueryBuilder(); } diff --git a/lib/Service/AddressService.php b/lib/Service/AddressService.php index dc3132a78..e4dc90d1b 100644 --- a/lib/Service/AddressService.php +++ b/lib/Service/AddressService.php @@ -110,7 +110,7 @@ public function lookupAddress($adr, $uri): array { break; } $req->closeCursor(); - $qb = $this->qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); // if it's still not in the DB, it means the lookup did not happen yet // so we can schedule it for later if (!$inDb) { @@ -129,7 +129,7 @@ public function lookupAddress($adr, $uri): array { ->set('looked_up', $qb->createNamedParameter($lookedUp, IQueryBuilder::PARAM_BOOL)) ->where($this->qb->expr()->eq('id', $this->qb->createNamedParameter($id, IQueryBuilder::PARAM_STR))); $req = $this->qb->execute(); - $qb = $this->qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } } @@ -160,7 +160,7 @@ private function lookupAddressInternal($adr): array { $res[2] = true; } $req->closeCursor(); - $qb = $this->qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); return $res; } @@ -257,7 +257,7 @@ private function cleanUpDBContactAddresses($vCard, $uri) { } } $req->closeCursor(); - $qb = $this->qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); foreach ($adrIdToDelete as $id) { $qb->delete('maps_address_geo') @@ -265,7 +265,7 @@ private function cleanUpDBContactAddresses($vCard, $uri) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } } @@ -276,7 +276,7 @@ public function deleteDBContactAddresses($uri) { $qb->expr()->eq('object_uri', $qb->createNamedParameter($uri, IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } // schedules the address for an external lookup @@ -298,7 +298,7 @@ private function scheduleForLookup($adr, $uri): array { ]); $req = $this->qb->execute(); $id = $this->qb->getLastInsertId(); - $qb = $this->qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); if (!$geo[2]) { $this->jobList->add(LookupMissingGeoJob::class, []); } diff --git a/lib/Service/DevicesService.php b/lib/Service/DevicesService.php index db1a3ce72..d6b3b8cc1 100644 --- a/lib/Service/DevicesService.php +++ b/lib/Service/DevicesService.php @@ -73,7 +73,7 @@ public function getDevicesFromDB($userId) { ]; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $devices; } @@ -111,7 +111,7 @@ public function getDevicesByTokens(array $tokens) { } } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $devices; } @@ -163,7 +163,7 @@ public function getDevicePointsFromDB($userId, $deviceId, ?int $pruneBefore = 0, ]; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return array_reverse($points); } @@ -179,18 +179,18 @@ public function getDevicePointsFromDB($userId, $deviceId, ?int $pruneBefore = 0, public function getDevicePointsByTokens(array $tokens, ?int $pruneBefore = 0, ?int $limit = 10000, ?int $offset = 0) { $qb = $this->qb; // get coordinates - $or = $qb->expr()->orX(); + $or = []; foreach ($tokens as $token) { - $and = $qb->expr()->andX(); - $and->add($qb->expr()->eq('s.token', $qb->createNamedParameter($token, IQueryBuilder::PARAM_STR))); - $and->add($qb->expr()->lte('p.timestamp', 's.timestamp_to')); - $and->add($qb->expr()->gte('p.timestamp', 's.timestamp_from')); - $or->add($and); + $or[] = $qb->expr()->andX( + $qb->expr()->eq('s.token', $qb->createNamedParameter($token, IQueryBuilder::PARAM_STR)), + $qb->expr()->lte('p.timestamp', 's.timestamp_to'), + $qb->expr()->gte('p.timestamp', 's.timestamp_from') + ); } $qb->select('p.id', 'lat', 'lng', 'timestamp', 'altitude', 'accuracy', 'battery') ->from('maps_device_points', 'p') ->innerJoin('p', 'maps_device_shares', 's', $qb->expr()->eq('p.device_id', 's.device_id')) - ->where($or); + ->where($qb->expr()->orX(...$or)); if (intval($pruneBefore) > 0) { $qb->andWhere( @@ -219,7 +219,7 @@ public function getDevicePointsByTokens(array $tokens, ?int $pruneBefore = 0, ?i ]; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return array_reverse($points); } @@ -250,7 +250,7 @@ public function getDeviceTimePointsFromDb($userId, $deviceId) { $points[intval($row['timestamp'])] = [floatval($row['lat']), floatval($row['lng'])]; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $points; } @@ -272,7 +272,7 @@ public function getOrCreateDeviceFromDB($userId, $userAgent) { break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); if ($deviceId === null) { $qb->insert('maps_devices') @@ -282,7 +282,7 @@ public function getOrCreateDeviceFromDB($userId, $userAgent) { ]); $req = $qb->execute(); $deviceId = $qb->getLastInsertId(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } return $deviceId; } @@ -301,7 +301,7 @@ public function addPointToDB($deviceId, $lat, $lng, $ts, $altitude, $battery, $a ]); $req = $qb->execute(); $pointId = $qb->getLastInsertId(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $pointId; } @@ -353,7 +353,7 @@ public function getDeviceFromDB($id, $userId) { break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $device; } @@ -370,7 +370,7 @@ public function editDeviceInDB($id, $color, $name) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function deleteDeviceFromDB($id) { @@ -380,14 +380,14 @@ public function deleteDeviceFromDB($id) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); $qb->delete('maps_device_points') ->where( $qb->expr()->eq('device_id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function countPoints($userId, $deviceIdList, $begin, $end) { @@ -423,7 +423,7 @@ public function countPoints($userId, $deviceIdList, $begin, $end) { $count = intval($row['co']); break; } - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $count; } @@ -538,7 +538,7 @@ private function getAndWriteDevicePoints($devid, $begin, $end, $fd, $nbPoints, $ $gpxText .= ' ' . "\n"; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); // write the chunk fwrite($fd, $gpxText); diff --git a/lib/Service/FavoritesService.php b/lib/Service/FavoritesService.php index e2070d576..ba94b1c68 100644 --- a/lib/Service/FavoritesService.php +++ b/lib/Service/FavoritesService.php @@ -108,7 +108,7 @@ public function getFavoritesFromDB($userId, $pruneBefore = 0, $filterCategory = ]; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $favorites; } @@ -160,7 +160,7 @@ public function getFavoriteFromDB($id, $userId = null, $category = null, $isDele break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $favorite; } @@ -181,7 +181,7 @@ public function addFavoriteToDB($userId, $name, $lat, $lng, $category, $comment, ]); $req = $qb->execute(); $favoriteId = $qb->getLastInsertId(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $favoriteId; } @@ -232,7 +232,7 @@ public function renameCategoryInDB($userId, $cat, $newName) { $qb->expr()->eq('category', $qb->createNamedParameter($cat, IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function editFavoriteInDB($id, $name, $lat, $lng, $category, $comment, $extensions) { @@ -262,7 +262,7 @@ public function editFavoriteInDB($id, $name, $lat, $lng, $category, $comment, $e $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function deleteFavoriteFromDB($id) { @@ -272,7 +272,7 @@ public function deleteFavoriteFromDB($id) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function deleteFavoritesFromDB($ids, $userId) { @@ -291,7 +291,7 @@ public function deleteFavoritesFromDB($ids, $userId) { return; } $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function countFavorites($userId, $categoryList, $begin, $end) { @@ -334,7 +334,7 @@ public function countFavorites($userId, $categoryList, $begin, $end) { break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $nbFavorites; } @@ -628,7 +628,7 @@ public function exportFavorites($userId, $fileHandler, $categoryList, $begin, $e $gpxText .= ' ' . "\n"; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); // write the chunk ! fwrite($fileHandler, $gpxText); $favIndex = $favIndex + $chunkSize; diff --git a/lib/Service/TracksService.php b/lib/Service/TracksService.php index 4d8f495f3..63b7d1ee2 100644 --- a/lib/Service/TracksService.php +++ b/lib/Service/TracksService.php @@ -38,7 +38,7 @@ public function __construct( private IL10N $l10n, private IRootFolder $root, private IManager $shareManager, - IDBConnection $dbconnection, + private IDBConnection $dbconnection, ) { $this->qb = $dbconnection->getQueryBuilder(); } @@ -276,7 +276,7 @@ public function getTracksFromDB($userId, $folder = null, bool $respectNomediaAnd $tracks[] = $track; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $tracks; } @@ -367,7 +367,7 @@ public function getTrackFromDB($id, $userId = null) { break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $track; } @@ -418,7 +418,7 @@ public function getTrackByFileIDFromDB($fileId, $userId = null) { break; } $req->closeCursor(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $track; } @@ -435,7 +435,7 @@ public function addTrackToDB($userId, $fileId, $file) { ]); $req = $qb->execute(); $trackId = $qb->getLastInsertId(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); return $trackId; } @@ -455,7 +455,7 @@ public function editTrackInDB($id, $color, $metadata, $etag) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function deleteByFileId($fileId) { @@ -465,7 +465,7 @@ public function deleteByFileId($fileId) { $qb->expr()->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $this->qb = $this->dbconnection->getQueryBuilder(); } public function deleteByFileIdUserId($fileId, $userId) { @@ -478,7 +478,7 @@ public function deleteByFileIdUserId($fileId, $userId) { $qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } public function deleteTrackFromDB($id) { @@ -488,7 +488,7 @@ public function deleteTrackFromDB($id) { $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } public function deleteAllTracksFromDB($userId) { @@ -498,7 +498,7 @@ public function deleteAllTracksFromDB($userId) { $qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } public function deleteTracksFromDB($ids, $userId) { @@ -517,7 +517,7 @@ public function deleteTracksFromDB($ids, $userId) { return; } $req = $qb->execute(); - $qb = $qb->resetQueryParts(); + $qb = $this->dbconnection->getQueryBuilder(); } public function generateTrackMetadata($file) { diff --git a/tests/Unit/Controller/PhotosControllerTest.php b/tests/Unit/Controller/PhotosControllerTest.php index 23e00a67a..b48e08d0c 100644 --- a/tests/Unit/Controller/PhotosControllerTest.php +++ b/tests/Unit/Controller/PhotosControllerTest.php @@ -139,7 +139,6 @@ protected function setUp(): void { $qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); } public static function tearDownAfterClass(): void { diff --git a/tests/Unit/Controller/TracksControllerTest.php b/tests/Unit/Controller/TracksControllerTest.php index 3c9e7e1e2..4d138a51b 100644 --- a/tests/Unit/Controller/TracksControllerTest.php +++ b/tests/Unit/Controller/TracksControllerTest.php @@ -140,7 +140,6 @@ protected function setUp(): void { $qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); } public static function tearDownAfterClass(): void { @@ -173,7 +172,6 @@ protected function tearDown(): void { $qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR)) ); $req = $qb->execute(); - $qb = $qb->resetQueryParts(); } public function testAddGetTracks() { diff --git a/tests/Unit/Helper/ExifGeoDataTest.php b/tests/Unit/Helper/ExifGeoDataTest.php index 46d66d498..29d3c35d0 100644 --- a/tests/Unit/Helper/ExifGeoDataTest.php +++ b/tests/Unit/Helper/ExifGeoDataTest.php @@ -6,7 +6,7 @@ class ExifGeoDataTest extends TestCase { - public function imageWithDateAndLocationProvider(): array { + public static function imageWithDateAndLocationProvider(): array { return [ ['tests/test_files/Photos/WithDateAndLocation/imageWithDateAndLocation1.JPG', 1311984000 + 7200, 47.071717, 10.339557], ['tests/test_files/Photos/WithDateAndLocation/imageWithDateAndLocation2.JPG', 1312156800 + 7200, 46.862350, 10.916452], @@ -54,7 +54,7 @@ public function testImagesWithDateAndLocation(string $path, int $date, float $la $this->assertEqualsWithDelta($lng, $exif_geo_data->lng, 0.000005); } - public function imageWithZeroIslandProvider(): array { + public static function imageWithZeroIslandProvider(): array { return [ ['tests/test_files/Photos/ZeroIsland/imageZeroIsland1.JPG', 1653829180 + 7200], ];