Skip to content

Commit

Permalink
Use storage filter when fetching previews to cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Aug 26, 2021
1 parent fd93aa8 commit 0670118
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Files/AppData/AppData.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function getAppDataFolderName() {
return 'appdata_' . $instanceId;
}

private function getAppDataRootFolder(): Folder {
protected function getAppDataRootFolder(): Folder {
$name = $this->getAppDataFolderName();

try {
Expand Down
1 change: 1 addition & 0 deletions lib/private/Preview/BackgroundCleanupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private function getNewPreviewLocations(): \Iterator {
))
->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')))
Expand Down
4 changes: 4 additions & 0 deletions lib/private/Preview/Storage/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ public function getDirectoryListing(): array {
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();
}
}

0 comments on commit 0670118

Please sign in to comment.