]> source.dussan.org Git - nextcloud-server.git/commitdiff
rename isIgnoredFile to isPartialFile, remove check of blacklisted files in isPartial...
authorJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 10 May 2013 10:00:13 +0000 (12:00 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Fri, 10 May 2013 13:18:57 +0000 (15:18 +0200)
lib/files/cache/scanner.php
lib/files/view.php

index c721baed37d0d94f509607dc46e0cdf574511b6d..32872eb226ea20cb9a74fef8e1b522fad4ed9948 100644 (file)
@@ -62,7 +62,9 @@ class Scanner {
         * @return array with metadata of the scanned file
         */
        public function scanFile($file, $checkExisting = false) {
-               if (!self::isIgnoredFile($file)) {
+               if ( ! self::isPartialFile($file)
+                       and ! \OC\Files\Filesystem::isFileBlacklisted($file)
+               ) {
                        \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
                        $data = $this->getData($file);
                        if ($data) {
@@ -166,10 +168,8 @@ class Scanner {
         * @param String $file
         * @return boolean
         */
-       public static function isIgnoredFile($file) {
-               if (pathinfo($file, PATHINFO_EXTENSION) === 'part'
-                       || \OC\Files\Filesystem::isFileBlacklisted($file)
-               ) {
+       public static function isPartialFile($file) {
+               if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
                        return true;
                }
                return false;
index e056923734434a89f8d67c9789409e090327b6ce..2e8dfd3b4d04c42273340c5483024d56533010dc 100644 (file)
@@ -263,12 +263,13 @@ class View {
                if (is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier
                        $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
                        if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data)
-                               && Filesystem::isValidPath($path)
+                               and Filesystem::isValidPath($path)
+                               and ! Filesystem::isFileBlacklisted($path)
                        ) {
                                $path = $this->getRelativePath($absolutePath);
                                $exists = $this->file_exists($path);
                                $run = true;
-                               if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isIgnoredFile($path)) {
+                               if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
                                        if (!$exists) {
                                                \OC_Hook::emit(
                                                        Filesystem::CLASSNAME,
@@ -296,7 +297,7 @@ class View {
                                        list ($count, $result) = \OC_Helper::streamCopy($data, $target);
                                        fclose($target);
                                        fclose($data);
-                                       if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isIgnoredFile($path)) {
+                                       if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
                                                if (!$exists) {
                                                        \OC_Hook::emit(
                                                                Filesystem::CLASSNAME,
@@ -340,6 +341,7 @@ class View {
                        \OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2)
                        and Filesystem::isValidPath($path2)
                        and Filesystem::isValidPath($path1)
+                       and ! Filesystem::isFileBlacklisted($path2)
                ) {
                        $path1 = $this->getRelativePath($absolutePath1);
                        $path2 = $this->getRelativePath($absolutePath2);
@@ -404,6 +406,7 @@ class View {
                        \OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2)
                        and Filesystem::isValidPath($path2)
                        and Filesystem::isValidPath($path1)
+                       and ! Filesystem::isFileBlacklisted($path2)
                ) {
                        $path1 = $this->getRelativePath($absolutePath1);
                        $path2 = $this->getRelativePath($absolutePath2);
@@ -606,7 +609,10 @@ class View {
        private function basicOperation($operation, $path, $hooks = array(), $extraParam = null) {
                $postFix = (substr($path, -1, 1) === '/') ? '/' : '';
                $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
-               if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and Filesystem::isValidPath($path)) {
+               if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam)
+                       and Filesystem::isValidPath($path)
+                       and ! Filesystem::isFileBlacklisted($path)
+               ) {
                        $path = $this->getRelativePath($absolutePath);
                        if ($path == null) {
                                return false;
@@ -635,7 +641,7 @@ class View {
        private function runHooks($hooks, $path, $post = false) {
                $prefix = ($post) ? 'post_' : '';
                $run = true;
-               if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isIgnoredFile($path)) {
+               if (Filesystem::$loaded and $this->fakeRoot == Filesystem::getRoot()) {
                        foreach ($hooks as $hook) {
                                if ($hook != 'read') {
                                        \OC_Hook::emit(