diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-31 12:11:46 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 13:30:29 +0200 |
commit | 3458b5ab4ce7d88e95afcdb3ed0e3ff79ad924c4 (patch) | |
tree | 87ea4cd301c017224db970c3ff919acd4401181a /apps/files_trashbin/lib/trashbin.php | |
parent | f5638d9163d7f46752351eb90ba2f3b381d68dc0 (diff) | |
download | nextcloud-server-3458b5ab4ce7d88e95afcdb3ed0e3ff79ad924c4.tar.gz nextcloud-server-3458b5ab4ce7d88e95afcdb3ed0e3ff79ad924c4.zip |
Remove old encryption left overs from trashbin
Diffstat (limited to 'apps/files_trashbin/lib/trashbin.php')
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 8d352e36311..1c880735b5a 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -214,7 +214,6 @@ class Trashbin { 'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp))); $size += self::retainVersions($file_path, $filename, $timestamp); - $size += self::retainEncryptionKeys($file_path, $filename, $timestamp); // if owner !== user we need to also add a copy to the owners trash if ($user !== $owner) { @@ -278,51 +277,6 @@ class Trashbin { } /** - * Move encryption keys to trash so that they can be restored later - * - * @param string $file_path path to original file - * @param string $filename of deleted file - * @param integer $timestamp when the file was deleted - * - * @return int size of encryption keys - */ - private static function retainEncryptionKeys($file_path, $filename, $timestamp) { - $size = 0; - - if (\OCP\App::isEnabled('files_encryption')) { - - $user = \OCP\User::getUser(); - $rootView = new \OC\Files\View('/'); - - list($owner, $ownerPath) = self::getUidAndFilename($file_path); - - // file has been deleted in between - if (empty($ownerPath)) { - return 0; - } - - $util = new \OCA\Files_Encryption\Util($rootView, $user); - - $baseDir = '/files_encryption/'; - if (!$util->isSystemWideMountPoint($ownerPath)) { - $baseDir = $owner . $baseDir; - } - - $keyfiles = \OC\Files\Filesystem::normalizePath($baseDir . '/keys/' . $ownerPath); - - if ($rootView->is_dir($keyfiles)) { - $size += self::calculateSize(new \OC\Files\View($keyfiles)); - if ($owner !== $user) { - self::copy_recursive($keyfiles, $owner . '/files_trashbin/keys/' . basename($ownerPath) . '.d' . $timestamp, $rootView); - } - $rootView->rename($keyfiles, $user . '/files_trashbin/keys/' . $filename . '.d' . $timestamp); - } - - } - return $size; - } - - /** * restore files from trash bin * * @param string $file path to the deleted file @@ -372,7 +326,6 @@ class Trashbin { 'trashPath' => \OC\Files\Filesystem::normalizePath($file))); self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); - self::restoreEncryptionKeys($view, $file, $filename, $uniqueFilename, $location, $timestamp); if ($timestamp) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?'); @@ -433,60 +386,6 @@ class Trashbin { } /** - * restore encryption keys from trash bin - * - * @param \OC\Files\View $view - * @param string $file complete path to file - * @param string $filename name of file - * @param string $uniqueFilename new file name to restore the file without overwriting existing files - * @param string $location location of file - * @param int $timestamp deletion time - * @return bool - */ - private static function restoreEncryptionKeys(\OC\Files\View $view, $file, $filename, $uniqueFilename, $location, $timestamp) { - - if (\OCP\App::isEnabled('files_encryption')) { - $user = \OCP\User::getUser(); - $rootView = new \OC\Files\View('/'); - - $target = \OC\Files\Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename); - - list($owner, $ownerPath) = self::getUidAndFilename($target); - - // file has been deleted in between - if (empty($ownerPath)) { - return false; - } - - $util = new \OCA\Files_Encryption\Util($rootView, $user); - - $baseDir = '/files_encryption/'; - if (!$util->isSystemWideMountPoint($ownerPath)) { - $baseDir = $owner . $baseDir; - } - - $source_location = dirname($file); - - if ($view->is_dir('/files_trashbin/keys/' . $file)) { - if ($source_location != '.') { - $keyfile = \OC\Files\Filesystem::normalizePath($user . '/files_trashbin/keys/' . $source_location . '/' . $filename); - } else { - $keyfile = \OC\Files\Filesystem::normalizePath($user . '/files_trashbin/keys/' . $filename); - } - } - - if ($timestamp) { - $keyfile .= '.d' . $timestamp; - } - - if ($rootView->is_dir($keyfile)) { - $rootView->rename($keyfile, $baseDir . '/keys/' . $ownerPath); - } - - } - } - - /** * delete all files from the trash */ public static function deleteAll() { @@ -501,7 +400,6 @@ class Trashbin { return true; } - /** * delete file from trash bin permanently * |