]> source.dussan.org Git - nextcloud-server.git/commitdiff
removed dead code for delShareKey
authorFlorin Peter <github@florin-peter.de>
Mon, 20 May 2013 19:24:39 +0000 (21:24 +0200)
committerFlorin Peter <github@florin-peter.de>
Mon, 20 May 2013 19:24:39 +0000 (21:24 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/keymanager.php

index 087ba3d893cbfa73a56b75f95443aee5e24652a3..90a93b4c52d9c70b15c38c89ba98373b2a568b6c 100644 (file)
@@ -67,13 +67,13 @@ class Hooks {
                // If migration not yet done\r
                if ( ! $migrationCompleted ) {\r
                \r
-                       $view1 = new \OC_FilesystemView( '/' . $params['uid'] );\r
+                       $userView = new \OC_FilesystemView( '/' . $params['uid'] );\r
                        \r
                        // Set legacy encryption key if it exists, to support \r
                        // depreciated encryption system\r
-                       if ( \r
-                               $view1->file_exists( 'encryption.key' )\r
-                               && $encLegacyKey = $view1->file_get_contents( 'encryption.key' ) \r
+                       if (\r
+                               $userView->file_exists( 'encryption.key' )\r
+                               && $encLegacyKey = $userView->file_get_contents( 'encryption.key' )\r
                        ) {\r
                        \r
                                $plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );\r
@@ -412,25 +412,11 @@ class Hooks {
 \r
                                // Unshare every user who no longer has access to the file\r
                                $delUsers = array_diff( $userIds, $sharingUsers);\r
-                               \r
-                               if ( !Keymanager::delShareKey( $view, $delUsers, $path ) ) {\r
-                               \r
-                                       $failed[] = $path;\r
-                               \r
-                               }\r
 \r
+                               // delete share key\r
+                               Keymanager::delShareKey( $view, $delUsers, $path );\r
                        }\r
 \r
-                       // If no attempts to set keyfiles failed\r
-                       if ( empty( $failed ) ) {\r
-                       \r
-                               return true;\r
-                               \r
-                       } else {\r
-                       \r
-                               return false;\r
-                               \r
-                       }\r
                }\r
        }\r
        \r
index 1bc334e7a172232370bd1fbaef4914166dfad60b..542b1cf28766cff95adadcc7af80437c7224d6e7 100755 (executable)
@@ -540,32 +540,23 @@ class Keymanager
 
                $shareKeyPath = '/' . $owner . '/files_encryption/share-keys/' . $filename;
 
-               $result = false;
-
                if ($view->is_dir($shareKeyPath)) {
 
-                       $localPath = \OC_Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
-                       $result = self::recursiveDelShareKeys($localPath, $userIds);
+                       $localPath = \OC\Files\Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
+                       self::recursiveDelShareKeys($localPath, $userIds);
 
                } else {
 
                        foreach ($userIds as $userId) {
-                               $view->unlink($shareKeyPath . '.' . $userId . '.shareKey');
-                       }
-
-                       $result = true;
-               }
-
-               if (!$result) {
 
-                       \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath, \OC_Log::ERROR);
+                               if (!$view->unlink($shareKeyPath . '.' . $userId . '.shareKey')) {
+                                       \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath . '.' . $userId . '.shareKey"', \OC_Log::ERROR);
+                               }
 
+                       }
                }
 
                \OC_FileProxy::$enabled = $proxyStatus;
-
-               return $result;
-
        }
 
        /**
@@ -582,13 +573,14 @@ class Keymanager
                }
                /** @var $matches array */
                foreach ($matches as $ma) {
-                       unlink($ma);
+                       if (!unlink($ma)) {
+                               \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $ma . '"', \OC_Log::ERROR);
+                       }
                }
                $subdirs = $directories = glob(preg_quote($dir) . '/*', GLOB_ONLYDIR);
                foreach ($subdirs as $subdir) {
                        self::recursiveDelShareKeys($subdir, $userIds);
                }
-               return true;
        }
 
        /**