From b57ca0febb4e2ec7171fa143ee99eb49c4c1e87e Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 1 Dec 2023 11:07:49 +0100 Subject: [PATCH 01/17] test(dav): Add tests for dav interface to full-run-test.yml Signed-off-by: Marcel Klehr --- .github/workflows/full-run-test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/full-run-test.yml b/.github/workflows/full-run-test.yml index e739f8c4..84273899 100644 --- a/.github/workflows/full-run-test.yml +++ b/.github/workflows/full-run-test.yml @@ -181,3 +181,19 @@ jobs: run: | ./occ recognize:classify ./occ recognize:cluster-faces + + - name: Install cadaver + if: ${{ matrix.faces-enabled }} + run: | + sudo apt -y install cadaver + + - name: Test webdav access + if: ${{ matrix.faces-enabled }} + run: | + echo -n "machine localhost\nlogin admin\npassword admin" > ~/.netrc + cadaver http:://localhost:8080/remote.php/dav/recognize/admin/ < Date: Fri, 1 Dec 2023 11:16:51 +0100 Subject: [PATCH 02/17] test(full-run-test): ALways display logs Signed-off-by: Marcel Klehr --- .github/workflows/full-run-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/full-run-test.yml b/.github/workflows/full-run-test.yml index 84273899..77b83961 100644 --- a/.github/workflows/full-run-test.yml +++ b/.github/workflows/full-run-test.yml @@ -197,3 +197,8 @@ jobs: mv faces/0/* faces/toot/ mv faces/toot/ faces/blah/ EOF + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log From 0dae97dfdc2fe279e82b72c467e9156ca19eb606 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 1 Dec 2023 11:17:11 +0100 Subject: [PATCH 03/17] fix(eslint) Signed-off-by: Marcel Klehr --- src/components/ViewAdmin.vue | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/ViewAdmin.vue b/src/components/ViewAdmin.vue index 72f89415..321dbd7b 100644 --- a/src/components/ViewAdmin.vue +++ b/src/components/ViewAdmin.vue @@ -221,15 +221,15 @@ {{ t('recognize', 'Number of CPU Cores (0 for no limit)') }}

-

 

-

{{ t('recognize', 'By default, recognize will only ever run one classifier process at a time. If you have a lot of resources available and want to run as many processes in parallel as possible, you can turn on concurrency here.') }}

-

- - {{ t('recognize', 'Enable unlimited concurrency of classifier processes') }} - -

+

 

+

{{ t('recognize', 'By default, recognize will only ever run one classifier process at a time. If you have a lot of resources available and want to run as many processes in parallel as possible, you can turn on concurrency here.') }}

+

+ + {{ t('recognize', 'Enable unlimited concurrency of classifier processes') }} + +

@@ -262,7 +262,10 @@

- + {{ t('recognize', 'Enable GPU mode') }}

