From 4dd1a49a686462bc846e10623e97611ef171a731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 12 May 2014 16:20:07 +0200 Subject: [PATCH 1/4] remove legacy aka deprecated code: OC_Filesystem --- apps/files_encryption/lib/helper.php | 2 +- apps/files_encryption/lib/proxy.php | 6 +- apps/files_encryption/lib/util.php | 2 +- apps/files_versions/lib/versions.php | 2 +- lib/private/legacy/filesystem.php | 415 --------------------------- 5 files changed, 6 insertions(+), 421 deletions(-) delete mode 100644 lib/private/legacy/filesystem.php diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 8cbbe8a45a..82a323d5e1 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -332,7 +332,7 @@ class Helper { * @param \OC\Files\View $view */ public static function mkdirr($path, $view) { - $dirname = \OC_Filesystem::normalizePath(dirname($path)); + $dirname = \OC\Files\Filesystem::normalizePath(dirname($path)); $dirParts = explode('/', $dirname); $dir = ""; foreach ($dirParts as $part) { diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 7be82c313e..5dc407f796 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -101,7 +101,7 @@ class Proxy extends \OC_FileProxy { // create random cache folder $cacheFolder = rand(); - $path_slices = explode('/', \OC_Filesystem::normalizePath($path)); + $path_slices = explode('/', \OC\Files\Filesystem::normalizePath($path)); $path_slices[2] = "cache/".$cacheFolder; $tmpPath = implode('/', $path_slices); @@ -125,7 +125,7 @@ class Proxy extends \OC_FileProxy { // in the post proxy $tmpFileInfo = $view->getFileInfo($tmpPath); if ( isset($tmpFileInfo['size']) ) { - self::$unencryptedSizes[\OC_Filesystem::normalizePath($path)] = $tmpFileInfo['size']; + self::$unencryptedSizes[\OC\Files\Filesystem::normalizePath($path)] = $tmpFileInfo['size']; } // remove our temp file @@ -150,7 +150,7 @@ class Proxy extends \OC_FileProxy { * @return mixed */ public function postFile_put_contents($path, $result) { - $normalizedPath = \OC_Filesystem::normalizePath($path); + $normalizedPath = \OC\Files\Filesystem::normalizePath($path); if ( isset(self::$unencryptedSizes[$normalizedPath]) ) { $view = new \OC_FilesystemView('/'); $view->putFileInfo($normalizedPath, diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 6372ab31b6..fb0067171e 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1361,7 +1361,7 @@ class Util { return array( $fileOwnerUid, - \OC_Filesystem::normalizePath($filename) + \OC\Files\Filesystem::normalizePath($filename) ); } } diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 290264a90c..67acd5369a 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -579,7 +579,7 @@ class Storage { * @param \OC\Files\View $view view on data/user/ */ private static function createMissingDirectories($filename, $view) { - $dirname = \OC_Filesystem::normalizePath(dirname($filename)); + $dirname = \OC\Files\Filesystem::normalizePath(dirname($filename)); $dirParts = explode('/', $dirname); $dir = "/files_versions"; foreach ($dirParts as $part) { diff --git a/lib/private/legacy/filesystem.php b/lib/private/legacy/filesystem.php deleted file mode 100644 index 34f92b357c..0000000000 --- a/lib/private/legacy/filesystem.php +++ /dev/null @@ -1,415 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -/** - * Class for abstraction of filesystem functions - * This class won't call any filesystem functions for itself but but will pass them to the correct OC_Filestorage object - * this class should also handle all the file permission related stuff - * - * Hooks provided: - * read(path) - * write(path, &run) - * post_write(path) - * create(path, &run) (when a file is created, both create and write will be emitted in that order) - * post_create(path) - * delete(path, &run) - * post_delete(path) - * rename(oldpath,newpath, &run) - * post_rename(oldpath,newpath) - * copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emitted in that order) - * post_rename(oldpath,newpath) - * - * the &run parameter can be set to false to prevent the operation from occurring - */ - -/** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ -class OC_Filesystem { - /** - * get the mountpoint of the storage object for a path - * ( note: because a storage is not always mounted inside the fakeroot, the - * returned mountpoint is relative to the absolute root of the filesystem - * and doesn't take the chroot into account ) - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return string - */ - static public function getMountPoint($path) { - return \OC\Files\Filesystem::getMountPoint($path); - } - - /** - * resolve a path to a storage and internal path - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return array consisting of the storage and the internal path - */ - static public function resolvePath($path) { - return \OC\Files\Filesystem::resolvePath($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function init($user, $root) { - return \OC\Files\Filesystem::init($user, $root); - } - - /** - * get the default filesystem view - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @return \OC\Files\View - */ - static public function getView() { - return \OC\Files\Filesystem::getView(); - } - - /** - * tear down the filesystem, removing all storage providers - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function tearDown() { - \OC\Files\Filesystem::tearDown(); - } - - /** - * @brief get the relative path of the root data directory for the current user - * @return string - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * Returns path like /admin/files - */ - static public function getRoot() { - return \OC\Files\Filesystem::getRoot(); - } - - /** - * clear all mounts and storage backends - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - public static function clearMounts() { - \OC\Files\Filesystem::clearMounts(); - } - - /** - * mount an \OC\Files\Storage\Storage in our virtual filesystem - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param \OC\Files\Storage\Storage $class - * @param array $arguments - * @param string $mountpoint - */ - static public function mount($class, $arguments, $mountpoint) { - \OC\Files\Filesystem::mount($class, $arguments, $mountpoint); - } - - /** - * return the path to a local version of the file - * we need this because we can't know if a file is stored local or not from - * outside the filestorage and for some purposes a local file is needed - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return string - */ - static public function getLocalFile($path) { - return \OC\Files\Filesystem::getLocalFile($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return string - */ - static public function getLocalFolder($path) { - return \OC\Files\Filesystem::getLocalFolder($path); - } - - /** - * return path to file which reflects one visible in browser - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return string - */ - static public function getLocalPath($path) { - return \OC\Files\Filesystem::getLocalPath($path); - } - - /** - * check if the requested path is valid - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @return bool - */ - static public function isValidPath($path) { - return \OC\Files\Filesystem::isValidPath($path); - } - - /** - * checks if a file is blacklisted for storage in the filesystem - * Listens to write and rename hooks - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param array $data from hook - */ - static public function isBlacklisted($data) { - \OC\Files\Filesystem::isBlacklisted($data); - } - - /** - * following functions are equivalent to their php builtin equivalents for arguments/return values. - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function mkdir($path) { - return \OC\Files\Filesystem::mkdir($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function rmdir($path) { - return \OC\Files\Filesystem::rmdir($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function opendir($path) { - return \OC\Files\Filesystem::opendir($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function readdir($path) { - return \OC\Files\Filesystem::readdir($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function is_dir($path) { - return \OC\Files\Filesystem::is_dir($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function is_file($path) { - return \OC\Files\Filesystem::is_file($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function stat($path) { - return \OC\Files\Filesystem::stat($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function filetype($path) { - return \OC\Files\Filesystem::filetype($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function filesize($path) { - return \OC\Files\Filesystem::filesize($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function readfile($path) { - return \OC\Files\Filesystem::readfile($path); - } - - /** - * @deprecated Replaced by isReadable() as part of CRUDS - */ - static public function is_readable($path) { - return \OC\Files\Filesystem::isReadable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function isCreatable($path) { - return \OC\Files\Filesystem::isCreatable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function isReadable($path) { - return \OC\Files\Filesystem::isReadable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function isUpdatable($path) { - return \OC\Files\Filesystem::isUpdatable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function isDeletable($path) { - return \OC\Files\Filesystem::isDeletable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function isSharable($path) { - return \OC\Files\Filesystem::isSharable($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function file_exists($path) { - return \OC\Files\Filesystem::file_exists($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function filemtime($path) { - return \OC\Files\Filesystem::filemtime($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function touch($path, $mtime = null) { - return \OC\Files\Filesystem::touch($path, $mtime); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function file_get_contents($path) { - return \OC\Files\Filesystem::file_get_contents($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function file_put_contents($path, $data) { - return \OC\Files\Filesystem::file_put_contents($path, $data); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function unlink($path) { - return \OC\Files\Filesystem::unlink($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function rename($path1, $path2) { - return \OC\Files\Filesystem::rename($path1, $path2); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function copy($path1, $path2) { - return \OC\Files\Filesystem::copy($path1, $path2); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function fopen($path, $mode) { - return \OC\Files\Filesystem::fopen($path, $mode); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function toTmpFile($path) { - return \OC\Files\Filesystem::toTmpFile($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function fromTmpFile($tmpFile, $path) { - return \OC\Files\Filesystem::fromTmpFile($tmpFile, $path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function getMimeType($path) { - return \OC\Files\Filesystem::getMimeType($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function hash($type, $path, $raw = false) { - return \OC\Files\Filesystem::hash($type, $path, $raw); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function free_space($path = '/') { - return \OC\Files\Filesystem::free_space($path); - } - - /** - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - */ - static public function search($query) { - return \OC\Files\Filesystem::search($query); - } - - /** - * check if a file or folder has been updated since $time - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @param int $time - * @return bool - */ - static public function hasUpdated($path, $time) { - return \OC\Files\Filesystem::hasUpdated($path, $time); - } - - /** - * normalize a path - * - * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem - * @param string $path - * @param bool $stripTrailingSlash - * @return string - */ - public static function normalizePath($path, $stripTrailingSlash = true) { - return \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash); - } -} From 33987eea8302e5b8f7889c934debdc2b9dd0296c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 12 May 2014 16:23:33 +0200 Subject: [PATCH 2/4] remove legacy aka deprecated code: OC_Cache --- apps/user_ldap/lib/connection.php | 2 +- apps/user_ldap/lib/proxy.php | 2 +- core/avatar/controller.php | 8 ++++---- lib/private/legacy/cache.php | 10 ---------- lib/private/route/router.php | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 lib/private/legacy/cache.php diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 173c4ebcc2..1ac803d374 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -56,7 +56,7 @@ class Connection extends LDAPUtility { if($memcache->isAvailable()) { $this->cache = $memcache->create(); } else { - $this->cache = \OC_Cache::getGlobalCache(); + $this->cache = \OC\Cache::getGlobalCache(); } $this->hasPagedResultSupport = $this->ldap->hasPagedResultSupport(); diff --git a/apps/user_ldap/lib/proxy.php b/apps/user_ldap/lib/proxy.php index 0eb294eb7a..1e10164894 100644 --- a/apps/user_ldap/lib/proxy.php +++ b/apps/user_ldap/lib/proxy.php @@ -31,7 +31,7 @@ abstract class Proxy { public function __construct(ILDAPWrapper $ldap) { $this->ldap = $ldap; - $this->cache = \OC_Cache::getGlobalCache(); + $this->cache = \OC\Cache::getGlobalCache(); } private function addAccess($configPrefix) { diff --git a/core/avatar/controller.php b/core/avatar/controller.php index 2269382446..06efbec3f3 100644 --- a/core/avatar/controller.php +++ b/core/avatar/controller.php @@ -71,7 +71,7 @@ class Controller { $image = new \OC_Image($newAvatar); if ($image->valid()) { - \OC_Cache::set('tmpavatar', $image->data(), 7200); + \OC\Cache::set('tmpavatar', $image->data(), 7200); \OC_JSON::error(array("data" => "notsquare")); } else { $l = new \OC_L10n('core'); @@ -109,7 +109,7 @@ class Controller { \OC_JSON::checkLoggedIn(); \OC_JSON::callCheck(); - $tmpavatar = \OC_Cache::get('tmpavatar'); + $tmpavatar = \OC\Cache::get('tmpavatar'); if (is_null($tmpavatar)) { $l = new \OC_L10n('core'); \OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again")) )); @@ -136,7 +136,7 @@ class Controller { return; } - $tmpavatar = \OC_Cache::get('tmpavatar'); + $tmpavatar = \OC\Cache::get('tmpavatar'); if (is_null($tmpavatar)) { $l = new \OC_L10n('core'); \OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again")) )); @@ -149,7 +149,7 @@ class Controller { $avatar = new \OC_Avatar($user); $avatar->set($image->data()); // Clean up - \OC_Cache::remove('tmpavatar'); + \OC\Cache::remove('tmpavatar'); \OC_JSON::success(); } catch (\Exception $e) { \OC_JSON::error(array("data" => array("message" => $e->getMessage()) )); diff --git a/lib/private/legacy/cache.php b/lib/private/legacy/cache.php deleted file mode 100644 index f915eb516b..0000000000 --- a/lib/private/legacy/cache.php +++ /dev/null @@ -1,10 +0,0 @@ -cacheKey = \OC_Cache::generateCacheKeyFromFiles($files); + $this->cacheKey = \OC\Cache::generateCacheKeyFromFiles($files); } return $this->cacheKey; } From e0dd69e4e605b7f4a2af4cdc8a15a8dfc1c0902a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 12 May 2014 16:30:39 +0200 Subject: [PATCH 3/4] remove legacy aka deprecated code: OC_FilesystemView --- .../ajax/changeRecoveryPassword.php | 2 +- .../ajax/getMigrationStatus.php | 2 +- apps/files_encryption/ajax/userrecovery.php | 2 +- apps/files_encryption/appinfo/app.php | 2 +- apps/files_encryption/hooks/hooks.php | 20 ++++----- apps/files_encryption/lib/helper.php | 4 +- apps/files_encryption/lib/keymanager.php | 44 +++++++++---------- apps/files_encryption/lib/proxy.php | 10 ++--- apps/files_encryption/lib/session.php | 2 +- apps/files_encryption/lib/stream.php | 2 +- apps/files_encryption/lib/util.php | 8 ++-- apps/files_encryption/settings-personal.php | 2 +- apps/files_encryption/tests/crypt.php | 8 ++-- apps/files_encryption/tests/hooks.php | 8 ++-- apps/files_encryption/tests/keymanager.php | 6 +-- apps/files_encryption/tests/proxy.php | 6 +-- apps/files_encryption/tests/share.php | 8 ++-- apps/files_encryption/tests/stream.php | 4 +- apps/files_encryption/tests/trashbin.php | 4 +- apps/files_encryption/tests/util.php | 12 ++--- apps/files_encryption/tests/webdav.php | 4 +- apps/files_sharing/tests/base.php | 4 +- apps/files_sharing/tests/cache.php | 2 +- apps/files_trashbin/lib/trashbin.php | 6 +-- lib/private/files/view.php | 2 +- lib/private/legacy/filesystemview.php | 9 ---- settings/ajax/decryptall.php | 2 +- settings/changepassword/controller.php | 2 +- 28 files changed, 89 insertions(+), 98 deletions(-) delete mode 100644 lib/private/legacy/filesystemview.php diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php index 945f054ea8..f020e52607 100644 --- a/apps/files_encryption/ajax/changeRecoveryPassword.php +++ b/apps/files_encryption/ajax/changeRecoveryPassword.php @@ -23,7 +23,7 @@ $oldPassword = $_POST['oldPassword']; $newPassword = $_POST['newPassword']; $view = new \OC\Files\View('/'); -$util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \OCP\User::getUser()); +$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser()); $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; diff --git a/apps/files_encryption/ajax/getMigrationStatus.php b/apps/files_encryption/ajax/getMigrationStatus.php index 7c9e0dcc51..a882840193 100644 --- a/apps/files_encryption/ajax/getMigrationStatus.php +++ b/apps/files_encryption/ajax/getMigrationStatus.php @@ -18,7 +18,7 @@ $migrationStatus = Util::MIGRATION_COMPLETED; if ($loginname !== '' && $password !== '') { $username = \OCP\User::checkPassword($loginname, $password); if ($username) { - $util = new Util(new \OC_FilesystemView('/'), $username); + $util = new Util(new \OC\Files\View('/'), $username); $migrationStatus = $util->getMigrationStatus(); } } diff --git a/apps/files_encryption/ajax/userrecovery.php b/apps/files_encryption/ajax/userrecovery.php index d6c94bde81..81ca1459a9 100644 --- a/apps/files_encryption/ajax/userrecovery.php +++ b/apps/files_encryption/ajax/userrecovery.php @@ -19,7 +19,7 @@ if ( ) { $userId = \OCP\USER::getUser(); - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $util = new \OCA\Encryption\Util($view, $userId); // Save recovery preference to DB diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index 21de421c19..104e8568ca 100644 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -40,7 +40,7 @@ if (!OC_Config::getValue('maintenance', false)) { \OC_Util::setupFS(); } - $view = new OC_FilesystemView('/'); + $view = new OC\Files\View('/'); $sessionReady = OCA\Encryption\Helper::checkRequirements(); if($sessionReady) { diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 5f0494e62c..c9ffeb454a 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -48,7 +48,7 @@ class Hooks { $l = new \OC_L10N('files_encryption'); - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); // ensure filesystem is loaded if(!\OC\Files\Filesystem::$loaded) { @@ -93,7 +93,7 @@ class Hooks { // If migration not yet done if ($ready) { - $userView = new \OC_FilesystemView('/' . $params['uid']); + $userView = new \OC\Files\View('/' . $params['uid']); // Set legacy encryption key if it exists, to support // depreciated encryption system @@ -142,7 +142,7 @@ class Hooks { public static function postCreateUser($params) { if (\OCP\App::isEnabled('files_encryption')) { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $util = new Util($view, $params['uid']); Helper::setupUser($util, $params['password']); } @@ -155,7 +155,7 @@ class Hooks { public static function postDeleteUser($params) { if (\OCP\App::isEnabled('files_encryption')) { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); // cleanup public key $publicKey = '/public-keys/' . $params['uid'] . '.public.key'; @@ -196,7 +196,7 @@ class Hooks { // the necessary keys) if (Crypt::mode() === 'server') { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); if ($params['uid'] === \OCP\User::getUser()) { @@ -308,7 +308,7 @@ class Hooks { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $session = new \OCA\Encryption\Session($view); $userId = \OCP\User::getUser(); $util = new Util($view, $userId); @@ -350,7 +350,7 @@ class Hooks { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $userId = \OCP\User::getUser(); $util = new Util($view, $userId); $path = \OC\Files\Filesystem::getPath($params['fileSource']); @@ -403,7 +403,7 @@ class Hooks { */ public static function preRename($params) { $user = \OCP\User::getUser(); - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $util = new Util($view, $user); list($ownerOld, $pathOld) = $util->getUidAndFilename($params['oldpath']); @@ -437,7 +437,7 @@ class Hooks { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $session = new \OCA\Encryption\Session($view); $userId = \OCP\User::getUser(); $util = new Util($view, $userId); @@ -610,7 +610,7 @@ class Hooks { return true; } - $util = new Util(new \OC_FilesystemView('/'), \OCP\USER::getUser()); + $util = new Util(new \OC\Files\View('/'), \OCP\USER::getUser()); list($owner, $ownerPath) = $util->getUidAndFilename($path); self::$deleteFiles[$params[\OC\Files\Filesystem::signal_param_path]] = array( diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 82a323d5e1..c3a31ff9fb 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -153,7 +153,7 @@ class Helper { $return = true; } else { // get recovery key and check the password - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \OCP\User::getUser()); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser()); $return = $util->checkRecoveryPassword($recoveryPassword); if ($return) { $appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1); @@ -214,7 +214,7 @@ class Helper { * @return bool */ public static function adminDisableRecovery($recoveryPassword) { - $util = new Util(new \OC_FilesystemView('/'), \OCP\User::getUser()); + $util = new Util(new \OC\Files\View('/'), \OCP\User::getUser()); $return = $util->checkRecoveryPassword($recoveryPassword); if ($return) { diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index cb9f5e64af..5aa8a6ab06 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -32,12 +32,12 @@ class Keymanager { /** * @brief retrieve the ENCRYPTED private key from a user * - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param string $user * @return string private key or false (hopefully) * @note the key returned by this method must be decrypted before use */ - public static function getPrivateKey(\OC_FilesystemView $view, $user) { + public static function getPrivateKey(\OC\Files\View $view, $user) { $path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key'; $key = false; @@ -56,11 +56,11 @@ class Keymanager { /** * @brief retrieve public key for a specified user - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param $userId * @return string public key or false */ - public static function getPublicKey(\OC_FilesystemView $view, $userId) { + public static function getPublicKey(\OC\Files\View $view, $userId) { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; @@ -75,11 +75,11 @@ class Keymanager { /** * @brief Retrieve a user's public and private key - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param $userId * @return array keys: privateKey, publicKey */ - public static function getUserKeys(\OC_FilesystemView $view, $userId) { + public static function getUserKeys(\OC\Files\View $view, $userId) { return array( 'publicKey' => self::getPublicKey($view, $userId), @@ -90,11 +90,11 @@ class Keymanager { /** * @brief Retrieve public keys for given users - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param array $userIds * @return array of public keys for the specified users */ - public static function getPublicKeys(\OC_FilesystemView $view, array $userIds) { + public static function getPublicKeys(\OC\Files\View $view, array $userIds) { $keys = array(); @@ -111,7 +111,7 @@ class Keymanager { /** * @brief store file encryption key * - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param \OCA\Encryption\Util $util * @param string $path relative path of the file, including filename * @param string $catfile keyfile content @@ -119,7 +119,7 @@ class Keymanager { * @note The keyfile is not encrypted here. Client code must * asymmetrically encrypt the keyfile before passing it to this method */ - public static function setFileKey(\OC_FilesystemView $view, $util, $path, $catfile) { + public static function setFileKey(\OC\Files\View $view, $util, $path, $catfile) { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; @@ -168,7 +168,7 @@ class Keymanager { /** * @brief retrieve keyfile for an encrypted file - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param \OCA\Encryption\Util $util * @param string|false $filePath * @internal param \OCA\Encryption\file $string name @@ -212,7 +212,7 @@ class Keymanager { /** * @brief Delete a keyfile * - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param string $path path of the file the key belongs to * @param string $userId the user to whom the file belongs * @return bool Outcome of unlink operation @@ -276,7 +276,7 @@ class Keymanager { $user = \OCP\User::getUser(); - $view = new \OC_FilesystemView('/' . $user . '/files_encryption'); + $view = new \OC\Files\View('/' . $user . '/files_encryption'); $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; @@ -295,14 +295,14 @@ class Keymanager { /** * @brief store share key * - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param string $path where the share key is stored * @param $shareKey * @return bool true/false * @note The keyfile is not encrypted here. Client code must * asymmetrically encrypt the keyfile before passing it to this method */ - private static function setShareKey(\OC_FilesystemView $view, $path, $shareKey) { + private static function setShareKey(\OC\Files\View $view, $path, $shareKey) { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; @@ -320,13 +320,13 @@ class Keymanager { /** * @brief store multiple share keys for a single file - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param \OCA\Encryption\Util $util * @param string $path * @param array $shareKeys * @return bool */ - public static function setShareKeys(\OC_FilesystemView $view, $util, $path, array $shareKeys) { + public static function setShareKeys(\OC\Files\View $view, $util, $path, array $shareKeys) { // $shareKeys must be an array with the following format: // [userId] => [encrypted key] @@ -366,7 +366,7 @@ class Keymanager { /** * @brief retrieve shareKey for an encrypted file - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param string $userId * @param \OCA\Encryption\Util $util * @param string $filePath @@ -374,7 +374,7 @@ class Keymanager { * @note The sharekey returned is encrypted. Decryption * of the keyfile must be performed by client code */ - public static function getShareKey(\OC_FilesystemView $view, $userId, $util, $filePath) { + public static function getShareKey(\OC\Files\View $view, $userId, $util, $filePath) { // try reusing key file if part file $proxyStatus = \OC_FileProxy::$enabled; @@ -407,7 +407,7 @@ class Keymanager { /** * @brief delete all share keys of a given file - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param string $userId owner of the file * @param string $filePath path to the file, relative to the owners file dir */ @@ -447,7 +447,7 @@ class Keymanager { /** * @brief Delete a single user's shareKey for a single file */ - public static function delShareKey(\OC_FilesystemView $view, $userIds, $filePath) { + public static function delShareKey(\OC\Files\View $view, $userIds, $filePath) { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; @@ -516,7 +516,7 @@ class Keymanager { * @param string|boolean $path * @param string $basePath */ - public static function keySetPreparation(\OC_FilesystemView $view, $path, $basePath, $userId) { + public static function keySetPreparation(\OC\Files\View $view, $path, $basePath, $userId) { $targetPath = ltrim($path, '/'); diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 5dc407f796..919853107a 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -65,7 +65,7 @@ class Proxy extends \OC_FileProxy { return false; } - $view = new \OC_FilesystemView(''); + $view = new \OC\Files\View(''); $util = new Util($view, $userId); // for write operation we always encrypt the files, for read operations @@ -90,7 +90,7 @@ class Proxy extends \OC_FileProxy { if (!is_resource($data)) { // get root view - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); // get relative path $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path); @@ -152,7 +152,7 @@ class Proxy extends \OC_FileProxy { public function postFile_put_contents($path, $result) { $normalizedPath = \OC\Files\Filesystem::normalizePath($path); if ( isset(self::$unencryptedSizes[$normalizedPath]) ) { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $view->putFileInfo($normalizedPath, array('encrypted' => true, 'unencrypted_size' => self::$unencryptedSizes[$normalizedPath])); unset(self::$unencryptedSizes[$normalizedPath]); @@ -168,7 +168,7 @@ class Proxy extends \OC_FileProxy { public function postFile_get_contents($path, $data) { $plainData = null; - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); // init session $session = new \OCA\Encryption\Session($view); @@ -291,7 +291,7 @@ class Proxy extends \OC_FileProxy { */ public function postFileSize($path, $size) { - $view = new \OC_FilesystemView('/'); + $view = new \OC\Files\View('/'); $userId = Helper::getUser($path); $util = new Util($view, $userId); diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php index 3daaa06425..19b669a27f 100644 --- a/apps/files_encryption/lib/session.php +++ b/apps/files_encryption/lib/session.php @@ -37,7 +37,7 @@ class Session { /** * @brief if session is started, check if ownCloud key pair is set up, if not create it - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * * @note The ownCloud key pair is used to allow public link sharing even if encryption is enabled */ diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index df5de55886..8b575174e2 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -91,7 +91,7 @@ class Stream { $this->newFile = false; if (!isset($this->rootView)) { - $this->rootView = new \OC_FilesystemView('/'); + $this->rootView = new \OC\Files\View('/'); } $this->session = new \OCA\Encryption\Session($this->rootView); diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index fb0067171e..37fdcaceaa 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -26,7 +26,7 @@ namespace OCA\Encryption; /** * @brief Class for utilities relating to encrypted file storage system - * @param \OC_FilesystemView $view expected to have OC '/' as root path + * @param \OC\Files\View $view expected to have OC '/' as root path * @param string $userId ID of the logged in user * @param int $client indicating status of client side encryption. Currently * unused, likely to become obsolete shortly @@ -38,7 +38,7 @@ class Util { const MIGRATION_IN_PROGRESS = -1; // migration is running const MIGRATION_OPEN = 0; // user still needs to be migrated - private $view; // OC_FilesystemView object for filesystem operations + private $view; // OC\Files\View object for filesystem operations private $userId; // ID of the user we use to encrypt/decrypt files private $keyId; // ID of the key we want to manipulate private $client; // Client side encryption mode flag @@ -53,7 +53,7 @@ class Util { private $isPublic; /** - * @param \OC_FilesystemView $view + * @param \OC\Files\View $view * @param $userId * @param bool $client */ @@ -1522,7 +1522,7 @@ class Util { if ($item['type'] === 'dir') { $this->addRecoveryKeys($filePath . '/'); } else { - $session = new \OCA\Encryption\Session(new \OC_FilesystemView('/')); + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); $sharingEnabled = \OCP\Share::isEnabled(); // remove '.key' extension from path e.g. 'file.txt.key' to 'file.txt' $file = substr($filePath, 0, -4); diff --git a/apps/files_encryption/settings-personal.php b/apps/files_encryption/settings-personal.php index 09e9df0535..e9875518f6 100644 --- a/apps/files_encryption/settings-personal.php +++ b/apps/files_encryption/settings-personal.php @@ -12,7 +12,7 @@ $tmpl = new OCP\Template('files_encryption', 'settings-personal'); $user = \OCP\USER::getUser(); -$view = new \OC_FilesystemView('/'); +$view = new \OC\Files\View('/'); $util = new \OCA\Encryption\Util($view, $user); $session = new \OCA\Encryption\Session($view); diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php index 123943ea26..83c2ab30b8 100755 --- a/apps/files_encryption/tests/crypt.php +++ b/apps/files_encryption/tests/crypt.php @@ -34,7 +34,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { public $dataUrl; public $dataShort; /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $view; public $legacyEncryptedData; @@ -79,7 +79,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $this->genPublicKey = $keypair['publicKey']; $this->genPrivateKey = $keypair['privateKey']; - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); // remember files_trashbin state $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin'); @@ -157,7 +157,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { $filename = 'tmp-' . uniqid() . '.test'; - $util = new Encryption\Util(new \OC_FilesystemView(), $this->userId); + $util = new Encryption\Util(new \OC\Files\View(), $this->userId); $cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/'. $filename, $this->dataShort); @@ -216,7 +216,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase { // Generate a a random filename $filename = 'tmp-' . uniqid() . '.test'; - $util = new Encryption\Util(new \OC_FilesystemView(), $this->userId); + $util = new Encryption\Util(new \OC\Files\View(), $this->userId); // Save long data as encrypted file using stream wrapper $cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/' . $filename, $this->dataLong . $this->dataLong); diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php index 047084ca2c..ee534f708c 100644 --- a/apps/files_encryption/tests/hooks.php +++ b/apps/files_encryption/tests/hooks.php @@ -40,7 +40,7 @@ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { const TEST_ENCRYPTION_HOOKS_USER2 = "test-encryption-hooks-user2"; /** - * @var \OC_FilesystemView + * @var \OC\Files\View */ public $user1View; // view on /data/user1/files public $user2View; // view on /data/user2/files @@ -83,9 +83,9 @@ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { \OC_User::setUserId(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1); // init filesystem view - $this->user1View = new \OC_FilesystemView('/'. \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1 . '/files'); - $this->user2View = new \OC_FilesystemView('/'. \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2 . '/files'); - $this->rootView = new \OC_FilesystemView('/'); + $this->user1View = new \OC\Files\View('/'. \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1 . '/files'); + $this->user2View = new \OC\Files\View('/'. \Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2 . '/files'); + $this->rootView = new \OC\Files\View('/'); // init short data $this->data = 'hats'; diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php index 0caf12e91a..2bd2ddc8e6 100644 --- a/apps/files_encryption/tests/keymanager.php +++ b/apps/files_encryption/tests/keymanager.php @@ -29,7 +29,7 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { public $pass; public $stateFilesTrashbin; /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $view; public $randomKey; @@ -68,7 +68,7 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase { $this->genPublicKey = $keypair['publicKey']; $this->genPrivateKey = $keypair['privateKey']; - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); \OC_User::setUserId(\Test_Encryption_Keymanager::TEST_USER); $this->userId = \Test_Encryption_Keymanager::TEST_USER; @@ -257,4 +257,4 @@ class TestProtectedKeymanagerMethods extends \OCA\Encryption\Keymanager { public static function testGetFilenameFromShareKey($sharekey) { return self::getFilenameFromShareKey($sharekey); } -} \ No newline at end of file +} diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index 647ee955eb..533aaa376b 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -42,7 +42,7 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { public $userId; public $pass; /** - * @var \OC_FilesystemView + * @var \OC\Files\View */ public $view; // view in /data/user/files public $rootView; // view on /data/user @@ -75,8 +75,8 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { $this->pass = \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1; // init filesystem view - $this->view = new \OC_FilesystemView('/'. \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files'); - $this->rootView = new \OC_FilesystemView('/'. \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 ); + $this->view = new \OC\Files\View('/'. \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files'); + $this->rootView = new \OC\Files\View('/'. \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 ); // init short data $this->data = 'hats'; diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php index 512671c576..f75092f543 100755 --- a/apps/files_encryption/tests/share.php +++ b/apps/files_encryption/tests/share.php @@ -48,7 +48,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { public $filename; public $dataShort; /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $view; public $folder1; @@ -92,7 +92,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { function setUp() { $this->dataShort = 'hats'; - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); $this->folder1 = '/folder1'; $this->subfolder = '/subfolder1'; @@ -669,7 +669,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { // login as admin \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); // check if recovery password match $this->assertTrue($util->checkRecoveryPassword('test123')); @@ -777,7 +777,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { // login as user2 \Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2); - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2); // enable recovery for admin $this->assertTrue($util->setRecoveryForUser(1)); diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php index fed2e7d89d..f742cd3f8e 100644 --- a/apps/files_encryption/tests/stream.php +++ b/apps/files_encryption/tests/stream.php @@ -42,7 +42,7 @@ class Test_Encryption_Stream extends \PHPUnit_Framework_TestCase { public $userId; public $pass; /** - * @var \OC_FilesystemView + * @var \OC\Files\View */ public $view; public $dataShort; @@ -71,7 +71,7 @@ class Test_Encryption_Stream extends \PHPUnit_Framework_TestCase { $this->pass = \Test_Encryption_Stream::TEST_ENCRYPTION_STREAM_USER1; // init filesystem view - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); // init short data $this->dataShort = 'hats'; diff --git a/apps/files_encryption/tests/trashbin.php b/apps/files_encryption/tests/trashbin.php index 2f9ecfd9d5..e36293ba81 100755 --- a/apps/files_encryption/tests/trashbin.php +++ b/apps/files_encryption/tests/trashbin.php @@ -43,7 +43,7 @@ class Test_Encryption_Trashbin extends \PHPUnit_Framework_TestCase { public $userId; public $pass; /** - * @var \OC_FilesystemView + * @var \OC\Files\View */ public $view; public $dataShort; @@ -81,7 +81,7 @@ class Test_Encryption_Trashbin extends \PHPUnit_Framework_TestCase { $this->pass = \Test_Encryption_Trashbin::TEST_ENCRYPTION_TRASHBIN_USER1; // init filesystem view - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); // init short data $this->dataShort = 'hats'; diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php index 88ded7ec40..de83f6bca2 100755 --- a/apps/files_encryption/tests/util.php +++ b/apps/files_encryption/tests/util.php @@ -29,7 +29,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { public $publicKeyDir; public $pass; /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $view; public $keyfilesPath; @@ -92,7 +92,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); $this->util = new Encryption\Util($this->view, $this->userId); @@ -205,7 +205,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { function testIsLegacyUser() { \Test_Encryption_Util::loginHelper(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); - $userView = new \OC_FilesystemView('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); + $userView = new \OC\Files\View('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); // Disable encryption proxy to prevent recursive calls $proxyStatus = \OC_FileProxy::$enabled; @@ -384,7 +384,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $params = array('uid' => \OCP\User::getUser(), 'password' => \OCP\User::getUser()); - $view = new OC_FilesystemView('/'); + $view = new OC\Files\View('/'); $util = new \OCA\Encryption\Util($view, \OCP\User::getUser()); $result = $util->initEncryption($params); @@ -496,8 +496,8 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { function testEncryptLegacyFiles() { \Test_Encryption_Util::loginHelper(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); - $userView = new \OC_FilesystemView('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); - $view = new \OC_FilesystemView('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER . '/files'); + $userView = new \OC\Files\View('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER); + $view = new \OC\Files\View('/' . \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER . '/files'); // Disable encryption proxy to prevent recursive calls $proxyStatus = \OC_FileProxy::$enabled; diff --git a/apps/files_encryption/tests/webdav.php b/apps/files_encryption/tests/webdav.php index 1fe4c13d59..bdd3d51897 100755 --- a/apps/files_encryption/tests/webdav.php +++ b/apps/files_encryption/tests/webdav.php @@ -43,7 +43,7 @@ class Test_Encryption_Webdav extends \PHPUnit_Framework_TestCase { public $userId; public $pass; /** - * @var \OC_FilesystemView + * @var \OC\Files\View */ public $view; public $dataShort; @@ -82,7 +82,7 @@ class Test_Encryption_Webdav extends \PHPUnit_Framework_TestCase { $this->pass = \Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1; // init filesystem view - $this->view = new \OC_FilesystemView('/'); + $this->view = new \OC\Files\View('/'); // init short data $this->dataShort = 'hats'; diff --git a/apps/files_sharing/tests/base.php b/apps/files_sharing/tests/base.php index 495dca072c..11bbcb133f 100644 --- a/apps/files_sharing/tests/base.php +++ b/apps/files_sharing/tests/base.php @@ -39,7 +39,7 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { public $filename; public $data; /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $view; public $folder; @@ -68,7 +68,7 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $this->data = 'foobar'; - $this->view = new \OC_FilesystemView('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); + $this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); // remember files_encryption state $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption'); diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php index 1af73c558d..4e63a1844c 100644 --- a/apps/files_sharing/tests/cache.php +++ b/apps/files_sharing/tests/cache.php @@ -25,7 +25,7 @@ require_once __DIR__ . '/base.php'; class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base { /** - * @var OC_FilesystemView + * @var OC\Files\View */ public $user2View; diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 173eb2164c..e2f220051c 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -216,7 +216,7 @@ class Trashbin { list($owner, $ownerPath) = self::getUidAndFilename($file_path); - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $user); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user); // disable proxy to prevent recursive calls $proxyStatus = \OC_FileProxy::$enabled; @@ -441,7 +441,7 @@ class Trashbin { list($owner, $ownerPath) = self::getUidAndFilename($target); - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $user); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user); if ($util->isSystemWideMountPoint($ownerPath)) { $baseDir = '/files_encryption/'; @@ -498,7 +498,7 @@ class Trashbin { $rootView->rename($ownerShareKey, $baseDir . '/share-keys/' . $ownerPath . '.' . $user . '.shareKey'); // try to re-share if file is shared - $filesystemView = new \OC_FilesystemView('/'); + $filesystemView = new \OC\Files\View('/'); $session = new \OCA\Encryption\Session($filesystemView); $util = new \OCA\Encryption\Util($filesystemView, $user); diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 47fc04c937..407f598195 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -11,7 +11,7 @@ * working with files within that view (e.g. read, write, delete, etc.). Each * view is restricted to a set of directories via a virtual root. The default view * uses the currently logged in user's data directory as root (parts of - * OC_Filesystem are merely a wrapper for OC_FilesystemView). + * OC_Filesystem are merely a wrapper for OC\Files\View). * * Apps that need to access files outside of the user data folders (to modify files * belonging to a user other than the one currently logged in, for example) should diff --git a/lib/private/legacy/filesystemview.php b/lib/private/legacy/filesystemview.php deleted file mode 100644 index d6bca62e06..0000000000 --- a/lib/private/legacy/filesystemview.php +++ /dev/null @@ -1,9 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. */ - -class OC_FilesystemView extends \OC\Files\View {} diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php index d12df230d4..55685f778d 100644 --- a/settings/ajax/decryptall.php +++ b/settings/ajax/decryptall.php @@ -10,7 +10,7 @@ OC_App::loadApp('files_encryption'); $params = array('uid' => \OCP\User::getUser(), 'password' => $_POST['password']); -$view = new OC_FilesystemView('/'); +$view = new OC\Files\View('/'); $util = new \OCA\Encryption\Util($view, \OCP\User::getUser()); $l = \OC_L10N::get('settings'); diff --git a/settings/changepassword/controller.php b/settings/changepassword/controller.php index 9f1e732996..052715555e 100644 --- a/settings/changepassword/controller.php +++ b/settings/changepassword/controller.php @@ -52,7 +52,7 @@ class Controller { if (\OC_App::isEnabled('files_encryption')) { //handle the recovery case - $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $username); + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $username); $recoveryAdminEnabled = \OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled'); $validRecoveryPassword = false; From f5ed92bf31f98d6dbdd7bbc7903169c90d82e464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 12 May 2014 16:34:47 +0200 Subject: [PATCH 4/4] remove legacy aka deprecated code: OC_Cache_FileGlobalGC --- lib/private/legacy/cache/fileglobalgc.php | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 lib/private/legacy/cache/fileglobalgc.php diff --git a/lib/private/legacy/cache/fileglobalgc.php b/lib/private/legacy/cache/fileglobalgc.php deleted file mode 100644 index 385f640667..0000000000 --- a/lib/private/legacy/cache/fileglobalgc.php +++ /dev/null @@ -1,4 +0,0 @@ -