diff options
29 files changed, 43 insertions, 231 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index f2c69eccff9..d0826ee5a8c 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -203,10 +203,6 @@ class File extends Node implements IFile { throw new FileLocked($e->getMessage(), $e->getCode(), $e); } - if ($view) { - $this->emitPostHooks($exists); - } - // allow sync clients to send the mtime along in a header $request = \OC::$server->getRequest(); if (isset($request->server['HTTP_X_OC_MTIME'])) { @@ -214,6 +210,10 @@ class File extends Node implements IFile { header('X-OC-MTime: accepted'); } } + + if ($view) { + $this->emitPostHooks($exists); + } $this->refreshInfo(); diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index a63282c75e2..3e2204cf661 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -250,8 +250,8 @@ abstract class Node implements \Sabre\DAV\INode { $path = $this->info->getInternalPath(); - if ($storage->instanceOfStorage('\OC\Files\Storage\Shared')) { - /** @var \OC\Files\Storage\Shared $storage */ + if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { + /** @var \OCA\Files_Sharing\SharedStorage $storage */ $permissions = (int)$storage->getShare()->getPermissions(); } else { $permissions = $storage->getPermissions($path); diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index fedf76f7929..18f91bbd8c9 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -216,7 +216,7 @@ class DirectoryTest extends \Test\TestCase { $storage->expects($this->any()) ->method('instanceOfStorage') ->will($this->returnValueMap([ - '\OC\Files\Storage\Shared' => false, + '\OCA\Files_Sharing\SharedStorage' => false, '\OC\Files\Storage\Wrapper\Quota' => false, ])); @@ -247,7 +247,7 @@ class DirectoryTest extends \Test\TestCase { $storage->expects($this->any()) ->method('instanceOfStorage') ->will($this->returnValueMap([ - ['\OC\Files\Storage\Shared', false], + ['\OCA\Files_Sharing\SharedStorage', false], ['\OC\Files\Storage\Wrapper\Quota', true], ])); diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php index f8a47f27336..3ce1cac860c 100644 --- a/apps/federatedfilesharing/tests/TestCase.php +++ b/apps/federatedfilesharing/tests/TestCase.php @@ -113,7 +113,7 @@ abstract class TestCase extends \Test\TestCase { * reset init status for the share storage */ protected static function resetStorage() { - $storage = new \ReflectionClass('\OC\Files\Storage\Shared'); + $storage = new \ReflectionClass('\OCA\Files_Sharing\SharedStorage'); $isInitialized = $storage->getProperty('initialized'); $isInitialized->setAccessible(true); $isInitialized->setValue($storage, false); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 11c4614d6c5..7da295afddd 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -28,8 +28,6 @@ $l = \OC::$server->getL10N('files_sharing'); -\OC::$CLASSPATH['OC\Files\Storage\Shared'] = 'files_sharing/lib/sharedstorage.php'; - \OCA\Files_Sharing\Helper::registerHooks(); \OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 7977410f587..6444dbb8a36 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -38,7 +38,7 @@ use OCP\Files\Storage\IStorage; */ class Cache extends CacheJail { /** - * @var \OC\Files\Storage\Shared + * @var \OCA\Files_Sharing\SharedStorage */ private $storage; @@ -58,7 +58,7 @@ class Cache extends CacheJail { private $sourceCache; /** - * @param \OC\Files\Storage\Shared $storage + * @param \OCA\Files_Sharing\SharedStorage $storage * @param IStorage $sourceStorage * @param ICacheEntry $sourceRootInfo */ diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index 284728597cd..1ee6f2b35f6 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -81,7 +81,7 @@ class MountProvider implements IMountProvider { foreach ($superShares as $share) { try { $mounts[] = new SharedMount( - '\OC\Files\Storage\Shared', + '\OCA\Files_Sharing\SharedStorage', $mounts, [ 'user' => $user->getUID(), diff --git a/apps/files_sharing/lib/Scanner.php b/apps/files_sharing/lib/Scanner.php index 6982f1b4612..86c6b58f439 100644 --- a/apps/files_sharing/lib/Scanner.php +++ b/apps/files_sharing/lib/Scanner.php @@ -55,7 +55,7 @@ class Scanner extends \OC\Files\Cache\Scanner { if ($this->sourceScanner) { return $this->sourceScanner; } - if ($this->storage->instanceOfStorage('\OC\Files\Storage\Shared')) { + if ($this->storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { /** @var \OC\Files\Storage\Storage $storage */ list($storage) = $this->storage->resolvePath(''); $this->sourceScanner = $storage->getScanner(); diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 13ecd88bfa9..5436f476f1a 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -37,7 +37,7 @@ use OC\Files\View; */ class SharedMount extends MountPoint implements MoveableMount { /** - * @var \OC\Files\Storage\Shared $storage + * @var \OCA\Files_Sharing\SharedStorage $storage */ protected $storage = null; @@ -212,7 +212,7 @@ class SharedMount extends MountPoint implements MoveableMount { */ public function removeMount() { $mountManager = \OC\Files\Filesystem::getMountManager(); - /** @var $storage \OC\Files\Storage\Shared */ + /** @var $storage \OCA\Files_Sharing\SharedStorage */ $storage = $this->getStorage(); $result = $storage->unshareStorage(); $mountManager->removeMount($this->mountPoint); diff --git a/apps/files_sharing/lib/SharedPropagator.php b/apps/files_sharing/lib/SharedPropagator.php index cd4aab3b522..0273744da11 100644 --- a/apps/files_sharing/lib/SharedPropagator.php +++ b/apps/files_sharing/lib/SharedPropagator.php @@ -27,7 +27,7 @@ use OC\Files\Cache\Propagator; class SharedPropagator extends Propagator { /** - * @var \OC\Files\Storage\Shared + * @var \OCA\Files_Sharing\SharedStorage */ protected $storage; diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/SharedStorage.php index e1875fe2394..78a63ac5bbc 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -29,11 +29,10 @@ * */ -namespace OC\Files\Storage; +namespace OCA\Files_Sharing; use OC\Files\Filesystem; use OC\Files\Cache\FailedCache; -use OCA\Files_Sharing\ISharedStorage; use OCP\Constants; use OCP\Files\Cache\ICacheEntry; use OCP\Files\NotFoundException; @@ -43,7 +42,8 @@ use OCP\Lock\ILockingProvider; /** * Convert target path to source path and pass the function call to the correct storage provider */ -class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { +class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { + /** @var \OCP\Share\IShare */ private $superShare; diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 531aa13aa33..ae0247a84e2 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -488,7 +488,7 @@ class CacheTest extends TestCase { $this->assertTrue(\OC\Files\Filesystem::file_exists('/test.txt')); list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt'); /** - * @var \OC\Files\Storage\Shared $sharedStorage + * @var \OCA\Files_Sharing\SharedStorage $sharedStorage */ $sharedCache = $sharedStorage->getCache(); @@ -518,7 +518,7 @@ class CacheTest extends TestCase { $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo')); list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo'); /** - * @var \OC\Files\Storage\Shared $sharedStorage + * @var \OCA\Files_Sharing\SharedStorage $sharedStorage */ $sharedCache = $sharedStorage->getCache(); diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 9be52b3febb..2486e23af1b 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -523,7 +523,7 @@ class SharedStorageTest extends TestCase { $mount = $view2->getMount('/foo'); $this->assertInstanceOf('\OCA\Files_Sharing\SharedMount', $mount); - /** @var \OC\Files\Storage\Shared $storage */ + /** @var \OCA\Files_Sharing\SharedStorage $storage */ $storage = $mount->getStorage(); $this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $storage->getOwner('')); diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 1777eb5bad2..a9163a086bf 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -184,7 +184,7 @@ abstract class TestCase extends \Test\TestCase { * reset init status for the share storage */ protected static function resetStorage() { - $storage = new \ReflectionClass('\OC\Files\Storage\Shared'); + $storage = new \ReflectionClass('\OCA\Files_Sharing\SharedStorage'); $isInitialized = $storage->getProperty('initialized'); $isInitialized->setAccessible(true); $isInitialized->setValue($storage, false); diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 6e6551089cc..de79327e084 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -881,7 +881,7 @@ class VersioningTest extends \Test\TestCase { \OC::$server->getUserManager()->registerBackend($backend); } - $storage = new \ReflectionClass('\OC\Files\Storage\Shared'); + $storage = new \ReflectionClass('\OCA\Files_Sharing\SharedStorage'); $isInitialized = $storage->getProperty('initialized'); $isInitialized->setAccessible(true); $isInitialized->setValue($storage, false); diff --git a/lib/base.php b/lib/base.php index 7d86245818d..0c4acab8fd2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -660,7 +660,6 @@ class OC { stream_wrapper_register('static', 'OC\Files\Stream\StaticStream'); stream_wrapper_register('close', 'OC\Files\Stream\Close'); stream_wrapper_register('quota', 'OC\Files\Stream\Quota'); - stream_wrapper_register('oc', 'OC\Files\Stream\OC'); \OC::$server->getEventLogger()->start('init_session', 'Initialize session'); OC_App::loadApps(array('session')); diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 5cedef83c61..c10f1ca7e5f 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -531,7 +531,6 @@ return array( 'OC\\Files\\Stream\\Close' => $baseDir . '/lib/private/Files/Stream/Close.php', 'OC\\Files\\Stream\\Dir' => $baseDir . '/lib/private/Files/Stream/Dir.php', 'OC\\Files\\Stream\\Encryption' => $baseDir . '/lib/private/Files/Stream/Encryption.php', - 'OC\\Files\\Stream\\OC' => $baseDir . '/lib/private/Files/Stream/OC.php', 'OC\\Files\\Stream\\Quota' => $baseDir . '/lib/private/Files/Stream/Quota.php', 'OC\\Files\\Stream\\StaticStream' => $baseDir . '/lib/private/Files/Stream/StaticStream.php', 'OC\\Files\\Type\\Detection' => $baseDir . '/lib/private/Files/Type/Detection.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index bce3916c8a0..4b7020b59b5 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -561,7 +561,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Stream\\Close' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/Close.php', 'OC\\Files\\Stream\\Dir' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/Dir.php', 'OC\\Files\\Stream\\Encryption' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/Encryption.php', - 'OC\\Files\\Stream\\OC' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/OC.php', 'OC\\Files\\Stream\\Quota' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/Quota.php', 'OC\\Files\\Stream\\StaticStream' => __DIR__ . '/../../..' . '/lib/private/Files/Stream/StaticStream.php', 'OC\\Files\\Type\\Detection' => __DIR__ . '/../../..' . '/lib/private/Files/Type/Detection.php', diff --git a/lib/private/Encryption/DecryptAll.php b/lib/private/Encryption/DecryptAll.php index b84395b9e17..caf4237ab9c 100644 --- a/lib/private/Encryption/DecryptAll.php +++ b/lib/private/Encryption/DecryptAll.php @@ -211,7 +211,7 @@ class DecryptAll { $content = $this->rootView->getDirectoryContent($root); foreach ($content as $file) { // only decrypt files owned by the user - if($file->getStorage()->instanceOfStorage('OC\Files\Storage\Shared')) { + if($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) { continue; } $path = $root . '/' . $file['name']; diff --git a/lib/private/Encryption/EncryptionWrapper.php b/lib/private/Encryption/EncryptionWrapper.php index 233390f8739..573fe0159ea 100644 --- a/lib/private/Encryption/EncryptionWrapper.php +++ b/lib/private/Encryption/EncryptionWrapper.php @@ -81,7 +81,7 @@ class EncryptionWrapper { 'mount' => $mount ]; - if (!$storage->instanceOfStorage('OC\Files\Storage\Shared') + if (!$storage->instanceOfStorage('OCA\Files_Sharing\SharedStorage') && !$storage->instanceOfStorage('OCA\Files_Sharing\External\Storage') && !$storage->instanceOfStorage('OC\Files\Storage\OwnCloud')) { diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 63d3c004fd2..c975791295d 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -466,6 +466,10 @@ abstract class Common implements Storage, ILockingStorage { * @return bool */ public function instanceOfStorage($class) { + if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { + // FIXME Temporary fix to keep existing checks working + $class = '\OCA\Files_Sharing\SharedStorage'; + } return is_a($this, $class); } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index c52b3394832..71b64d8c82c 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -483,6 +483,10 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { * @return bool */ public function instanceOfStorage($class) { + if (ltrim($class, '\\') === 'OC\Files\Storage\Shared') { + // FIXME Temporary fix to keep existing checks working + $class = '\OCA\Files_Sharing\SharedStorage'; + } return is_a($this, $class) or $this->getWrapperStorage()->instanceOfStorage($class); } diff --git a/lib/private/Files/Stream/OC.php b/lib/private/Files/Stream/OC.php deleted file mode 100644 index f415bc13b15..00000000000 --- a/lib/private/Files/Stream/OC.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <robin@icewind.nl> - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Files\Stream; - -/** - * a stream wrappers for ownCloud's virtual filesystem - */ -class OC { - /** - * @var \OC\Files\View - */ - static private $rootView; - - private $path; - - /** - * @var resource - */ - private $dirSource; - - /** - * @var resource - */ - private $fileSource; - private $meta; - - private function setup(){ - if (!self::$rootView) { - self::$rootView = new \OC\Files\View(''); - } - } - - public function stream_open($path, $mode, $options, &$opened_path) { - $this->setup(); - $path = substr($path, strlen('oc://')); - $this->path = $path; - $this->fileSource = self::$rootView->fopen($path, $mode); - if (is_resource($this->fileSource)) { - $this->meta = stream_get_meta_data($this->fileSource); - } - return is_resource($this->fileSource); - } - - public function stream_seek($offset, $whence = SEEK_SET) { - return fseek($this->fileSource, $offset, $whence) === 0; - } - - public function stream_tell() { - return ftell($this->fileSource); - } - - public function stream_read($count) { - return fread($this->fileSource, $count); - } - - public function stream_write($data) { - return fwrite($this->fileSource, $data); - } - - public function stream_set_option($option, $arg1, $arg2) { - switch ($option) { - case STREAM_OPTION_BLOCKING: - stream_set_blocking($this->fileSource, $arg1); - break; - case STREAM_OPTION_READ_TIMEOUT: - stream_set_timeout($this->fileSource, $arg1, $arg2); - break; - case STREAM_OPTION_WRITE_BUFFER: - stream_set_write_buffer($this->fileSource, $arg1, $arg2); - } - } - - public function stream_stat() { - return fstat($this->fileSource); - } - - public function stream_lock($mode) { - flock($this->fileSource, $mode); - } - - public function stream_flush() { - return fflush($this->fileSource); - } - - public function stream_eof() { - return feof($this->fileSource); - } - - public function url_stat($path) { - $this->setup(); - $path = substr($path, strlen('oc://')); - if (self::$rootView->file_exists($path)) { - return self::$rootView->stat($path); - } else { - return false; - } - } - - public function stream_close() { - fclose($this->fileSource); - } - - public function unlink($path) { - $this->setup(); - $path = substr($path, strlen('oc://')); - return self::$rootView->unlink($path); - } - - public function dir_opendir($path, $options) { - $this->setup(); - $path = substr($path, strlen('oc://')); - $this->path = $path; - $this->dirSource = self::$rootView->opendir($path); - if (is_resource($this->dirSource)) { - $this->meta = stream_get_meta_data($this->dirSource); - } - return is_resource($this->dirSource); - } - - public function dir_readdir() { - return readdir($this->dirSource); - } - - public function dir_closedir() { - closedir($this->dirSource); - } - - public function dir_rewinddir() { - rewinddir($this->dirSource); - } -} diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index fa6ba20c342..79c4d4cabed 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1357,7 +1357,7 @@ class View { $subStorage = $mount->getStorage(); if ($subStorage) { // exclude shared storage ? - if ($extOnly && $subStorage instanceof \OC\Files\Storage\Shared) { + if ($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage) { continue; } $subCache = $subStorage->getCache(''); diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index 0b9477dacd4..65b4c0d8afe 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -557,7 +557,7 @@ class OC_Helper { $quota = \OCP\Files\FileInfo::SPACE_UNLIMITED; $storage = $rootInfo->getStorage(); $sourceStorage = $storage; - if ($storage->instanceOfStorage('\OC\Files\Storage\Shared')) { + if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { $includeExtStorage = false; $sourceStorage = $storage->getSourceStorage(); } diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index b8f3a93ba50..b6c3b375396 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -165,15 +165,14 @@ class OC_Util { // install storage availability wrapper, before most other wrappers \OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) { - /** @var \OCP\Files\Storage $storage */ - if (!$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) { + if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]); } return $storage; }); \OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { - if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) { + if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]); } return $storage; diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 7859a65ff6d..289e7de27ab 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -260,7 +260,7 @@ class DecryptAllTest extends TestCase { ->disableOriginalConstructor()->getMock(); $sharedStorage->expects($this->once())->method('instanceOfStorage') - ->with('OC\Files\Storage\Shared')->willReturn(true); + ->with('OCA\Files_Sharing\SharedStorage')->willReturn(true); $this->view->expects($this->at(0))->method('getDirectoryContent') ->with('/user1/files')->willReturn( diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 6599428b364..6a6a3db2f68 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -91,13 +91,13 @@ class EncryptionWrapperTest extends TestCase { [true, ['OCA\Files_Trashbin\Storage']], // Do not wrap shared storages - [false, ['OC\Files\Storage\Shared']], + [false, ['OCA\Files_Sharing\SharedStorage']], [false, ['OCA\Files_Sharing\External\Storage']], [false, ['OC\Files\Storage\OwnCloud']], - [false, ['OC\Files\Storage\Shared', 'OCA\Files_Sharing\External\Storage']], - [false, ['OC\Files\Storage\Shared', 'OC\Files\Storage\OwnCloud']], + [false, ['OCA\Files_Sharing\SharedStorage', 'OCA\Files_Sharing\External\Storage']], + [false, ['OCA\Files_Sharing\SharedStorage', 'OC\Files\Storage\OwnCloud']], [false, ['OCA\Files_Sharing\External\Storage', 'OC\Files\Storage\OwnCloud']], - [false, ['OC\Files\Storage\Shared', 'OCA\Files_Sharing\External\Storage', 'OC\Files\Storage\OwnCloud']], + [false, ['OCA\Files_Sharing\SharedStorage', 'OCA\Files_Sharing\External\Storage', 'OC\Files\Storage\OwnCloud']], ]; } diff --git a/tests/lib/StreamWrappersTest.php b/tests/lib/StreamWrappersTest.php index a378f975fde..c0ecb5e738b 100644 --- a/tests/lib/StreamWrappersTest.php +++ b/tests/lib/StreamWrappersTest.php @@ -77,40 +77,4 @@ class StreamWrappersTest extends \Test\TestCase { fclose($fh); $this->assertSame($tmpFile, $actual); } - - public function testOC() { - // FIXME: use proper tearDown with $this->loginAsUser() and $this->logout() - // (would currently break the tests for some reason) - $originalStorage = \OC\Files\Filesystem::getStorage('/'); - \OC\Files\Filesystem::clearMounts(); - - $storage = new \OC\Files\Storage\Temporary(array()); - $storage->file_put_contents('foo.txt', 'asd'); - \OC\Files\Filesystem::mount($storage, array(), '/'); - - $this->assertTrue(file_exists('oc:///foo.txt')); - $this->assertEquals('asd', file_get_contents('oc:///foo.txt')); - $this->assertEquals(array('.', '..', 'foo.txt'), scandir('oc:///')); - - file_put_contents('oc:///bar.txt', 'qwerty'); - $this->assertEquals('qwerty', $storage->file_get_contents('bar.txt')); - $this->assertEquals(array('.', '..', 'bar.txt', 'foo.txt'), scandir('oc:///')); - $this->assertEquals('qwerty', file_get_contents('oc:///bar.txt')); - - $fh = fopen('oc:///bar.txt', 'rb'); - $this->assertSame(0, ftell($fh)); - $content = fread($fh, 4); - $this->assertSame(4, ftell($fh)); - $this->assertSame('qwer', $content); - $content = fread($fh, 1); - $this->assertSame(5, ftell($fh)); - $this->assertSame(0, fseek($fh, 0)); - $this->assertSame(0, ftell($fh)); - - unlink('oc:///foo.txt'); - $this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///')); - - \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($originalStorage, array(), '/'); - } } |