supress write hook for .part files
This commit is contained in:
parent
4a70315ad1
commit
aa103bd5b3
|
@ -62,7 +62,7 @@ class Scanner {
|
||||||
* @return array with metadata of the scanned file
|
* @return array with metadata of the scanned file
|
||||||
*/
|
*/
|
||||||
public function scanFile($file, $checkExisting = false) {
|
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));
|
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
|
||||||
$data = $this->getData($file);
|
$data = $this->getData($file);
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
@ -90,7 +90,6 @@ class Scanner {
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
\OCP\Util::writeLog('scanner', 'Ignoring '.$file.' and not triggering scan_file hook.', \OCP\Util::DEBUG);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,9 +154,7 @@ class Scanner {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function isIgnoredDir($dir) {
|
private function isIgnoredDir($dir) {
|
||||||
if ($dir === '.' || $dir === '..'
|
if ($dir === '.' || $dir === '..') {
|
||||||
|| \OC\Files\Filesystem::isFileBlacklisted($file)
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -169,7 +166,7 @@ class Scanner {
|
||||||
* @param String $file
|
* @param String $file
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function isIgnoredFile($file) {
|
public static function isIgnoredFile($file) {
|
||||||
if (pathinfo($file, PATHINFO_EXTENSION) === 'part'
|
if (pathinfo($file, PATHINFO_EXTENSION) === 'part'
|
||||||
|| \OC\Files\Filesystem::isFileBlacklisted($file)
|
|| \OC\Files\Filesystem::isFileBlacklisted($file)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -267,7 +267,7 @@ class View {
|
||||||
$path = $this->getRelativePath($absolutePath);
|
$path = $this->getRelativePath($absolutePath);
|
||||||
$exists = $this->file_exists($path);
|
$exists = $this->file_exists($path);
|
||||||
$run = true;
|
$run = true;
|
||||||
if ($this->fakeRoot == Filesystem::getRoot()) {
|
if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) {
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
\OC_Hook::emit(
|
\OC_Hook::emit(
|
||||||
Filesystem::CLASSNAME,
|
Filesystem::CLASSNAME,
|
||||||
|
@ -295,7 +295,7 @@ class View {
|
||||||
list ($count, $result) = \OC_Helper::streamCopy($data, $target);
|
list ($count, $result) = \OC_Helper::streamCopy($data, $target);
|
||||||
fclose($target);
|
fclose($target);
|
||||||
fclose($data);
|
fclose($data);
|
||||||
if ($this->fakeRoot == Filesystem::getRoot()) {
|
if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) ) {
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
\OC_Hook::emit(
|
\OC_Hook::emit(
|
||||||
Filesystem::CLASSNAME,
|
Filesystem::CLASSNAME,
|
||||||
|
@ -627,7 +627,7 @@ class View {
|
||||||
private function runHooks($hooks, $path, $post = false) {
|
private function runHooks($hooks, $path, $post = false) {
|
||||||
$prefix = ($post) ? 'post_' : '';
|
$prefix = ($post) ? 'post_' : '';
|
||||||
$run = true;
|
$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) {
|
foreach ($hooks as $hook) {
|
||||||
if ($hook != 'read') {
|
if ($hook != 'read') {
|
||||||
\OC_Hook::emit(
|
\OC_Hook::emit(
|
||||||
|
|
Loading…
Reference in New Issue