From f2889dc6e4aa701f36081b314f38f620cbb1fc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 30 Aug 2015 19:13:01 +0200 Subject: [PATCH 1/5] Consolidate webdav code - move all to one app --- .gitignore | 1 + apps/dav/appinfo/info.xml | 22 ++++++++ .../appinfo/v1}/publicwebdav.php | 6 +- apps/dav/appinfo/v1/webdav.php | 55 +++++++++++++++++++ .../lib/connector/publicauth.php | 2 +- .../lib}/connector/sabre/appenabledplugin.php | 2 +- .../dav/lib}/connector/sabre/auth.php | 2 +- .../sabre/blocklegacyclientplugin.php | 4 +- .../connector/sabre/copyetagheaderplugin.php | 2 +- .../sabre/custompropertiesbackend.php | 2 +- .../dav/lib}/connector/sabre/directory.php | 14 ++--- .../sabre/dummygetresponseplugin.php | 4 +- .../sabre/exception/entitytoolarge.php | 2 +- .../connector/sabre/exception/filelocked.php | 2 +- .../connector/sabre/exception/invalidpath.php | 2 +- .../sabre/exception/unsupportedmediatype.php | 2 +- .../connector/sabre/exceptionloggerplugin.php | 2 +- .../dav/lib}/connector/sabre/file.php | 8 +-- .../dav/lib}/connector/sabre/filesplugin.php | 12 ++-- .../lib}/connector/sabre/listenerplugin.php | 0 .../dav/lib}/connector/sabre/lockplugin.php | 6 +- .../connector/sabre/maintenanceplugin.php | 2 +- .../dav/lib}/connector/sabre/node.php | 4 +- .../dav/lib}/connector/sabre/objecttree.php | 10 ++-- .../dav/lib}/connector/sabre/principal.php | 2 +- .../dav/lib}/connector/sabre/quotaplugin.php | 2 +- .../dav/lib}/connector/sabre/server.php | 4 +- .../lib}/connector/sabre/serverfactory.php | 32 +++++------ .../dav/lib}/connector/sabre/taglist.php | 4 +- .../dav/lib}/connector/sabre/tagsplugin.php | 6 +- .../sabre/BlockLegacyClientPluginTest.php | 2 +- .../sabre/DummyGetResponsePluginTest.php | 2 +- .../connector/sabre/MaintenancePluginTest.php | 2 +- .../sabre/copyetagheaderplugintest.php | 4 +- .../sabre/custompropertiesbackend.php | 12 ++-- .../tests/unit}/connector/sabre/directory.php | 12 ++-- .../sabre/exception/invalidpathtest.php | 2 +- .../connector/sabre/exceptionloggerplugin.php | 4 +- .../dav/tests/unit}/connector/sabre/file.php | 46 ++++++++-------- .../unit}/connector/sabre/filesplugin.php | 28 +++++----- .../dav/tests/unit}/connector/sabre/node.php | 2 +- .../unit}/connector/sabre/objecttree.php | 28 +++++----- .../tests/unit}/connector/sabre/principal.php | 4 +- .../unit}/connector/sabre/quotaplugin.php | 4 +- .../connector/sabre/requesttest/auth.php | 0 .../sabre/requesttest/exceptionplugin.php | 2 +- .../sabre/requesttest/requesttest.php | 6 +- .../connector/sabre/requesttest/sapi.php | 0 .../sabre/requesttest/uploadtest.php | 0 .../unit}/connector/sabre/tagsplugin.php | 34 ++++++------ apps/files/appinfo/info.xml | 4 -- apps/files/appinfo/remote.php | 4 +- apps/files_sharing/appinfo/info.xml | 1 - core/shipped.json | 1 + lib/private/files/storage/common.php | 2 +- remote.php | 2 +- 56 files changed, 249 insertions(+), 177 deletions(-) create mode 100644 apps/dav/appinfo/info.xml rename apps/{files_sharing => dav/appinfo/v1}/publicwebdav.php (92%) create mode 100644 apps/dav/appinfo/v1/webdav.php rename apps/{files_sharing => dav}/lib/connector/publicauth.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/appenabledplugin.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/auth.php (99%) rename {lib/private => apps/dav/lib}/connector/sabre/blocklegacyclientplugin.php (97%) rename {lib/private => apps/dav/lib}/connector/sabre/copyetagheaderplugin.php (97%) rename {lib/private => apps/dav/lib}/connector/sabre/custompropertiesbackend.php (99%) rename {lib/private => apps/dav/lib}/connector/sabre/directory.php (95%) rename {lib/private => apps/dav/lib}/connector/sabre/dummygetresponseplugin.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/exception/entitytoolarge.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/exception/filelocked.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/exception/invalidpath.php (97%) rename {lib/private => apps/dav/lib}/connector/sabre/exception/unsupportedmediatype.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/exceptionloggerplugin.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/file.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/filesplugin.php (95%) rename {lib/private => apps/dav/lib}/connector/sabre/listenerplugin.php (100%) rename {lib/private => apps/dav/lib}/connector/sabre/lockplugin.php (94%) rename {lib/private => apps/dav/lib}/connector/sabre/maintenanceplugin.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/node.php (98%) rename {lib/private => apps/dav/lib}/connector/sabre/objecttree.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/principal.php (99%) rename {lib/private => apps/dav/lib}/connector/sabre/quotaplugin.php (99%) rename {lib/private => apps/dav/lib}/connector/sabre/server.php (94%) rename {lib/private => apps/dav/lib}/connector/sabre/serverfactory.php (72%) rename {lib/private => apps/dav/lib}/connector/sabre/taglist.php (96%) rename {lib/private => apps/dav/lib}/connector/sabre/tagsplugin.php (97%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/BlockLegacyClientPluginTest.php (98%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/DummyGetResponsePluginTest.php (97%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/MaintenancePluginTest.php (97%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/copyetagheaderplugintest.php (88%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/custompropertiesbackend.php (93%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/directory.php (91%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/exception/invalidpathtest.php (95%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/exceptionloggerplugin.php (93%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/file.php (93%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/filesplugin.php (85%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/node.php (97%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/objecttree.php (88%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/principal.php (97%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/quotaplugin.php (96%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/auth.php (100%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/exceptionplugin.php (88%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/requesttest.php (96%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/sapi.php (100%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/uploadtest.php (100%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/tagsplugin.php (87%) diff --git a/.gitignore b/.gitignore index 4a625fb858..a6baffc6a5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ # ignore all apps except core ones /apps*/* +!/apps/dav !/apps/files !/apps/files_encryption !/apps/encryption diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml new file mode 100644 index 0000000000..955b381ce2 --- /dev/null +++ b/apps/dav/appinfo/info.xml @@ -0,0 +1,22 @@ + + + dav + WebDAV + ownCloud WebDAV endppint + AGPL + owncloud.org + 8.2 + true + + + + + + + appinfo/v1/webdav.php + appinfo/v1/webdav.php + + + appinfo/v1/publicwebdav.php + + diff --git a/apps/files_sharing/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php similarity index 92% rename from apps/files_sharing/publicwebdav.php rename to apps/dav/appinfo/v1/publicwebdav.php index 7d96c8e8c9..5bdfd94e65 100644 --- a/apps/files_sharing/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -23,16 +23,16 @@ */ // load needed apps -$RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging'); +$RUNTIME_APPTYPES = ['filesystem', 'authentication', 'logging']; OC_App::loadApps($RUNTIME_APPTYPES); OC_Util::obEnd(); // Backends -$authBackend = new OCA\Files_Sharing\Connector\PublicAuth(\OC::$server->getConfig()); +$authBackend = new OCA\DAV\Connector\PublicAuth(\OC::$server->getConfig()); -$serverFactory = new \OC\Connector\Sabre\ServerFactory( +$serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php new file mode 100644 index 0000000000..b416ef6479 --- /dev/null +++ b/apps/dav/appinfo/v1/webdav.php @@ -0,0 +1,55 @@ + + * @author Frank Karlitschek + * @author Jakob Sack + * @author Jörn Friedrich Dreyer + * @author Lukas Reschke + * @author Morris Jobke + * @author Robin Appelman + * @author Thomas Müller + * @author Vincent Petry + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @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 + * + */ + +// no php execution timeout for webdav +set_time_limit(0); + +// Turn off output buffering to prevent memory problems +\OC_Util::obEnd(); + +$serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory( + \OC::$server->getConfig(), + \OC::$server->getLogger(), + \OC::$server->getDatabaseConnection(), + \OC::$server->getUserSession(), + \OC::$server->getMountManager(), + \OC::$server->getTagManager() +); + +// Backends +$authBackend = new \OCA\DAV\Connector\Sabre\Auth(); +$requestUri = \OC::$server->getRequest()->getRequestUri(); + +$server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() { + // use the view for the logged in user + return \OC\Files\Filesystem::getView(); +}); + +// And off we go! +$server->exec(); diff --git a/apps/files_sharing/lib/connector/publicauth.php b/apps/dav/lib/connector/publicauth.php similarity index 98% rename from apps/files_sharing/lib/connector/publicauth.php rename to apps/dav/lib/connector/publicauth.php index 4ac355180f..f37be41402 100644 --- a/apps/files_sharing/lib/connector/publicauth.php +++ b/apps/dav/lib/connector/publicauth.php @@ -24,7 +24,7 @@ * */ -namespace OCA\Files_Sharing\Connector; +namespace OCA\DAV\Connector; class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic { diff --git a/lib/private/connector/sabre/appenabledplugin.php b/apps/dav/lib/connector/sabre/appenabledplugin.php similarity index 98% rename from lib/private/connector/sabre/appenabledplugin.php rename to apps/dav/lib/connector/sabre/appenabledplugin.php index 696a9fcb81..e70512d0fd 100644 --- a/lib/private/connector/sabre/appenabledplugin.php +++ b/apps/dav/lib/connector/sabre/appenabledplugin.php @@ -21,7 +21,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\App\IAppManager; use Sabre\DAV\Exception\Forbidden; diff --git a/lib/private/connector/sabre/auth.php b/apps/dav/lib/connector/sabre/auth.php similarity index 99% rename from lib/private/connector/sabre/auth.php rename to apps/dav/lib/connector/sabre/auth.php index d33ffad7d5..2e52a179d2 100644 --- a/lib/private/connector/sabre/auth.php +++ b/apps/dav/lib/connector/sabre/auth.php @@ -27,7 +27,7 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use Exception; use Sabre\DAV\Auth\Backend\AbstractBasic; diff --git a/lib/private/connector/sabre/blocklegacyclientplugin.php b/apps/dav/lib/connector/sabre/blocklegacyclientplugin.php similarity index 97% rename from lib/private/connector/sabre/blocklegacyclientplugin.php rename to apps/dav/lib/connector/sabre/blocklegacyclientplugin.php index 9480cd1f06..ed61f43a53 100644 --- a/lib/private/connector/sabre/blocklegacyclientplugin.php +++ b/apps/dav/lib/connector/sabre/blocklegacyclientplugin.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\IConfig; use Sabre\HTTP\RequestInterface; @@ -30,7 +30,7 @@ use Sabre\DAV\Exception; * Class BlockLegacyClientPlugin is used to detect old legacy sync clients and * returns a 403 status to those clients * - * @package OC\Connector\Sabre + * @package OCA\DAV\Connector\Sabre */ class BlockLegacyClientPlugin extends ServerPlugin { /** @var \Sabre\DAV\Server */ diff --git a/lib/private/connector/sabre/copyetagheaderplugin.php b/apps/dav/lib/connector/sabre/copyetagheaderplugin.php similarity index 97% rename from lib/private/connector/sabre/copyetagheaderplugin.php rename to apps/dav/lib/connector/sabre/copyetagheaderplugin.php index fe1a8fab70..b33b208ada 100644 --- a/lib/private/connector/sabre/copyetagheaderplugin.php +++ b/apps/dav/lib/connector/sabre/copyetagheaderplugin.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use \Sabre\HTTP\RequestInterface; use \Sabre\HTTP\ResponseInterface; diff --git a/lib/private/connector/sabre/custompropertiesbackend.php b/apps/dav/lib/connector/sabre/custompropertiesbackend.php similarity index 99% rename from lib/private/connector/sabre/custompropertiesbackend.php rename to apps/dav/lib/connector/sabre/custompropertiesbackend.php index a05de1adb3..ff35476319 100644 --- a/lib/private/connector/sabre/custompropertiesbackend.php +++ b/apps/dav/lib/connector/sabre/custompropertiesbackend.php @@ -21,7 +21,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\IDBConnection; use OCP\IUser; diff --git a/lib/private/connector/sabre/directory.php b/apps/dav/lib/connector/sabre/directory.php similarity index 95% rename from lib/private/connector/sabre/directory.php rename to apps/dav/lib/connector/sabre/directory.php index 0261ab1804..8c736ea010 100644 --- a/lib/private/connector/sabre/directory.php +++ b/apps/dav/lib/connector/sabre/directory.php @@ -26,15 +26,15 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; -use OC\Connector\Sabre\Exception\InvalidPath; -use OC\Connector\Sabre\Exception\FileLocked; +use OCA\DAV\Connector\Sabre\Exception\InvalidPath; +use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use Sabre\DAV\Exception\Locked; -class Directory extends \OC\Connector\Sabre\Node +class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota { /** @@ -110,7 +110,7 @@ class Directory extends \OC\Connector\Sabre\Node $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name; // using a dummy FileInfo is acceptable here since it will be refreshed after the put is complete $info = new \OC\Files\FileInfo($path, null, null, array(), null); - $node = new \OC\Connector\Sabre\File($this->fileView, $info); + $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); $node->acquireLock(ILockingProvider::LOCK_SHARED); return $node->put($data); } catch (\OCP\Files\StorageNotAvailableException $e) { @@ -179,9 +179,9 @@ class Directory extends \OC\Connector\Sabre\Node } if ($info['mimetype'] == 'httpd/unix-directory') { - $node = new \OC\Connector\Sabre\Directory($this->fileView, $info); + $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info); } else { - $node = new \OC\Connector\Sabre\File($this->fileView, $info); + $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); } return $node; } diff --git a/lib/private/connector/sabre/dummygetresponseplugin.php b/apps/dav/lib/connector/sabre/dummygetresponseplugin.php similarity index 96% rename from lib/private/connector/sabre/dummygetresponseplugin.php rename to apps/dav/lib/connector/sabre/dummygetresponseplugin.php index 6f5a009d08..7c7a332fed 100644 --- a/lib/private/connector/sabre/dummygetresponseplugin.php +++ b/apps/dav/lib/connector/sabre/dummygetresponseplugin.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use Sabre\HTTP\ResponseInterface; use Sabre\HTTP\RequestInterface; @@ -34,7 +34,7 @@ use Sabre\HTTP\RequestInterface; * * FIXME: Remove once clients are all compliant. * - * @package OC\Connector\Sabre + * @package OCA\DAV\Connector\Sabre */ class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin { /** @var \Sabre\DAV\Server */ diff --git a/lib/private/connector/sabre/exception/entitytoolarge.php b/apps/dav/lib/connector/sabre/exception/entitytoolarge.php similarity index 96% rename from lib/private/connector/sabre/exception/entitytoolarge.php rename to apps/dav/lib/connector/sabre/exception/entitytoolarge.php index e9699deeaf..f5a7aa99c6 100644 --- a/lib/private/connector/sabre/exception/entitytoolarge.php +++ b/apps/dav/lib/connector/sabre/exception/entitytoolarge.php @@ -20,7 +20,7 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre\Exception; +namespace OCA\DAV\Connector\Sabre\Exception; /** * Entity Too Large diff --git a/lib/private/connector/sabre/exception/filelocked.php b/apps/dav/lib/connector/sabre/exception/filelocked.php similarity index 96% rename from lib/private/connector/sabre/exception/filelocked.php rename to apps/dav/lib/connector/sabre/exception/filelocked.php index 1657a7ae37..1e1585edbd 100644 --- a/lib/private/connector/sabre/exception/filelocked.php +++ b/apps/dav/lib/connector/sabre/exception/filelocked.php @@ -22,7 +22,7 @@ * */ -namespace OC\Connector\Sabre\Exception; +namespace OCA\DAV\Connector\Sabre\Exception; use Exception; diff --git a/lib/private/connector/sabre/exception/invalidpath.php b/apps/dav/lib/connector/sabre/exception/invalidpath.php similarity index 97% rename from lib/private/connector/sabre/exception/invalidpath.php rename to apps/dav/lib/connector/sabre/exception/invalidpath.php index 6d84078fb1..608e427a5a 100644 --- a/lib/private/connector/sabre/exception/invalidpath.php +++ b/apps/dav/lib/connector/sabre/exception/invalidpath.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre\Exception; +namespace OCA\DAV\Connector\Sabre\Exception; use Sabre\DAV\Exception; diff --git a/lib/private/connector/sabre/exception/unsupportedmediatype.php b/apps/dav/lib/connector/sabre/exception/unsupportedmediatype.php similarity index 96% rename from lib/private/connector/sabre/exception/unsupportedmediatype.php rename to apps/dav/lib/connector/sabre/exception/unsupportedmediatype.php index b7e8594427..96b9b8332d 100644 --- a/lib/private/connector/sabre/exception/unsupportedmediatype.php +++ b/apps/dav/lib/connector/sabre/exception/unsupportedmediatype.php @@ -20,7 +20,7 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre\Exception; +namespace OCA\DAV\Connector\Sabre\Exception; /** * Unsupported Media Type diff --git a/lib/private/connector/sabre/exceptionloggerplugin.php b/apps/dav/lib/connector/sabre/exceptionloggerplugin.php similarity index 98% rename from lib/private/connector/sabre/exceptionloggerplugin.php rename to apps/dav/lib/connector/sabre/exceptionloggerplugin.php index 3f53431c8a..64ec5cfda8 100644 --- a/lib/private/connector/sabre/exceptionloggerplugin.php +++ b/apps/dav/lib/connector/sabre/exceptionloggerplugin.php @@ -22,7 +22,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\ILogger; use Sabre\DAV\Exception; diff --git a/lib/private/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php similarity index 98% rename from lib/private/connector/sabre/file.php rename to apps/dav/lib/connector/sabre/file.php index f4acc8290b..9e515cdc68 100644 --- a/lib/private/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -30,12 +30,12 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; -use OC\Connector\Sabre\Exception\EntityTooLarge; -use OC\Connector\Sabre\Exception\FileLocked; -use OC\Connector\Sabre\Exception\UnsupportedMediaType; use OC\Files\Filesystem; +use OCA\DAV\Connector\Sabre\Exception\EntityTooLarge; +use OCA\DAV\Connector\Sabre\Exception\FileLocked; +use OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType; use OCP\Encryption\Exceptions\GenericEncryptionException; use OCP\Files\EntityTooLargeException; use OCP\Files\InvalidContentException; diff --git a/lib/private/connector/sabre/filesplugin.php b/apps/dav/lib/connector/sabre/filesplugin.php similarity index 95% rename from lib/private/connector/sabre/filesplugin.php rename to apps/dav/lib/connector/sabre/filesplugin.php index 38a7139d9e..c9fc78a795 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/apps/dav/lib/connector/sabre/filesplugin.php @@ -24,7 +24,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use Sabre\DAV\IFile; use \Sabre\DAV\PropFind; @@ -161,7 +161,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { */ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) { - if ($node instanceof \OC\Connector\Sabre\Node) { + if ($node instanceof \OCA\DAV\Connector\Sabre\Node) { $propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) { return $node->getFileId(); @@ -181,9 +181,9 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { }); } - if ($node instanceof \OC\Connector\Sabre\File) { + if ($node instanceof \OCA\DAV\Connector\Sabre\File) { $propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) { - /** @var $node \OC\Connector\Sabre\File */ + /** @var $node \OCA\DAV\Connector\Sabre\File */ $directDownloadUrl = $node->getDirectDownload(); if (isset($directDownloadUrl['url'])) { return $directDownloadUrl['url']; @@ -192,7 +192,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { }); } - if ($node instanceof \OC\Connector\Sabre\Directory) { + if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) { $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { return $node->getSize(); }); @@ -254,7 +254,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { return; } $node = $this->server->tree->getNodeForPath($filePath); - if ($node instanceof \OC\Connector\Sabre\Node) { + if ($node instanceof \OCA\DAV\Connector\Sabre\Node) { $fileId = $node->getFileId(); if (!is_null($fileId)) { $this->server->httpResponse->setHeader('OC-FileId', $fileId); diff --git a/lib/private/connector/sabre/listenerplugin.php b/apps/dav/lib/connector/sabre/listenerplugin.php similarity index 100% rename from lib/private/connector/sabre/listenerplugin.php rename to apps/dav/lib/connector/sabre/listenerplugin.php diff --git a/lib/private/connector/sabre/lockplugin.php b/apps/dav/lib/connector/sabre/lockplugin.php similarity index 94% rename from lib/private/connector/sabre/lockplugin.php rename to apps/dav/lib/connector/sabre/lockplugin.php index a3a7bb84e3..47203df905 100644 --- a/lib/private/connector/sabre/lockplugin.php +++ b/apps/dav/lib/connector/sabre/lockplugin.php @@ -21,16 +21,14 @@ namespace OC\Connector\Sabre; -use OC\Connector\Sabre\Exception\FileLocked; +use OCA\DAV\Connector\Sabre\Exception\FileLocked; +use OCA\DAV\Connector\Sabre\Node; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use Sabre\DAV\Exception\NotFound; -use \Sabre\DAV\PropFind; -use \Sabre\DAV\PropPatch; use Sabre\DAV\ServerPlugin; use Sabre\DAV\Tree; use Sabre\HTTP\RequestInterface; -use Sabre\HTTP\ResponseInterface; class LockPlugin extends ServerPlugin { /** diff --git a/lib/private/connector/sabre/maintenanceplugin.php b/apps/dav/lib/connector/sabre/maintenanceplugin.php similarity index 98% rename from lib/private/connector/sabre/maintenanceplugin.php rename to apps/dav/lib/connector/sabre/maintenanceplugin.php index 4b7ff8a39d..b9b261fbe0 100644 --- a/lib/private/connector/sabre/maintenanceplugin.php +++ b/apps/dav/lib/connector/sabre/maintenanceplugin.php @@ -24,7 +24,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\IConfig; use Sabre\DAV\Exception\ServiceUnavailable; diff --git a/lib/private/connector/sabre/node.php b/apps/dav/lib/connector/sabre/node.php similarity index 98% rename from lib/private/connector/sabre/node.php rename to apps/dav/lib/connector/sabre/node.php index 30faf9941b..377536b530 100644 --- a/lib/private/connector/sabre/node.php +++ b/apps/dav/lib/connector/sabre/node.php @@ -28,9 +28,9 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; -use OC\Connector\Sabre\Exception\InvalidPath; +use OCA\DAV\Connector\Sabre\Exception\InvalidPath; abstract class Node implements \Sabre\DAV\INode { diff --git a/lib/private/connector/sabre/objecttree.php b/apps/dav/lib/connector/sabre/objecttree.php similarity index 96% rename from lib/private/connector/sabre/objecttree.php rename to apps/dav/lib/connector/sabre/objecttree.php index 18d3c1dcf2..80c0ef7461 100644 --- a/lib/private/connector/sabre/objecttree.php +++ b/apps/dav/lib/connector/sabre/objecttree.php @@ -23,10 +23,10 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; -use OC\Connector\Sabre\Exception\InvalidPath; -use OC\Connector\Sabre\Exception\FileLocked; +use OCA\DAV\Connector\Sabre\Exception\InvalidPath; +use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OC\Files\FileInfo; use OC\Files\Mount\MoveableMount; use OCP\Files\StorageInvalidException; @@ -160,9 +160,9 @@ class ObjectTree extends \Sabre\DAV\Tree { } if ($info->getType() === 'dir') { - $node = new \OC\Connector\Sabre\Directory($this->fileView, $info); + $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info); } else { - $node = new \OC\Connector\Sabre\File($this->fileView, $info); + $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); } $this->cache[$path] = $node; diff --git a/lib/private/connector/sabre/principal.php b/apps/dav/lib/connector/sabre/principal.php similarity index 99% rename from lib/private/connector/sabre/principal.php rename to apps/dav/lib/connector/sabre/principal.php index 9d81c4337d..35215e1f63 100644 --- a/lib/private/connector/sabre/principal.php +++ b/apps/dav/lib/connector/sabre/principal.php @@ -28,7 +28,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\IUserManager; use OCP\IConfig; diff --git a/lib/private/connector/sabre/quotaplugin.php b/apps/dav/lib/connector/sabre/quotaplugin.php similarity index 99% rename from lib/private/connector/sabre/quotaplugin.php rename to apps/dav/lib/connector/sabre/quotaplugin.php index 22b687b350..8340d489dc 100644 --- a/lib/private/connector/sabre/quotaplugin.php +++ b/apps/dav/lib/connector/sabre/quotaplugin.php @@ -25,7 +25,7 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; /** * This plugin check user quota and deny creating files when they exceeds the quota. diff --git a/lib/private/connector/sabre/server.php b/apps/dav/lib/connector/sabre/server.php similarity index 94% rename from lib/private/connector/sabre/server.php rename to apps/dav/lib/connector/sabre/server.php index 7a031f1d32..eafe1b537f 100644 --- a/lib/private/connector/sabre/server.php +++ b/apps/dav/lib/connector/sabre/server.php @@ -22,10 +22,10 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; /** - * Class \OC\Connector\Sabre\Server + * Class \OCA\DAV\Connector\Sabre\Server * * This class overrides some methods from @see \Sabre\DAV\Server. * diff --git a/lib/private/connector/sabre/serverfactory.php b/apps/dav/lib/connector/sabre/serverfactory.php similarity index 72% rename from lib/private/connector/sabre/serverfactory.php rename to apps/dav/lib/connector/sabre/serverfactory.php index 893e29fd41..b62f90ab80 100644 --- a/lib/private/connector/sabre/serverfactory.php +++ b/apps/dav/lib/connector/sabre/serverfactory.php @@ -20,7 +20,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\Files\Mount\IMountManager; use OCP\IConfig; @@ -59,22 +59,22 @@ class ServerFactory { */ public function createServer($baseUri, $requestUri, BackendInterface $authBackend, callable $viewCallBack) { // Fire up server - $objectTree = new \OC\Connector\Sabre\ObjectTree(); - $server = new \OC\Connector\Sabre\Server($objectTree); + $objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree(); + $server = new \OCA\DAV\Connector\Sabre\Server($objectTree); // Set URL explicitly due to reverse-proxy situations $server->httpRequest->setUrl($requestUri); $server->setBaseUri($baseUri); // Load plugins $defaults = new \OC_Defaults(); - $server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin($this->config)); - $server->addPlugin(new \OC\Connector\Sabre\BlockLegacyClientPlugin($this->config)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config)); $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName())); // FIXME: The following line is a workaround for legacy components relying on being able to send a GET to / - $server->addPlugin(new \OC\Connector\Sabre\DummyGetResponsePlugin()); - $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger)); - $server->addPlugin(new \OC\Connector\Sabre\LockPlugin($objectTree)); - $server->addPlugin(new \OC\Connector\Sabre\ListenerPlugin($this->dispatcher)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin()); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin($objectTree)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\ListenerPlugin($this->dispatcher)); // wait with registering these until auth is handled and the filesystem is setup $server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) { @@ -84,21 +84,21 @@ class ServerFactory { // Create ownCloud Dir if ($rootInfo->getType() === 'dir') { - $root = new \OC\Connector\Sabre\Directory($view, $rootInfo); + $root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo); } else { - $root = new \OC\Connector\Sabre\File($view, $rootInfo); + $root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo); } $objectTree->init($root, $view, $this->mountManager); - $server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree, $view)); - $server->addPlugin(new \OC\Connector\Sabre\QuotaPlugin($view)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesPlugin($objectTree, $view)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view)); if($this->userSession->isLoggedIn()) { - $server->addPlugin(new \OC\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager)); // custom properties plugin must be the last one $server->addPlugin( new \Sabre\DAV\PropertyStorage\Plugin( - new \OC\Connector\Sabre\CustomPropertiesBackend( + new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend( $objectTree, $this->databaseConnection, $this->userSession->getUser() @@ -106,7 +106,7 @@ class ServerFactory { ) ); } - $server->addPlugin(new \OC\Connector\Sabre\CopyEtagHeaderPlugin()); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin()); }, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request return $server; } diff --git a/lib/private/connector/sabre/taglist.php b/apps/dav/lib/connector/sabre/taglist.php similarity index 96% rename from lib/private/connector/sabre/taglist.php rename to apps/dav/lib/connector/sabre/taglist.php index 9fb34ba12d..177cc23e80 100644 --- a/lib/private/connector/sabre/taglist.php +++ b/apps/dav/lib/connector/sabre/taglist.php @@ -20,7 +20,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use Sabre\DAV; @@ -86,7 +86,7 @@ class TagList extends DAV\Property { * * @param \DOMElement $dom * @param array $propertyMap - * @return \OC\Connector\Sabre\TagList + * @return \OCA\DAV\Connector\Sabre\TagList */ static function unserialize(\DOMElement $dom, array $propertyMap) { diff --git a/lib/private/connector/sabre/tagsplugin.php b/apps/dav/lib/connector/sabre/tagsplugin.php similarity index 97% rename from lib/private/connector/sabre/tagsplugin.php rename to apps/dav/lib/connector/sabre/tagsplugin.php index 7756eb45bd..7446d97790 100644 --- a/lib/private/connector/sabre/tagsplugin.php +++ b/apps/dav/lib/connector/sabre/tagsplugin.php @@ -18,7 +18,7 @@ * along with this program. If not, see * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; /** * ownCloud @@ -206,12 +206,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin PropFind $propFind, \Sabre\DAV\INode $node ) { - if (!($node instanceof \OC\Connector\Sabre\Node)) { + if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) { return; } // need prefetch ? - if ($node instanceof \OC\Connector\Sabre\Directory + if ($node instanceof \OCA\DAV\Connector\Sabre\Directory && $propFind->getDepth() !== 0 && (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME)) || !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME)) diff --git a/tests/lib/connector/sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/connector/sabre/BlockLegacyClientPluginTest.php similarity index 98% rename from tests/lib/connector/sabre/BlockLegacyClientPluginTest.php rename to apps/dav/tests/unit/connector/sabre/BlockLegacyClientPluginTest.php index 05488d9716..1e390cf15f 100644 --- a/tests/lib/connector/sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/connector/sabre/BlockLegacyClientPluginTest.php @@ -21,7 +21,7 @@ namespace Test\Connector\Sabre; -use OC\Connector\Sabre\BlockLegacyClientPlugin; +use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin; use Test\TestCase; use OCP\IConfig; diff --git a/tests/lib/connector/sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/connector/sabre/DummyGetResponsePluginTest.php similarity index 97% rename from tests/lib/connector/sabre/DummyGetResponsePluginTest.php rename to apps/dav/tests/unit/connector/sabre/DummyGetResponsePluginTest.php index 096c2c5f0d..1fd89c84ff 100644 --- a/tests/lib/connector/sabre/DummyGetResponsePluginTest.php +++ b/apps/dav/tests/unit/connector/sabre/DummyGetResponsePluginTest.php @@ -21,7 +21,7 @@ namespace Test\Connector\Sabre; -use OC\Connector\Sabre\DummyGetResponsePlugin; +use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin; use Test\TestCase; /** diff --git a/tests/lib/connector/sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/connector/sabre/MaintenancePluginTest.php similarity index 97% rename from tests/lib/connector/sabre/MaintenancePluginTest.php rename to apps/dav/tests/unit/connector/sabre/MaintenancePluginTest.php index e5b50f71de..c0acd4fc3d 100644 --- a/tests/lib/connector/sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/connector/sabre/MaintenancePluginTest.php @@ -21,7 +21,7 @@ namespace Test\Connector\Sabre; -use OC\Connector\Sabre\MaintenancePlugin; +use OCA\DAV\Connector\Sabre\MaintenancePlugin; use Test\TestCase; use OCP\IConfig; diff --git a/tests/lib/connector/sabre/copyetagheaderplugintest.php b/apps/dav/tests/unit/connector/sabre/copyetagheaderplugintest.php similarity index 88% rename from tests/lib/connector/sabre/copyetagheaderplugintest.php rename to apps/dav/tests/unit/connector/sabre/copyetagheaderplugintest.php index 6b1b5e96fd..2080755cd5 100644 --- a/tests/lib/connector/sabre/copyetagheaderplugintest.php +++ b/apps/dav/tests/unit/connector/sabre/copyetagheaderplugintest.php @@ -11,14 +11,14 @@ namespace Tests\Connector\Sabre; class CopyEtagPluginTest extends \Test\TestCase { /** - * @var \OC\Connector\Sabre\CopyEtagHeaderPlugin + * @var \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin */ private $plugin; public function setUp() { parent::setUp(); $this->server = new \Sabre\DAV\Server(); - $this->plugin = new \OC\Connector\Sabre\CopyEtagHeaderPlugin(); + $this->plugin = new \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin(); $this->plugin->initialize($this->server); } diff --git a/tests/lib/connector/sabre/custompropertiesbackend.php b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php similarity index 93% rename from tests/lib/connector/sabre/custompropertiesbackend.php rename to apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php index 212bece940..973a5d4c27 100644 --- a/tests/lib/connector/sabre/custompropertiesbackend.php +++ b/apps/dav/tests/unit/connector/sabre/custompropertiesbackend.php @@ -21,7 +21,7 @@ class CustomPropertiesBackend extends \Test\TestCase { private $tree; /** - * @var \OC\Connector\Sabre\CustomPropertiesBackend + * @var \OCA\DAV\Connector\Sabre\CustomPropertiesBackend */ private $plugin; @@ -44,7 +44,7 @@ class CustomPropertiesBackend extends \Test\TestCase { ->method('getUID') ->will($this->returnValue($userId)); - $this->plugin = new \OC\Connector\Sabre\CustomPropertiesBackend( + $this->plugin = new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend( $this->tree, \OC::$server->getDatabaseConnection(), $this->user @@ -143,7 +143,7 @@ class CustomPropertiesBackend extends \Test\TestCase { * Test setting/getting properties */ public function testSetGetPropertiesForFile() { - $node = $this->createTestNode('\OC\Connector\Sabre\File'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $this->tree->expects($this->any()) ->method('getNodeForPath') ->with('/dummypath') @@ -175,9 +175,9 @@ class CustomPropertiesBackend extends \Test\TestCase { * Test getting properties from directory */ public function testGetPropertiesForDirectory() { - $rootNode = $this->createTestNode('\OC\Connector\Sabre\Directory'); + $rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); - $nodeSub = $this->getMockBuilder('\OC\Connector\Sabre\File') + $nodeSub = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File') ->disableOriginalConstructor() ->getMock(); $nodeSub->expects($this->any()) @@ -259,7 +259,7 @@ class CustomPropertiesBackend extends \Test\TestCase { * Test delete property */ public function testDeleteProperty() { - $node = $this->createTestNode('\OC\Connector\Sabre\File'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $this->tree->expects($this->any()) ->method('getNodeForPath') ->with('/dummypath') diff --git a/tests/lib/connector/sabre/directory.php b/apps/dav/tests/unit/connector/sabre/directory.php similarity index 91% rename from tests/lib/connector/sabre/directory.php rename to apps/dav/tests/unit/connector/sabre/directory.php index c846f109d8..d85290df80 100644 --- a/tests/lib/connector/sabre/directory.php +++ b/apps/dav/tests/unit/connector/sabre/directory.php @@ -29,7 +29,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { ->method('getPath') ->will($this->returnValue($path)); - return new \OC\Connector\Sabre\Directory($this->view, $this->info); + return new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info); } /** @@ -124,7 +124,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { ->method('getRelativePath') ->will($this->returnValue('')); - $dir = new \OC\Connector\Sabre\Directory($this->view, $this->info); + $dir = new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info); $nodes = $dir->getChildren(); $this->assertEquals(2, count($nodes)); @@ -142,12 +142,12 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { ->method('getFileInfo') ->willThrowException(new \OCP\Files\StorageNotAvailableException()); - $dir = new \OC\Connector\Sabre\Directory($this->view, $this->info); + $dir = new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info); $dir->getChild('.'); } /** - * @expectedException \OC\Connector\Sabre\Exception\InvalidPath + * @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath */ public function testGetChildThrowInvalidPath() { $this->view->expects($this->once()) @@ -156,7 +156,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { $this->view->expects($this->never()) ->method('getFileInfo'); - $dir = new \OC\Connector\Sabre\Directory($this->view, $this->info); + $dir = new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info); $dir->getChild('.'); } @@ -186,7 +186,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase { ->method('getStorage') ->will($this->returnValue($storage)); - $dir = new \OC\Connector\Sabre\Directory($this->view, $this->info); + $dir = new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info); $this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free } } diff --git a/tests/lib/connector/sabre/exception/invalidpathtest.php b/apps/dav/tests/unit/connector/sabre/exception/invalidpathtest.php similarity index 95% rename from tests/lib/connector/sabre/exception/invalidpathtest.php rename to apps/dav/tests/unit/connector/sabre/exception/invalidpathtest.php index d2d58887d6..4c0af58ffe 100644 --- a/tests/lib/connector/sabre/exception/invalidpathtest.php +++ b/apps/dav/tests/unit/connector/sabre/exception/invalidpathtest.php @@ -2,7 +2,7 @@ namespace Test\Connector\Sabre\Exception; -use OC\Connector\Sabre\Exception\InvalidPath; +use OCA\DAV\Connector\Sabre\Exception\InvalidPath; /** * Copyright (c) 2015 Thomas Müller diff --git a/tests/lib/connector/sabre/exceptionloggerplugin.php b/apps/dav/tests/unit/connector/sabre/exceptionloggerplugin.php similarity index 93% rename from tests/lib/connector/sabre/exceptionloggerplugin.php rename to apps/dav/tests/unit/connector/sabre/exceptionloggerplugin.php index 0662ba029d..d85aa5a9cc 100644 --- a/tests/lib/connector/sabre/exceptionloggerplugin.php +++ b/apps/dav/tests/unit/connector/sabre/exceptionloggerplugin.php @@ -9,8 +9,8 @@ namespace Test\Connector\Sabre; -use OC\Connector\Sabre\Exception\InvalidPath; -use OC\Connector\Sabre\ExceptionLoggerPlugin as PluginToTest; +use OCA\DAV\Connector\Sabre\Exception\InvalidPath; +use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin as PluginToTest; use OC\Log; use OCP\ILogger; use PHPUnit_Framework_MockObject_MockObject; diff --git a/tests/lib/connector/sabre/file.php b/apps/dav/tests/unit/connector/sabre/file.php similarity index 93% rename from tests/lib/connector/sabre/file.php rename to apps/dav/tests/unit/connector/sabre/file.php index fe4c5ec7c2..6685ddac91 100644 --- a/tests/lib/connector/sabre/file.php +++ b/apps/dav/tests/unit/connector/sabre/file.php @@ -61,11 +61,11 @@ class File extends \Test\TestCase { ], [ new \OCP\Files\EntityTooLargeException(), - 'OC\Connector\Sabre\Exception\EntityTooLarge' + 'OCA\DAV\Connector\Sabre\Exception\EntityTooLarge' ], [ new \OCP\Files\InvalidContentException(), - 'OC\Connector\Sabre\Exception\UnsupportedMediaType' + 'OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType' ], [ new \OCP\Files\InvalidPathException(), @@ -73,11 +73,11 @@ class File extends \Test\TestCase { ], [ new \OCP\Files\LockNotAcquiredException('/test.txt', 1), - 'OC\Connector\Sabre\Exception\FileLocked' + 'OCA\DAV\Connector\Sabre\Exception\FileLocked' ], [ new \OCP\Lock\LockedException('/test.txt'), - 'OC\Connector\Sabre\Exception\FileLocked' + 'OCA\DAV\Connector\Sabre\Exception\FileLocked' ], [ new \OCP\Encryption\Exceptions\GenericEncryptionException(), @@ -137,7 +137,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $caughtException = null; @@ -196,7 +196,7 @@ class File extends \Test\TestCase { $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-0', null, null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL ], null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // put first chunk $this->assertNull($file->put('test data one')); @@ -204,7 +204,7 @@ class File extends \Test\TestCase { $info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-1', null, null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL ], null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $caughtException = null; @@ -249,7 +249,7 @@ class File extends \Test\TestCase { null ); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // beforeMethod locks $view->lockFile($path, ILockingProvider::LOCK_SHARED); @@ -436,7 +436,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $thrown = false; @@ -469,7 +469,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $thrown = false; @@ -481,7 +481,7 @@ class File extends \Test\TestCase { // afterMethod unlocks $view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED); - } catch (\OC\Connector\Sabre\Exception\FileLocked $e) { + } catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) { $thrown = true; } @@ -503,19 +503,19 @@ class File extends \Test\TestCase { $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-0', null, null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL ], null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $this->assertNull($file->put('test data one')); $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', null, null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL ], null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $thrown = false; try { $file->put($this->getStream('test data')); - } catch (\OC\Connector\Sabre\Exception\FileLocked $e) { + } catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) { $thrown = true; } @@ -536,7 +536,7 @@ class File extends \Test\TestCase { $info = new \OC\Files\FileInfo('/*', null, null, array( 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $thrown = false; @@ -548,7 +548,7 @@ class File extends \Test\TestCase { // afterMethod unlocks $view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED); - } catch (\OC\Connector\Sabre\Exception\InvalidPath $e) { + } catch (\OCA\DAV\Connector\Sabre\Exception\InvalidPath $e) { $thrown = true; } @@ -559,7 +559,7 @@ class File extends \Test\TestCase { /** * Test setting name with setName() with invalid chars * - * @expectedException \OC\Connector\Sabre\Exception\InvalidPath + * @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath */ public function testSetNameInvalidChars() { // setup @@ -572,7 +572,7 @@ class File extends \Test\TestCase { $info = new \OC\Files\FileInfo('/*', null, null, array( 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $file->setName('/super*star.txt'); } @@ -600,7 +600,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $thrown = false; @@ -636,7 +636,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $file->delete(); @@ -654,7 +654,7 @@ class File extends \Test\TestCase { 'permissions' => 0 ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $file->delete(); @@ -677,7 +677,7 @@ class File extends \Test\TestCase { 'permissions' => \OCP\Constants::PERMISSION_ALL ), null); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action $file->delete(); @@ -714,7 +714,7 @@ class File extends \Test\TestCase { null ); - $file = new \OC\Connector\Sabre\File($view, $info); + $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $this->assertFalse( $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED), diff --git a/tests/lib/connector/sabre/filesplugin.php b/apps/dav/tests/unit/connector/sabre/filesplugin.php similarity index 85% rename from tests/lib/connector/sabre/filesplugin.php rename to apps/dav/tests/unit/connector/sabre/filesplugin.php index 391062d679..a91ca7a4ff 100644 --- a/tests/lib/connector/sabre/filesplugin.php +++ b/apps/dav/tests/unit/connector/sabre/filesplugin.php @@ -9,12 +9,12 @@ namespace Tests\Connector\Sabre; * See the COPYING-README file. */ class FilesPlugin extends \Test\TestCase { - const GETETAG_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::GETETAG_PROPERTYNAME; - const FILEID_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::FILEID_PROPERTYNAME; - const SIZE_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::SIZE_PROPERTYNAME; - const PERMISSIONS_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::PERMISSIONS_PROPERTYNAME; - const LASTMODIFIED_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::LASTMODIFIED_PROPERTYNAME; - const DOWNLOADURL_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::DOWNLOADURL_PROPERTYNAME; + const GETETAG_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::GETETAG_PROPERTYNAME; + const FILEID_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::FILEID_PROPERTYNAME; + const SIZE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::SIZE_PROPERTYNAME; + const PERMISSIONS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::PERMISSIONS_PROPERTYNAME; + const LASTMODIFIED_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::LASTMODIFIED_PROPERTYNAME; + const DOWNLOADURL_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::DOWNLOADURL_PROPERTYNAME; /** * @var \Sabre\DAV\Server @@ -22,12 +22,12 @@ class FilesPlugin extends \Test\TestCase { private $server; /** - * @var \Sabre\DAV\ObjectTree + * @var \Sabre\DAV\Tree */ private $tree; /** - * @var \OC\Connector\Sabre\FilesPlugin + * @var \OCA\DAV\Connector\Sabre\FilesPlugin */ private $plugin; @@ -48,7 +48,7 @@ class FilesPlugin extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->plugin = new \OC\Connector\Sabre\FilesPlugin($this->tree, $this->view); + $this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin($this->tree, $this->view); $this->plugin->initialize($this->server); } @@ -81,7 +81,7 @@ class FilesPlugin extends \Test\TestCase { /** */ public function testGetPropertiesForFile() { - $node = $this->createTestNode('\OC\Connector\Sabre\File'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $propFind = new \Sabre\DAV\PropFind( '/dummyPath', @@ -115,7 +115,7 @@ class FilesPlugin extends \Test\TestCase { } public function testGetPublicPermissions() { - $this->plugin = new \OC\Connector\Sabre\FilesPlugin($this->tree, $this->view, true); + $this->plugin = new \OCA\DAV\Connector\Sabre\FilesPlugin($this->tree, $this->view, true); $this->plugin->initialize($this->server); $propFind = new \Sabre\DAV\PropFind( @@ -126,7 +126,7 @@ class FilesPlugin extends \Test\TestCase { 0 ); - $node = $this->createTestNode('\OC\Connector\Sabre\File'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $node->expects($this->any()) ->method('getDavPermissions') ->will($this->returnValue('DWCKMSR')); @@ -140,7 +140,7 @@ class FilesPlugin extends \Test\TestCase { } public function testGetPropertiesForDirectory() { - $node = $this->createTestNode('\OC\Connector\Sabre\Directory'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); $propFind = new \Sabre\DAV\PropFind( '/dummyPath', @@ -174,7 +174,7 @@ class FilesPlugin extends \Test\TestCase { } public function testUpdateProps() { - $node = $this->createTestNode('\OC\Connector\Sabre\File'); + $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $testDate = 'Fri, 13 Feb 2015 00:01:02 GMT'; diff --git a/tests/lib/connector/sabre/node.php b/apps/dav/tests/unit/connector/sabre/node.php similarity index 97% rename from tests/lib/connector/sabre/node.php rename to apps/dav/tests/unit/connector/sabre/node.php index 3b3a610781..a9610fd84b 100644 --- a/tests/lib/connector/sabre/node.php +++ b/apps/dav/tests/unit/connector/sabre/node.php @@ -46,7 +46,7 @@ class Node extends \Test\TestCase { ->will($this->returnValue($type)); $view = $this->getMock('\OC\Files\View'); - $node = new \OC\Connector\Sabre\File($view, $info); + $node = new \OCA\DAV\Connector\Sabre\File($view, $info); $this->assertEquals($expected, $node->getDavPermissions()); } } diff --git a/tests/lib/connector/sabre/objecttree.php b/apps/dav/tests/unit/connector/sabre/objecttree.php similarity index 88% rename from tests/lib/connector/sabre/objecttree.php rename to apps/dav/tests/unit/connector/sabre/objecttree.php index 1eaddf53a1..2691385c1c 100644 --- a/tests/lib/connector/sabre/objecttree.php +++ b/apps/dav/tests/unit/connector/sabre/objecttree.php @@ -6,11 +6,11 @@ * See the COPYING-README file. */ -namespace Test\OC\Connector\Sabre; +namespace Test\OCA\DAV\Connector\Sabre; use OC\Files\FileInfo; -use OC\Connector\Sabre\Directory; +use OCA\DAV\Connector\Sabre\Directory; use OC\Files\Storage\Temporary; class TestDoubleFileView extends \OC\Files\View { @@ -62,7 +62,7 @@ class ObjectTree extends \Test\TestCase { /** * @dataProvider moveFailedInvalidCharsProvider - * @expectedException \OC\Connector\Sabre\Exception\InvalidPath + * @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath */ public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) { $this->moveTest($source, $destination, $updatables, $deletables); @@ -104,7 +104,7 @@ class ObjectTree extends \Test\TestCase { $info = new FileInfo('', null, null, array(), null); $rootDir = new Directory($view, $info); - $objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree', + $objectTree = $this->getMock('\OCA\DAV\Connector\Sabre\ObjectTree', array('nodeExists', 'getNodeForPath'), array($rootDir, $view)); @@ -113,7 +113,7 @@ class ObjectTree extends \Test\TestCase { ->with($this->identicalTo($source)) ->will($this->returnValue(false)); - /** @var $objectTree \OC\Connector\Sabre\ObjectTree */ + /** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */ $mountManager = \OC\Files\Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); $objectTree->move($source, $destination); @@ -134,7 +134,7 @@ class ObjectTree extends \Test\TestCase { $_SERVER['HTTP_OC_CHUNKED'] = true; } - $rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory') + $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); $mountManager = $this->getMock('\OC\Files\Mount\Manager'); @@ -152,7 +152,7 @@ class ObjectTree extends \Test\TestCase { ->with($fileInfoQueryPath) ->will($this->returnValue($fileInfo)); - $tree = new \OC\Connector\Sabre\ObjectTree(); + $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree->init($rootNode, $view, $mountManager); $node = $tree->getNodeForPath($inputFileName); @@ -161,9 +161,9 @@ class ObjectTree extends \Test\TestCase { $this->assertEquals($outputFileName, $node->getName()); if ($type === 'file') { - $this->assertTrue($node instanceof \OC\Connector\Sabre\File); + $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\File); } else { - $this->assertTrue($node instanceof \OC\Connector\Sabre\Directory); + $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\Directory); } unset($_SERVER['HTTP_OC_CHUNKED']); @@ -239,7 +239,7 @@ class ObjectTree extends \Test\TestCase { } /** - * @expectedException \OC\Connector\Sabre\Exception\InvalidPath + * @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath */ public function testGetNodeForPathInvalidPath() { $path = '/foo\bar'; @@ -254,12 +254,12 @@ class ObjectTree extends \Test\TestCase { return [$storage, ltrim($path, '/')]; })); - $rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory') + $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); $mountManager = $this->getMock('\OC\Files\Mount\Manager'); - $tree = new \OC\Connector\Sabre\ObjectTree(); + $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree->init($rootNode, $view, $mountManager); $tree->getNodeForPath($path); @@ -278,12 +278,12 @@ class ObjectTree extends \Test\TestCase { return [$storage, ltrim($path, '/')]; })); - $rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory') + $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); $mountManager = $this->getMock('\OC\Files\Mount\Manager'); - $tree = new \OC\Connector\Sabre\ObjectTree(); + $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree->init($rootNode, $view, $mountManager); $this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path)); diff --git a/tests/lib/connector/sabre/principal.php b/apps/dav/tests/unit/connector/sabre/principal.php similarity index 97% rename from tests/lib/connector/sabre/principal.php rename to apps/dav/tests/unit/connector/sabre/principal.php index 1841a79bec..3c0abeac3f 100644 --- a/tests/lib/connector/sabre/principal.php +++ b/apps/dav/tests/unit/connector/sabre/principal.php @@ -19,7 +19,7 @@ class Principal extends \Test\TestCase { private $userManager; /** @var IConfig */ private $config; - /** @var \OC\Connector\Sabre\Principal */ + /** @var \OCA\DAV\Connector\Sabre\Principal */ private $connector; public function setUp() { @@ -28,7 +28,7 @@ class Principal extends \Test\TestCase { $this->config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor()->getMock(); - $this->connector = new \OC\Connector\Sabre\Principal($this->config, $this->userManager); + $this->connector = new \OCA\DAV\Connector\Sabre\Principal($this->config, $this->userManager); parent::setUp(); } diff --git a/tests/lib/connector/sabre/quotaplugin.php b/apps/dav/tests/unit/connector/sabre/quotaplugin.php similarity index 96% rename from tests/lib/connector/sabre/quotaplugin.php rename to apps/dav/tests/unit/connector/sabre/quotaplugin.php index 3d9cd9b5da..5d3364e1f8 100644 --- a/tests/lib/connector/sabre/quotaplugin.php +++ b/apps/dav/tests/unit/connector/sabre/quotaplugin.php @@ -14,14 +14,14 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends \Test\TestCase { private $server; /** - * @var \OC\Connector\Sabre\QuotaPlugin + * @var \OCA\DAV\Connector\Sabre\QuotaPlugin */ private $plugin; private function init($quota) { $view = $this->buildFileViewMock($quota); $this->server = new \Sabre\DAV\Server(); - $this->plugin = new \OC\Connector\Sabre\QuotaPlugin($view); + $this->plugin = new \OCA\DAV\Connector\Sabre\QuotaPlugin($view); $this->plugin->initialize($this->server); } diff --git a/tests/lib/connector/sabre/requesttest/auth.php b/apps/dav/tests/unit/connector/sabre/requesttest/auth.php similarity index 100% rename from tests/lib/connector/sabre/requesttest/auth.php rename to apps/dav/tests/unit/connector/sabre/requesttest/auth.php diff --git a/tests/lib/connector/sabre/requesttest/exceptionplugin.php b/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php similarity index 88% rename from tests/lib/connector/sabre/requesttest/exceptionplugin.php rename to apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php index 2b9e5d6d46..606b5a2798 100644 --- a/tests/lib/connector/sabre/requesttest/exceptionplugin.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php @@ -10,7 +10,7 @@ namespace Test\Connector\Sabre\RequestTest; use Sabre\DAV\Exception; -class ExceptionPlugin extends \OC\Connector\Sabre\ExceptionLoggerPlugin { +class ExceptionPlugin extends \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin { /** * @var \Exception[] */ diff --git a/tests/lib/connector/sabre/requesttest/requesttest.php b/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php similarity index 96% rename from tests/lib/connector/sabre/requesttest/requesttest.php rename to apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php index 4d4c8173ca..4e1bc16819 100644 --- a/tests/lib/connector/sabre/requesttest/requesttest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php @@ -8,8 +8,8 @@ namespace Test\Connector\Sabre\RequestTest; -use OC\Connector\Sabre\Server; -use OC\Connector\Sabre\ServerFactory; +use OCA\DAV\Connector\Sabre\Server; +use OCA\DAV\Connector\Sabre\ServerFactory; use OC\Files\Mount\MountPoint; use OC\Files\Storage\StorageFactory; use OC\Files\Storage\Temporary; @@ -25,7 +25,7 @@ abstract class RequestTest extends TestCase { use MountProviderTrait; /** - * @var \OC\Connector\Sabre\ServerFactory + * @var \OCA\DAV\Connector\Sabre\ServerFactory */ protected $serverFactory; diff --git a/tests/lib/connector/sabre/requesttest/sapi.php b/apps/dav/tests/unit/connector/sabre/requesttest/sapi.php similarity index 100% rename from tests/lib/connector/sabre/requesttest/sapi.php rename to apps/dav/tests/unit/connector/sabre/requesttest/sapi.php diff --git a/tests/lib/connector/sabre/requesttest/uploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php similarity index 100% rename from tests/lib/connector/sabre/requesttest/uploadtest.php rename to apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php diff --git a/tests/lib/connector/sabre/tagsplugin.php b/apps/dav/tests/unit/connector/sabre/tagsplugin.php similarity index 87% rename from tests/lib/connector/sabre/tagsplugin.php rename to apps/dav/tests/unit/connector/sabre/tagsplugin.php index f8af73fecf..4731e770cf 100644 --- a/tests/lib/connector/sabre/tagsplugin.php +++ b/apps/dav/tests/unit/connector/sabre/tagsplugin.php @@ -10,9 +10,9 @@ namespace Tests\Connector\Sabre; */ class TagsPlugin extends \Test\TestCase { - const TAGS_PROPERTYNAME = \OC\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME; - const FAVORITE_PROPERTYNAME = \OC\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME; - const TAG_FAVORITE = \OC\Connector\Sabre\TagsPlugin::TAG_FAVORITE; + const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME; + const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME; + const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE; /** * @var \Sabre\DAV\Server @@ -35,7 +35,7 @@ class TagsPlugin extends \Test\TestCase { private $tagger; /** - * @var \OC\Connector\Sabre\TagsPlugin + * @var \OCA\DAV\Connector\Sabre\TagsPlugin */ private $plugin; @@ -51,7 +51,7 @@ class TagsPlugin extends \Test\TestCase { ->method('load') ->with('files') ->will($this->returnValue($this->tagger)); - $this->plugin = new \OC\Connector\Sabre\TagsPlugin($this->tree, $this->tagManager); + $this->plugin = new \OCA\DAV\Connector\Sabre\TagsPlugin($this->tree, $this->tagManager); $this->plugin->initialize($this->server); } @@ -59,7 +59,7 @@ class TagsPlugin extends \Test\TestCase { * @dataProvider tagsGetPropertiesDataProvider */ public function testGetProperties($tags, $requestedProperties, $expectedProperties) { - $node = $this->getMockBuilder('\OC\Connector\Sabre\Node') + $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -98,13 +98,13 @@ class TagsPlugin extends \Test\TestCase { * @dataProvider tagsGetPropertiesDataProvider */ public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) { - $node1 = $this->getMockBuilder('\OC\Connector\Sabre\File') + $node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File') ->disableOriginalConstructor() ->getMock(); $node1->expects($this->any()) ->method('getId') ->will($this->returnValue(111)); - $node2 = $this->getMockBuilder('\OC\Connector\Sabre\File') + $node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File') ->disableOriginalConstructor() ->getMock(); $node2->expects($this->any()) @@ -119,7 +119,7 @@ class TagsPlugin extends \Test\TestCase { $expectedCallCount = 1; } - $node = $this->getMockBuilder('\OC\Connector\Sabre\Directory') + $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -184,7 +184,7 @@ class TagsPlugin extends \Test\TestCase { array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), array( 200 => array( - self::TAGS_PROPERTYNAME => new \OC\Connector\Sabre\TagList(array('tag1', 'tag2')), + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), self::FAVORITE_PROPERTYNAME => true, ) ) @@ -195,7 +195,7 @@ class TagsPlugin extends \Test\TestCase { array(self::TAGS_PROPERTYNAME), array( 200 => array( - self::TAGS_PROPERTYNAME => new \OC\Connector\Sabre\TagList(array('tag1', 'tag2')), + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), ) ) ), @@ -223,7 +223,7 @@ class TagsPlugin extends \Test\TestCase { array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), array( 200 => array( - self::TAGS_PROPERTYNAME => new \OC\Connector\Sabre\TagList(array()), + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array()), self::FAVORITE_PROPERTYNAME => false, ) ) @@ -234,7 +234,7 @@ class TagsPlugin extends \Test\TestCase { public function testUpdateTags() { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" - $node = $this->getMockBuilder('\OC\Connector\Sabre\Node') + $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -266,7 +266,7 @@ class TagsPlugin extends \Test\TestCase { // properties to set $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OC\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) )); $this->plugin->handleUpdateProperties( @@ -285,7 +285,7 @@ class TagsPlugin extends \Test\TestCase { } public function testUpdateTagsFromScratch() { - $node = $this->getMockBuilder('\OC\Connector\Sabre\Node') + $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -312,7 +312,7 @@ class TagsPlugin extends \Test\TestCase { // properties to set $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OC\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) )); $this->plugin->handleUpdateProperties( @@ -333,7 +333,7 @@ class TagsPlugin extends \Test\TestCase { public function testUpdateFav() { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" - $node = $this->getMockBuilder('\OC\Connector\Sabre\Node') + $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml index 8586c6794f..9ec6a9c43e 100644 --- a/apps/files/appinfo/info.xml +++ b/apps/files/appinfo/info.xml @@ -12,10 +12,6 @@ - - appinfo/remote.php - appinfo/remote.php - user-files diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index 02f7f3c027..d6a745d028 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -32,7 +32,7 @@ set_time_limit(0); // Turn off output buffering to prevent memory problems \OC_Util::obEnd(); -$serverFactory = new \OC\Connector\Sabre\ServerFactory( +$serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), @@ -43,7 +43,7 @@ $serverFactory = new \OC\Connector\Sabre\ServerFactory( ); // Backends -$authBackend = new \OC\Connector\Sabre\Auth(); +$authBackend = new \OCA\DAV\Connector\Sabre\Auth(); $requestUri = \OC::$server->getRequest()->getRequestUri(); $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() { diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index 28c64cbb1b..cf69050a9f 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -17,6 +17,5 @@ Turning the feature off removes shared files and folders on the server for all s public.php - publicwebdav.php diff --git a/core/shipped.json b/core/shipped.json index ffa4ee9c73..184308d7a4 100644 --- a/core/shipped.json +++ b/core/shipped.json @@ -4,6 +4,7 @@ "activity", "admin_audit", "encryption", + "dav", "enterprise_key", "external", "files", diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index d9fee48bed..cdd8eefd0d 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -372,7 +372,7 @@ abstract class Common implements Storage { * @return string|false */ public function getETag($path) { - $ETagFunction = \OC\Connector\Sabre\Node::$ETagFunction; + $ETagFunction = \OCA\DAV\Connector\Sabre\Node::$ETagFunction; if ($ETagFunction) { $hash = call_user_func($ETagFunction, $path); return $hash; diff --git a/remote.php b/remote.php index b901b1f0fd..0282877ca2 100644 --- a/remote.php +++ b/remote.php @@ -26,7 +26,7 @@ * */ -use OC\Connector\Sabre\ExceptionLoggerPlugin; +use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\Server; From 2ff55560e21874ce4d3c724db20a6ebd86e65221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 14 Oct 2015 14:39:25 +0200 Subject: [PATCH 2/5] Remove $ETagFunction - it was never used --- apps/dav/lib/connector/sabre/node.php | 6 ------ lib/private/files/storage/common.php | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/apps/dav/lib/connector/sabre/node.php b/apps/dav/lib/connector/sabre/node.php index 377536b530..814aaceb07 100644 --- a/apps/dav/lib/connector/sabre/node.php +++ b/apps/dav/lib/connector/sabre/node.php @@ -34,12 +34,6 @@ use OCA\DAV\Connector\Sabre\Exception\InvalidPath; abstract class Node implements \Sabre\DAV\INode { - /** - * Allow configuring the method used to generate Etags - * - * @var array(class_name, function_name) - */ - public static $ETagFunction = null; /** * @var \OC\Files\View diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index cdd8eefd0d..77a70226b3 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -372,13 +372,7 @@ abstract class Common implements Storage { * @return string|false */ public function getETag($path) { - $ETagFunction = \OCA\DAV\Connector\Sabre\Node::$ETagFunction; - if ($ETagFunction) { - $hash = call_user_func($ETagFunction, $path); - return $hash; - } else { - return uniqid(); - } + return uniqid(); } /** From 8fa59033acc04a6888d08c68fc3b707d1334d7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 14 Oct 2015 14:57:23 +0200 Subject: [PATCH 3/5] Fix uni tests --- apps/dav/tests/unit/connector/sabre/requesttest/auth.php | 2 +- .../tests/unit}/connector/sabre/requesttest/downloadtest.php | 4 ++-- .../connector/sabre/requesttest/encryptionuploadtest.php | 2 +- .../unit/connector/sabre/requesttest/exceptionplugin.php | 2 +- .../tests/unit/connector/sabre/requesttest/requesttest.php | 2 +- apps/dav/tests/unit/connector/sabre/requesttest/sapi.php | 2 +- .../dav/tests/unit/connector/sabre/requesttest/uploadtest.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/downloadtest.php (91%) rename {tests/lib => apps/dav/tests/unit}/connector/sabre/requesttest/encryptionuploadtest.php (92%) diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/auth.php b/apps/dav/tests/unit/connector/sabre/requesttest/auth.php index 7cab4da526..41b554d11d 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/auth.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/auth.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use Sabre\DAV\Auth\Backend\BackendInterface; diff --git a/tests/lib/connector/sabre/requesttest/downloadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php similarity index 91% rename from tests/lib/connector/sabre/requesttest/downloadtest.php rename to apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php index 67dd9f5230..245deff3b3 100644 --- a/tests/lib/connector/sabre/requesttest/downloadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/downloadtest.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OCP\AppFramework\Http; use OCP\Lock\ILockingProvider; @@ -24,7 +24,7 @@ class DownloadTest extends RequestTest { } /** - * @expectedException \OC\Connector\Sabre\Exception\FileLocked + * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked */ public function testDownloadWriteLocked() { $user = $this->getUniqueID(); diff --git a/tests/lib/connector/sabre/requesttest/encryptionuploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php similarity index 92% rename from tests/lib/connector/sabre/requesttest/encryptionuploadtest.php rename to apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php index f1849c9476..ed1d6046d7 100644 --- a/tests/lib/connector/sabre/requesttest/encryptionuploadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/encryptionuploadtest.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OC\Files\View; use Test\Traits\EncryptionTrait; diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php b/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php index 606b5a2798..53cd186bbc 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/exceptionplugin.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use Sabre\DAV\Exception; diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php b/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php index 4e1bc16819..d90cf6e19b 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/requesttest.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OCA\DAV\Connector\Sabre\Server; use OCA\DAV\Connector\Sabre\ServerFactory; diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/sapi.php b/apps/dav/tests/unit/connector/sabre/requesttest/sapi.php index cda9fdb70f..3af9401028 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/sapi.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/sapi.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use Sabre\HTTP\Request; use Sabre\HTTP\Response; diff --git a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php index 8f39aff81b..9a067f230a 100644 --- a/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php +++ b/apps/dav/tests/unit/connector/sabre/requesttest/uploadtest.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\Connector\Sabre\RequestTest; +namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest; use OC\AppFramework\Http; From ca27024fa22d9dde08da9aa77c2769b0f7b39707 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 15 Oct 2015 14:46:31 +0200 Subject: [PATCH 4/5] Fix webdav access * Correct namespace * Pass the EventDispatcher to the webDAV server --- apps/dav/appinfo/v1/webdav.php | 3 ++- apps/dav/lib/connector/sabre/listenerplugin.php | 4 ++-- apps/dav/lib/connector/sabre/lockplugin.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php index b416ef6479..610230fc81 100644 --- a/apps/dav/appinfo/v1/webdav.php +++ b/apps/dav/appinfo/v1/webdav.php @@ -39,7 +39,8 @@ $serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getDatabaseConnection(), \OC::$server->getUserSession(), \OC::$server->getMountManager(), - \OC::$server->getTagManager() + \OC::$server->getTagManager(), + \OC::$server->getEventDispatcher() ); // Backends diff --git a/apps/dav/lib/connector/sabre/listenerplugin.php b/apps/dav/lib/connector/sabre/listenerplugin.php index ec628add28..d537d0577c 100644 --- a/apps/dav/lib/connector/sabre/listenerplugin.php +++ b/apps/dav/lib/connector/sabre/listenerplugin.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCP\AppFramework\Http; use OCP\SabrePluginEvent; @@ -57,7 +57,7 @@ class ListenerPlugin extends ServerPlugin { public function emitListener() { $event = new SabrePluginEvent(); - $this->dispatcher->dispatch('OC\Connector\Sabre::beforeMethod', $event); + $this->dispatcher->dispatch('OCA\DAV\Connector\Sabre::beforeMethod', $event); if ($event->getStatusCode() !== Http::STATUS_OK) { throw new SabrePluginException($event->getMessage(), $event->getStatusCode()); diff --git a/apps/dav/lib/connector/sabre/lockplugin.php b/apps/dav/lib/connector/sabre/lockplugin.php index 47203df905..c564e066f8 100644 --- a/apps/dav/lib/connector/sabre/lockplugin.php +++ b/apps/dav/lib/connector/sabre/lockplugin.php @@ -19,7 +19,7 @@ * */ -namespace OC\Connector\Sabre; +namespace OCA\DAV\Connector\Sabre; use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCA\DAV\Connector\Sabre\Node; From ff5ed443308bc6ca0054710e623a651444840797 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 15 Oct 2015 15:33:06 +0200 Subject: [PATCH 5/5] Fix typo and adjust required version --- apps/dav/appinfo/info.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index 955b381ce2..c80af15a29 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -2,10 +2,10 @@ dav WebDAV - ownCloud WebDAV endppint + ownCloud WebDAV endpoint AGPL owncloud.org - 8.2 + 9.0 true