Merge pull request #8556 from owncloud/kill-legacy-code-master

Kill legacy code master
This commit is contained in:
Thomas Müller 2014-05-12 20:55:24 +02:00
commit 408189b7e4
36 changed files with 102 additions and 540 deletions

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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

View File

@ -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) {

View File

@ -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(

View File

@ -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) {
@ -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) {

View File

@ -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, '/');

View File

@ -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);
@ -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,9 +150,9 @@ 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 = 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);

View File

@ -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
*/

View File

@ -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);

View File

@ -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
*/
@ -1361,7 +1361,7 @@ class Util {
return array(
$fileOwnerUid,
\OC_Filesystem::normalizePath($filename)
\OC\Files\Filesystem::normalizePath($filename)
);
}
}
@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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';

View File

@ -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);
}
}
}

View File

@ -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';

View File

@ -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));

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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');

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -57,7 +57,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();

View File

@ -34,7 +34,7 @@ abstract class Proxy {
*/
public function __construct(ILDAPWrapper $ldap) {
$this->ldap = $ldap;
$this->cache = \OC_Cache::getGlobalCache();
$this->cache = \OC\Cache::getGlobalCache();
}
/**

View File

@ -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()) ));

View File

@ -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

View File

@ -1,10 +0,0 @@
<?php
/**
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
class OC_Cache extends \OC\Cache {
}

View File

@ -1,4 +0,0 @@
<?php
class OC_Cache_FileGlobalGC extends OC\Cache\FileGlobalGC{
}

View File

@ -1,415 +0,0 @@
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* 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);
}
}

View File

@ -1,9 +0,0 @@
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* 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 {}

View File

@ -90,7 +90,7 @@ class Router implements IRouter {
$files[] = 'settings/routes.php';
$files[] = 'core/routes.php';
$files[] = 'ocs/routes.php';
$this->cacheKey = \OC_Cache::generateCacheKeyFromFiles($files);
$this->cacheKey = \OC\Cache::generateCacheKeyFromFiles($files);
}
return $this->cacheKey;
}

View File

@ -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');

View File

@ -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;