Merge pull request #25102 from owncloud/preview-delete-performance
Preview delete performance
This commit is contained in:
commit
f163eedfa2
|
@ -25,6 +25,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Files\Cache;
|
namespace OC\Files\Cache;
|
||||||
|
|
||||||
|
use OCP\Files\Cache\ICacheEntry;
|
||||||
use OCP\Files\Cache\IUpdater;
|
use OCP\Files\Cache\IUpdater;
|
||||||
use OCP\Files\Storage\IStorage;
|
use OCP\Files\Storage\IStorage;
|
||||||
|
|
||||||
|
@ -150,12 +152,20 @@ class Updater implements IUpdater {
|
||||||
$parent = '';
|
$parent = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$entry = $this->cache->get($path);
|
||||||
|
|
||||||
$this->cache->remove($path);
|
$this->cache->remove($path);
|
||||||
|
|
||||||
|
$this->correctParentStorageMtime($path);
|
||||||
|
if ($entry instanceof ICacheEntry) {
|
||||||
|
$this->propagator->propagateChange($path, time(), -$entry->getSize());
|
||||||
|
} else {
|
||||||
|
$this->propagator->propagateChange($path, time());
|
||||||
if ($this->cache instanceof Cache) {
|
if ($this->cache instanceof Cache) {
|
||||||
$this->cache->correctFolderSize($parent);
|
$this->cache->correctFolderSize($parent);
|
||||||
}
|
}
|
||||||
$this->correctParentStorageMtime($path);
|
}
|
||||||
$this->propagator->propagateChange($path, time());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
@ -422,11 +426,12 @@ class Preview {
|
||||||
// .ocTransferId*.part file from chunked file upload.
|
// .ocTransferId*.part file from chunked file upload.
|
||||||
if (!empty($fileId)) {
|
if (!empty($fileId)) {
|
||||||
$previewPath = $this->getPreviewPath($fileId);
|
$previewPath = $this->getPreviewPath($fileId);
|
||||||
$this->userView->deleteAll($previewPath);
|
|
||||||
$this->userView->rmdir($previewPath);
|
$this->userView->rmdir($previewPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$propagator->commitBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -573,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;
|
||||||
|
@ -1261,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);
|
||||||
|
|
Loading…
Reference in New Issue