diff options
author | Robin Appelman <icewind@owncloud.com> | 2016-06-14 17:17:29 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2016-06-14 17:17:29 +0200 |
commit | dfcaeeabb3b69888d993c29016a5e8d4a0aa7569 (patch) | |
tree | e89b54184cd6cf05d43291b56cdb41b5aad4b4dd /lib | |
parent | 1fddd62c1ca0cd3407fb15d62d463491e37e336d (diff) | |
download | nextcloud-server-dfcaeeabb3b69888d993c29016a5e8d4a0aa7569.tar.gz nextcloud-server-dfcaeeabb3b69888d993c29016a5e8d4a0aa7569.zip |
propagator batching when removing thumbnails
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/private/Preview.php b/lib/private/Preview.php index b5625ce0df0..8bc262d7047 100644 --- a/lib/private/Preview.php +++ b/lib/private/Preview.php @@ -136,9 +136,9 @@ class Preview { //check if there are preview backends if (!\OC::$server->getPreviewManager() - ->hasProviders() + ->hasProviders() && \OC::$server->getConfig() - ->getSystemValue('enable_previews', true) + ->getSystemValue('enable_previews', true) ) { \OCP\Util::writeLog('core', 'No preview providers exist', \OCP\Util::ERROR); throw new \Exception('No preview providers'); @@ -410,6 +410,10 @@ class Preview { * Deletes all previews of a file */ public function deleteAllPreviews() { + $thumbnailMount = $this->userView->getMount($this->getThumbnailsFolder()); + $propagator = $thumbnailMount->getStorage()->getPropagator(); + $propagator->beginBatch(); + $toDelete = $this->getChildren(); $toDelete[] = $this->getFileInfo(); @@ -426,6 +430,8 @@ class Preview { } } } + + $propagator->commitBatch(); } /** @@ -572,8 +578,8 @@ class Preview { * @return integer[] */ private function applyAspectRatio($askedWidth, $askedHeight, $originalWidth = 0, $originalHeight = 0) { - if(!$originalWidth){ - $originalWidth= $this->maxPreviewWidth; + if (!$originalWidth) { + $originalWidth = $this->maxPreviewWidth; } if (!$originalHeight) { $originalHeight = $this->maxPreviewHeight; @@ -1112,7 +1118,7 @@ class Preview { $preview = null; $previewProviders = \OC::$server->getPreviewManager() - ->getProviders(); + ->getProviders(); foreach ($previewProviders as $supportedMimeType => $providers) { if (!preg_match($supportedMimeType, $this->mimeType)) { continue; @@ -1126,7 +1132,7 @@ class Preview { \OCP\Util::writeLog( 'core', 'Generating preview for "' . $file . '" with "' . get_class($provider) - . '"', \OCP\Util::DEBUG + . '"', \OCP\Util::DEBUG ); /** @var $provider Provider */ @@ -1260,7 +1266,7 @@ class Preview { $absPath = Files\Filesystem::normalizePath($view->getAbsolutePath($path)); $fileInfo = $view->getFileInfo($path); - if($fileInfo === false) { + if ($fileInfo === false) { return; } self::addPathToDeleteFileMapper($absPath, $fileInfo); |