summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-06-17 11:52:54 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-06-17 11:52:54 +0200
commitd2305f25278808d781fc8c44363e83adc7b71b9a (patch)
treee98114876b2758dc0839a13423b10bef3f12daf3 /apps
parent3898b8c9b89609a199b87d4d3ce1c7fe95026c1c (diff)
parentf02e110aea10d2bfc1921d164c1bb6283ea6daaf (diff)
downloadnextcloud-server-d2305f25278808d781fc8c44363e83adc7b71b9a.tar.gz
nextcloud-server-d2305f25278808d781fc8c44363e83adc7b71b9a.zip
Merge pull request #16729 from owncloud/scanner-read-lock
keep a read lock while scanning a file or folder
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/trashbin.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 853bc1eda69..b30ea7c69f8 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -55,6 +55,16 @@ class Trashbin {
*/
private static $scannedVersions = false;
+ /**
+ * Ensure we dont need to scan the file during the move to trash
+ * by triggering the scan in the pre-hook
+ *
+ * @param array $params
+ */
+ public static function ensureFileScannedHook($params) {
+ self::getUidAndFilename($params['path']);
+ }
+
public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid);
@@ -870,6 +880,7 @@ class Trashbin {
//Listen to post write hook
\OCP\Util::connectHook('OC_Filesystem', 'post_write', 'OCA\Files_Trashbin\Hooks', 'post_write_hook');
// pre and post-rename, disable trash logic for the copy+unlink case
+ \OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Files_Trashbin\Trashbin', 'ensureFileScannedHook');
\OCP\Util::connectHook('OC_Filesystem', 'rename', 'OCA\Files_Trashbin\Storage', 'preRenameHook');
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Files_Trashbin\Storage', 'postRenameHook');
}