fix folder delete
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
43fa746ad9
commit
066faaec05
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -773,6 +773,8 @@ class CacheTest extends \Test\TestCase {
|
|||
$this->assertEquals(0, $entry->getCreationTime());
|
||||
$this->assertEquals(25, $entry->getUploadTime());
|
||||
$this->assertEquals(null, $entry->getMetadataEtag());
|
||||
|
||||
$this->cache->remove("sub");
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
|
Loading…
Reference in New Issue