From 0670118470a9133749d630078f8b69d0e62c3e52 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Thu, 26 Aug 2021 21:37:07 +0200 Subject: Use storage filter when fetching previews to cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/AppData/AppData.php | 2 +- lib/private/Preview/BackgroundCleanupJob.php | 1 + lib/private/Preview/Storage/Root.php | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index df72978a142..53f69be7127 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -79,7 +79,7 @@ class AppData implements IAppData { return 'appdata_' . $instanceId; } - private function getAppDataRootFolder(): Folder { + protected function getAppDataRootFolder(): Folder { $name = $this->getAppDataFolderName(); try { diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index c78ef7d7257..ab40aeaaa79 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -134,6 +134,7 @@ class BackgroundCleanupJob extends TimedJob { )) ->where( $qb->expr()->andX( + $qb->expr()->eq('a.storage', $qb->createNamedParameter($this->previewFolder->getStorageId())), $qb->expr()->isNull('b.fileid'), $qb->expr()->like('a.path', $qb->createNamedParameter($like)), $qb->expr()->eq('a.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('httpd/unix-directory'))) diff --git a/lib/private/Preview/Storage/Root.php b/lib/private/Preview/Storage/Root.php index 0eac3ce2064..c4191228ec7 100644 --- a/lib/private/Preview/Storage/Root.php +++ b/lib/private/Preview/Storage/Root.php @@ -85,4 +85,8 @@ class Root extends AppData { public static function getInternalFolder(string $name): string { return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; } + + public function getStorageId(): int { + return $this->getAppDataRootFolder()->getStorage()->getCache()->getNumericStorageId(); + } } -- cgit v1.2.3