From 66c79dec4dbaa00658e7e6198d79bd228f2db4aa Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 1 Dec 2023 11:26:44 +0100 Subject: [PATCH 04/17] fix(webdav) Signed-off-by: Marcel Klehr --- lib/BackgroundJobs/ClusterFacesJob.php | 1 - lib/Dav/Faces/UnassignedFacesHome.php | 3 +-- lib/Dav/RecognizeHome.php | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/BackgroundJobs/ClusterFacesJob.php b/lib/BackgroundJobs/ClusterFacesJob.php index 51d8e6fc..2d9a1179 100644 --- a/lib/BackgroundJobs/ClusterFacesJob.php +++ b/lib/BackgroundJobs/ClusterFacesJob.php @@ -19,7 +19,6 @@ class ClusterFacesJob extends QueuedJob { private FaceClusterAnalyzer $clusterAnalyzer; private IJobList $jobList; private LoggerInterface $logger; - public const BATCH_SIZE = 10000; private SettingsService $settingsService; diff --git a/lib/Dav/Faces/UnassignedFacesHome.php b/lib/Dav/Faces/UnassignedFacesHome.php index a64c2ef6..546a30a2 100644 --- a/lib/Dav/Faces/UnassignedFacesHome.php +++ b/lib/Dav/Faces/UnassignedFacesHome.php @@ -30,7 +30,6 @@ public function __construct(IUser $user, FaceDetectionMapper $faceDetectionMappe $this->faceDetectionMapper = $faceDetectionMapper; $this->rootFolder = $rootFolder; $this->tagManager = $tagManager; - $this->metadataManager = $metadataManager; $this->previewManager = $previewManager; } @@ -82,7 +81,7 @@ public function getChild($name): FacePhoto { throw new NotFound(); } - return new UnassignedFacePhoto($this->faceDetectionMapper, $detection, $this->rootFolder->getUserFolder($this->user->getUID()), $this->tagManager, $this->metadataManager, $this->previewManager); + return new UnassignedFacePhoto($this->faceDetectionMapper, $detection, $this->rootFolder->getUserFolder($this->user->getUID()), $this->tagManager, $this->previewManager); } public function childExists($name): bool { diff --git a/lib/Dav/RecognizeHome.php b/lib/Dav/RecognizeHome.php index 37cc4075..2fd6d6a7 100644 --- a/lib/Dav/RecognizeHome.php +++ b/lib/Dav/RecognizeHome.php @@ -34,7 +34,6 @@ public function __construct(array $principalInfo, FaceClusterMapper $faceCluster $this->faceDetectionMapper = $faceDetectionMapper; $this->rootFolder = $rootFolder; $this->tagManager = $tagManager; - $this->metadataManager = $metadataManager; $this->previewManager = $previewManager; } @@ -60,11 +59,11 @@ public function createDirectory($name) { } private function getFacesHome() { - return new FacesHome($this->faceClusterMapper, $this->user, $this->faceDetectionMapper, $this->rootFolder, $this->tagManager, $this->metadataManager, $this->previewManager); + return new FacesHome($this->faceClusterMapper, $this->user, $this->faceDetectionMapper, $this->rootFolder, $this->tagManager, $this->previewManager); } private function getUnassignedFacesHome() { - return new UnassignedFacesHome($this->user, $this->faceDetectionMapper, $this->rootFolder, $this->tagManager, $this->metadataManager, $this->previewManager); + return new UnassignedFacesHome($this->user, $this->faceDetectionMapper, $this->rootFolder, $this->tagManager, $this->previewManager); } public function getChild($name) { From 8615c0615b93305679b39d483ce4ab696611ff6f Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 1 Dec 2023 11:50:27 +0100 Subject: [PATCH 05/17] fix(full-run-test) Signed-off-by: Marcel Klehr --- .github/workflows/full-run-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/full-run-test.yml b/.github/workflows/full-run-test.yml index 77b83961..bedbb1c1 100644 --- a/.github/workflows/full-run-test.yml +++ b/.github/workflows/full-run-test.yml @@ -190,7 +190,11 @@ jobs: - name: Test webdav access if: ${{ matrix.faces-enabled }} run: | - echo -n "machine localhost\nlogin admin\npassword admin" > ~/.netrc + cat > ~/.netrc < Date: Fri, 1 Dec 2023 12:27:11 +0100 Subject: [PATCH 06/17] fix(full-run-test) Signed-off-by: Marcel Klehr --- .github/workflows/full-run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full-run-test.yml b/.github/workflows/full-run-test.yml index bedbb1c1..13f7a51b 100644 --- a/.github/workflows/full-run-test.yml +++ b/.github/workflows/full-run-test.yml @@ -195,7 +195,7 @@ jobs: login admin password admin EOF - cadaver http:://localhost:8080/remote.php/dav/recognize/admin/ < Date: Fri, 1 Dec 2023 12:41:27 +0100 Subject: [PATCH 07/17] fix(full-run-test) Signed-off-by: Marcel Klehr --- .github/workflows/full-run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full-run-test.yml b/.github/workflows/full-run-test.yml index 13f7a51b..a999d0e9 100644 --- a/.github/workflows/full-run-test.yml +++ b/.github/workflows/full-run-test.yml @@ -193,7 +193,7 @@ jobs: cat > ~/.netrc < Date: Sat, 2 Dec 2023 10:25:31 +0100 Subject: [PATCH 08/17] fix(ci/cluster-faces-test): cache photos download Signed-off-by: Marcel Klehr --- .github/workflows/cluster-faces-test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/cluster-faces-test.yml b/.github/workflows/cluster-faces-test.yml index 8e335608..d568d560 100644 --- a/.github/workflows/cluster-faces-test.yml +++ b/.github/workflows/cluster-faces-test.yml @@ -132,7 +132,14 @@ jobs: run: | ./occ app:enable -vvv ${{ env.APP_NAME }} + - uses: actions/cache/restore@v3 + id: photos-cache + with: + path: data/admin/files/ + key: https://cloud.marcelklehr.de/s/PkNYbmKnwMiQMFD/download/IMDb-Face.zip + - name: Upload photos + if: steps.photos-cache.outputs.cache-hit != 'true' run: | mkdir -p data/admin/files/ cd data/admin/files @@ -140,6 +147,11 @@ jobs: unzip IMDb-Face.zip rm IMDb-Face.zip + - uses: actions/cache/save@v3 + with: + path: data/admin/files/ + key: https://cloud.marcelklehr.de/s/PkNYbmKnwMiQMFD/download/IMDb-Face.zip + - name: Set pure-js mode run: | ./occ config:app:set --value ${{ matrix.pure-js-mode }} recognize tensorflow.purejs From fc489ed79848825700c0c07cd2e70b16313ab4fb Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 2 Dec 2023 11:33:24 +0100 Subject: [PATCH 09/17] fix(ci/cluster-faces-test): make more space for photos Signed-off-by: Marcel Klehr --- .github/workflows/cluster-faces-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cluster-faces-test.yml b/.github/workflows/cluster-faces-test.yml index d568d560..89bf4828 100644 --- a/.github/workflows/cluster-faces-test.yml +++ b/.github/workflows/cluster-faces-test.yml @@ -132,6 +132,10 @@ jobs: run: | ./occ app:enable -vvv ${{ env.APP_NAME }} + - name: Remove unnecessary models to make space + run: | + rm -rf apps/recognize/models + - uses: actions/cache/restore@v3 id: photos-cache with: From 5209ad19835115bfe37d87663d0246d69911c8e1 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 2 Dec 2023 13:10:02 +0100 Subject: [PATCH 10/17] fix(ci/cluster-faces-test): Use ubuntu 20.04 Signed-off-by: Marcel Klehr --- .github/workflows/cluster-faces-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cluster-faces-test.yml b/.github/workflows/cluster-faces-test.yml index 89bf4828..19ddd567 100644 --- a/.github/workflows/cluster-faces-test.yml +++ b/.github/workflows/cluster-faces-test.yml @@ -17,7 +17,7 @@ env: jobs: php: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: # do not stop on another job's failure From 79b07849ed10f5b179e2795cae5bfb04fa89727a Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 2 Dec 2023 15:34:15 +0100 Subject: [PATCH 11/17] fix(memory leaks) Signed-off-by: Marcel Klehr --- lib/Classifiers/Classifier.php | 6 ++++++ lib/Classifiers/Images/ClusteringFaceClassifier.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Classifiers/Classifier.php b/lib/Classifiers/Classifier.php index be27a7cd..0ae75726 100644 --- a/lib/Classifiers/Classifier.php +++ b/lib/Classifiers/Classifier.php @@ -340,8 +340,10 @@ public function generatePreviewWithProvider(File $file): string { $previewImage = imagecreatefromstring(file_get_contents($tmpname)); $use_gd_quality = (int)$this->config->getSystemValue('recognize.preview.quality', '100'); if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) { + imagedestroy($previewImage); throw new \OCA\Recognize\Exception\Exception('Could not copy preview file to temp folder'); } + imagedestroy($previewImage); } return $tmpname; @@ -379,8 +381,12 @@ public function generatePreviewWithGD(string $path): string { $use_gd_quality = (int)$this->config->getSystemValue('recognize.preview.quality', '100'); if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) { + imagedestroy($image); + imagedestroy($previewImage); throw new \OCA\Recognize\Exception\Exception('Could not copy preview file to temp folder'); } + imagedestroy($image); + imagedestroy($previewImage); return $tmpname; } diff --git a/lib/Classifiers/Images/ClusteringFaceClassifier.php b/lib/Classifiers/Images/ClusteringFaceClassifier.php index f871900f..5480881b 100644 --- a/lib/Classifiers/Images/ClusteringFaceClassifier.php +++ b/lib/Classifiers/Images/ClusteringFaceClassifier.php @@ -115,14 +115,14 @@ public function classify(array $queueFiles): void { $this->logger->error('Could not store face detection in database', ['exception' => $e]); continue; } - $usersToCluster[] = $userId; + $usersToCluster[$userId] = true; } $this->config->setAppValue('recognize', self::MODEL_NAME.'.status', 'true'); $this->config->setAppValue('recognize', self::MODEL_NAME.'.lastFile', time()); } } - $usersToCluster = array_unique($usersToCluster); + $usersToCluster = array_keys($usersToCluster); foreach ($usersToCluster as $userId) { if (!$this->jobList->has(ClusterFacesJob::class, ['userId' => $userId])) { $this->logger->debug('scheduling ClusterFacesJob for user '.$userId); From d41952fc15b65a7444bfd4edc98280da805dad34 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 2 Dec 2023 15:37:04 +0100 Subject: [PATCH 12/17] fix(clustering-faces-test): Only use one core Signed-off-by: Marcel Klehr --- .github/workflows/cluster-faces-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cluster-faces-test.yml b/.github/workflows/cluster-faces-test.yml index 19ddd567..a561a19a 100644 --- a/.github/workflows/cluster-faces-test.yml +++ b/.github/workflows/cluster-faces-test.yml @@ -156,13 +156,12 @@ jobs: path: data/admin/files/ key: https://cloud.marcelklehr.de/s/PkNYbmKnwMiQMFD/download/IMDb-Face.zip - - name: Set pure-js mode + - name: Set config run: | ./occ config:app:set --value ${{ matrix.pure-js-mode }} recognize tensorflow.purejs - - - name: Set faces.enabled - run: | ./occ config:app:set --value true recognize faces.enabled + # only use one core. GH actions has 2 + ./occ config:app:set --value 1 recognize tensorflow.cores - uses: actions/cache/restore@v3 id: db-cache From 926f922532c88d6dea3147a73e49b3aeea9c4b00 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 3 Dec 2023 12:23:03 +0100 Subject: [PATCH 13/17] fix(memory leaks) Signed-off-by: Marcel Klehr --- lib/Classifiers/Classifier.php | 1 + lib/Command/Classify.php | 1 + lib/Service/StorageService.php | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Classifiers/Classifier.php b/lib/Classifiers/Classifier.php index 0ae75726..07f7adab 100644 --- a/lib/Classifiers/Classifier.php +++ b/lib/Classifiers/Classifier.php @@ -231,6 +231,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \ $i++; } } + $proc->stop(); $this->cleanUpTmpFiles(); if ($i !== count($paths)) { $this->logger->warning('Classifier process output: '.$errOut); diff --git a/lib/Command/Classify.php b/lib/Command/Classify.php index 65665165..f86b3943 100644 --- a/lib/Command/Classify.php +++ b/lib/Command/Classify.php @@ -141,6 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } } while ($i > 0); + \OC_Util::tearDownFS(); } return 0; } diff --git a/lib/Service/StorageService.php b/lib/Service/StorageService.php index ed670751..085fc902 100644 --- a/lib/Service/StorageService.php +++ b/lib/Service/StorageService.php @@ -67,10 +67,12 @@ public function getMounts(): \Generator { $qb = new CacheQueryBuilder($this->db, $this->systemConfig, $this->logger, $this->metadataManager); try { /** @var array|false $root */ - $root = $qb->selectFileCache() + $result = $qb->selectFileCache() ->andWhere($qb->expr()->eq('filecache.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('filecache.path', $qb->createNamedParameter('files'))) - ->executeQuery()->fetch(); + ->executeQuery(); + $root = $result->fetch(); + $result->closeCursor(); if ($root !== false) { $overrideRoot = intval($root['fileid']); } From 93ca7797a6b82582aa5944f236a548d4712eda91 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 3 Dec 2023 18:07:35 +0100 Subject: [PATCH 14/17] fix(dav properties): Re-add missing props Signed-off-by: Marcel Klehr --- lib/Dav/Faces/PropFindPlugin.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Dav/Faces/PropFindPlugin.php b/lib/Dav/Faces/PropFindPlugin.php index 039d7c27..adc31ee9 100644 --- a/lib/Dav/Faces/PropFindPlugin.php +++ b/lib/Dav/Faces/PropFindPlugin.php @@ -50,6 +50,10 @@ public function propFind(PropFind $propFind, INode $node) { ) ); }); + $propFind->handle(self::FILE_NAME_PROPERTYNAME, function () use ($node) { + return $node->getFile()->getName(); + }); + $propFind->handle(self::REALPATH_PROPERTYNAME, fn () => $node->getFile()->getPath()); $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, fn () => $node->getFile()->getId()); $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, fn () => $node->getETag()); $propFind->handle(self::FILE_NAME_PROPERTYNAME, fn () => $node->getFile()->getName()); From f19bf5508d7ea2fd846b4a4a55008106ab29dc23 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 3 Dec 2023 18:12:03 +0100 Subject: [PATCH 15/17] fix(psalm issue) Signed-off-by: Marcel Klehr --- lib/Dav/Faces/PropFindPlugin.php | 5 +---- lib/Service/StorageService.php | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Dav/Faces/PropFindPlugin.php b/lib/Dav/Faces/PropFindPlugin.php index adc31ee9..dcbca67e 100644 --- a/lib/Dav/Faces/PropFindPlugin.php +++ b/lib/Dav/Faces/PropFindPlugin.php @@ -50,13 +50,10 @@ public function propFind(PropFind $propFind, INode $node) { ) ); }); - $propFind->handle(self::FILE_NAME_PROPERTYNAME, function () use ($node) { - return $node->getFile()->getName(); - }); + $propFind->handle(self::FILE_NAME_PROPERTYNAME, fn () => $node->getFile()->getName()); $propFind->handle(self::REALPATH_PROPERTYNAME, fn () => $node->getFile()->getPath()); $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, fn () => $node->getFile()->getId()); $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, fn () => $node->getETag()); - $propFind->handle(self::FILE_NAME_PROPERTYNAME, fn () => $node->getFile()->getName()); $propFind->handle(TagsPlugin::FAVORITE_PROPERTYNAME, fn () => $node->isFavorite() ? 1 : 0); $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => json_encode($this->previewManager->isAvailable($node->getFile()->getFileInfo()))); $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () use ($node): string { diff --git a/lib/Service/StorageService.php b/lib/Service/StorageService.php index 085fc902..2d443fe9 100644 --- a/lib/Service/StorageService.php +++ b/lib/Service/StorageService.php @@ -66,11 +66,11 @@ public function getMounts(): \Generator { // Only crawl files, not cache or trashbin $qb = new CacheQueryBuilder($this->db, $this->systemConfig, $this->logger, $this->metadataManager); try { - /** @var array|false $root */ $result = $qb->selectFileCache() ->andWhere($qb->expr()->eq('filecache.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('filecache.path', $qb->createNamedParameter('files'))) ->executeQuery(); + /** @var array|false $root */ $root = $result->fetch(); $result->closeCursor(); if ($root !== false) { From 57452f7f140a45a9b45f683933bc5c61352b8b3f Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 3 Dec 2023 18:36:24 +0100 Subject: [PATCH 16/17] fix(cluster-faces-test): Add lib/Dav to clustering-cache key Signed-off-by: Marcel Klehr --- .github/workflows/cluster-faces-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cluster-faces-test.yml b/.github/workflows/cluster-faces-test.yml index a561a19a..0885ef9c 100644 --- a/.github/workflows/cluster-faces-test.yml +++ b/.github/workflows/cluster-faces-test.yml @@ -198,7 +198,7 @@ jobs: id: clustering-cache with: path: out.json - key: ${{ runner.os }}-${{ hashFiles('out.txt', 'apps/recognize/src/classifier_faces.js', 'apps/recognize/lib/Classifiers/Classifier.php', 'apps/recognize/lib/Classifiers/Images/ClusteringFaceClassifier.php', 'apps/recognize/lib/Clustering/**', 'apps/recognize/lib/Service/FaceClusterAnalyzer.php', 'apps/recognize/lib/Command/ClusterFaces.php') }}-${{ matrix.pure-js-mode }} + key: ${{ runner.os }}-${{ hashFiles('out.txt', 'apps/recognize/src/classifier_faces.js', 'apps/recognize/lib/Classifiers/Classifier.php', 'apps/recognize/lib/Classifiers/Images/ClusteringFaceClassifier.php', 'apps/recognize/lib/Clustering/**', 'apps/recognize/lib/Dav/**', 'apps/recognize/lib/Service/FaceClusterAnalyzer.php', 'apps/recognize/lib/Command/ClusterFaces.php') }}-${{ matrix.pure-js-mode }} - name: Run clustering if: steps.clustering-cache.outputs.cache-hit != 'true' From 7d45a665f731eb1fbec12be857335511cf54a87c Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 4 Dec 2023 13:49:12 +0100 Subject: [PATCH 17/17] fix(StorageService#getMounts): Avoid variable leakage Signed-off-by: Marcel Klehr --- lib/Service/StorageService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/StorageService.php b/lib/Service/StorageService.php index 2d443fe9..18f56629 100644 --- a/lib/Service/StorageService.php +++ b/lib/Service/StorageService.php @@ -66,13 +66,13 @@ public function getMounts(): \Generator { // Only crawl files, not cache or trashbin $qb = new CacheQueryBuilder($this->db, $this->systemConfig, $this->logger, $this->metadataManager); try { - $result = $qb->selectFileCache() + $res = $qb->selectFileCache() ->andWhere($qb->expr()->eq('filecache.storage', $qb->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('filecache.path', $qb->createNamedParameter('files'))) ->executeQuery(); /** @var array|false $root */ - $root = $result->fetch(); - $result->closeCursor(); + $root = $res->fetch(); + $res->closeCursor(); if ($root !== false) { $overrideRoot = intval($root['fileid']); }