propagator batching when removing thumbnails

This commit is contained in:
Robin Appelman 2016-06-14 17:17:29 +02:00
parent 1fddd62c1c
commit dfcaeeabb3
1 changed files with 13 additions and 7 deletions

View File

@ -410,6 +410,10 @@ class Preview {
* Deletes all previews of a file * Deletes all previews of a file
*/ */
public function deleteAllPreviews() { public function deleteAllPreviews() {
$thumbnailMount = $this->userView->getMount($this->getThumbnailsFolder());
$propagator = $thumbnailMount->getStorage()->getPropagator();
$propagator->beginBatch();
$toDelete = $this->getChildren(); $toDelete = $this->getChildren();
$toDelete[] = $this->getFileInfo(); $toDelete[] = $this->getFileInfo();
@ -426,6 +430,8 @@ class Preview {
} }
} }
} }
$propagator->commitBatch();
} }
/** /**
@ -572,8 +578,8 @@ class Preview {
* @return integer[] * @return integer[]
*/ */
private function applyAspectRatio($askedWidth, $askedHeight, $originalWidth = 0, $originalHeight = 0) { private function applyAspectRatio($askedWidth, $askedHeight, $originalWidth = 0, $originalHeight = 0) {
if(!$originalWidth){ if (!$originalWidth) {
$originalWidth= $this->maxPreviewWidth; $originalWidth = $this->maxPreviewWidth;
} }
if (!$originalHeight) { if (!$originalHeight) {
$originalHeight = $this->maxPreviewHeight; $originalHeight = $this->maxPreviewHeight;
@ -1260,7 +1266,7 @@ class Preview {
$absPath = Files\Filesystem::normalizePath($view->getAbsolutePath($path)); $absPath = Files\Filesystem::normalizePath($view->getAbsolutePath($path));
$fileInfo = $view->getFileInfo($path); $fileInfo = $view->getFileInfo($path);
if($fileInfo === false) { if ($fileInfo === false) {
return; return;
} }
self::addPathToDeleteFileMapper($absPath, $fileInfo); self::addPathToDeleteFileMapper($absPath, $fileInfo);