From aa103bd5b32fc45e5594976c59cd7680bff60d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 27 Mar 2013 13:57:31 +0100 Subject: [PATCH] supress write hook for .part files --- lib/files/cache/scanner.php | 9 +++------ lib/files/view.php | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 4eaea947e5..f019d4fc60 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -62,7 +62,7 @@ class Scanner { * @return array with metadata of the scanned file */ public function scanFile($file, $checkExisting = false) { - if (!$this->isIgnoredFile($file)) { + if (!self::isIgnoredFile($file)) { \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); $data = $this->getData($file); if ($data) { @@ -90,7 +90,6 @@ class Scanner { } return $data; } - \OCP\Util::writeLog('scanner', 'Ignoring '.$file.' and not triggering scan_file hook.', \OCP\Util::DEBUG); return null; } @@ -155,9 +154,7 @@ class Scanner { * @return boolean */ private function isIgnoredDir($dir) { - if ($dir === '.' || $dir === '..' - || \OC\Files\Filesystem::isFileBlacklisted($file) - ) { + if ($dir === '.' || $dir === '..') { return true; } return false; @@ -169,7 +166,7 @@ class Scanner { * @param String $file * @return boolean */ - private function isIgnoredFile($file) { + public static function isIgnoredFile($file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'part' || \OC\Files\Filesystem::isFileBlacklisted($file) ) { diff --git a/lib/files/view.php b/lib/files/view.php index 19f33ad64a..e811fb093c 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -267,7 +267,7 @@ class View { $path = $this->getRelativePath($absolutePath); $exists = $this->file_exists($path); $run = true; - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -295,7 +295,7 @@ class View { list ($count, $result) = \OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -627,7 +627,7 @@ class View { private function runHooks($hooks, $path, $post = false) { $prefix = ($post) ? 'post_' : ''; $run = true; - if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot()) { + if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) { foreach ($hooks as $hook) { if ($hook != 'read') { \OC_Hook::emit(