From 066faaec058ba487f214463d1b53603aaeaad646 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 31 Oct 2019 14:57:39 +0100 Subject: fix folder delete Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Cache.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/private') diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index dd063903058..f3081e7b18b 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -548,8 +548,14 @@ class Cache implements ICache { * @throws \OC\DatabaseException */ private function removeChildren(ICacheEntry $entry) { - $subFolders = $this->getSubFolders($entry); - foreach ($subFolders as $folder) { + $children = $this->getFolderContentsById($entry->getId()); + $childIds = array_map(function(ICacheEntry $cacheEntry) { + return $cacheEntry->getId(); + }, $children); + $childFolders = array_filter($children, function ($child) { + return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; + }); + foreach ($childFolders as $folder) { $this->removeChildren($folder); } @@ -560,7 +566,7 @@ class Cache implements ICache { $query = $this->getQueryBuilder(); $query->delete('filecache_extended') - ->whereParent($entry->getId()); + ->where($query->expr()->in('fileid', $query->createNamedParameter($childIds, IQueryBuilder::PARAM_INT_ARRAY))); $query->execute(); } -- cgit v1.2.3