Merge pull request #18688 from owncloud/dav-app
Consolidate webdav code - move all to one app
This commit is contained in:
commit
c47c1df580
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
# ignore all apps except core ones
|
# ignore all apps except core ones
|
||||||
/apps*/*
|
/apps*/*
|
||||||
|
!/apps/dav
|
||||||
!/apps/files
|
!/apps/files
|
||||||
!/apps/files_encryption
|
!/apps/files_encryption
|
||||||
!/apps/encryption
|
!/apps/encryption
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<info>
|
||||||
|
<id>dav</id>
|
||||||
|
<name>WebDAV</name>
|
||||||
|
<description>ownCloud WebDAV endpoint</description>
|
||||||
|
<licence>AGPL</licence>
|
||||||
|
<author>owncloud.org</author>
|
||||||
|
<requiremin>9.0</requiremin>
|
||||||
|
<shipped>true</shipped>
|
||||||
|
<standalone/>
|
||||||
|
<default_enable/>
|
||||||
|
<types>
|
||||||
|
<filesystem/>
|
||||||
|
</types>
|
||||||
|
<remote>
|
||||||
|
<files>appinfo/v1/webdav.php</files>
|
||||||
|
<webdav>appinfo/v1/webdav.php</webdav>
|
||||||
|
</remote>
|
||||||
|
<public>
|
||||||
|
<webdav>appinfo/v1/publicwebdav.php</webdav>
|
||||||
|
</public>
|
||||||
|
</info>
|
|
@ -23,16 +23,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// load needed apps
|
// load needed apps
|
||||||
$RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging');
|
$RUNTIME_APPTYPES = ['filesystem', 'authentication', 'logging'];
|
||||||
|
|
||||||
OC_App::loadApps($RUNTIME_APPTYPES);
|
OC_App::loadApps($RUNTIME_APPTYPES);
|
||||||
|
|
||||||
OC_Util::obEnd();
|
OC_Util::obEnd();
|
||||||
|
|
||||||
// Backends
|
// 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->getConfig(),
|
||||||
\OC::$server->getLogger(),
|
\OC::$server->getLogger(),
|
||||||
\OC::$server->getDatabaseConnection(),
|
\OC::$server->getDatabaseConnection(),
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Bart Visscher <bartv@thisnet.nl>
|
||||||
|
* @author Frank Karlitschek <frank@owncloud.org>
|
||||||
|
* @author Jakob Sack <mail@jakobsack.de>
|
||||||
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
||||||
|
* @author Lukas Reschke <lukas@owncloud.com>
|
||||||
|
* @author Morris Jobke <hey@morrisjobke.de>
|
||||||
|
* @author Robin Appelman <icewind@owncloud.com>
|
||||||
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
||||||
|
* @author Vincent Petry <pvince81@owncloud.com>
|
||||||
|
*
|
||||||
|
* @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 <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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(),
|
||||||
|
\OC::$server->getEventDispatcher()
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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();
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\Files_Sharing\Connector;
|
namespace OCA\DAV\Connector;
|
||||||
|
|
||||||
class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
use Sabre\DAV\Exception\Forbidden;
|
use Sabre\DAV\Exception\Forbidden;
|
|
@ -27,7 +27,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Sabre\DAV\Auth\Backend\AbstractBasic;
|
use Sabre\DAV\Auth\Backend\AbstractBasic;
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use Sabre\HTTP\RequestInterface;
|
use Sabre\HTTP\RequestInterface;
|
||||||
|
@ -30,7 +30,7 @@ use Sabre\DAV\Exception;
|
||||||
* Class BlockLegacyClientPlugin is used to detect old legacy sync clients and
|
* Class BlockLegacyClientPlugin is used to detect old legacy sync clients and
|
||||||
* returns a 403 status to those clients
|
* returns a 403 status to those clients
|
||||||
*
|
*
|
||||||
* @package OC\Connector\Sabre
|
* @package OCA\DAV\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
class BlockLegacyClientPlugin extends ServerPlugin {
|
class BlockLegacyClientPlugin extends ServerPlugin {
|
||||||
/** @var \Sabre\DAV\Server */
|
/** @var \Sabre\DAV\Server */
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use \Sabre\HTTP\RequestInterface;
|
use \Sabre\HTTP\RequestInterface;
|
||||||
use \Sabre\HTTP\ResponseInterface;
|
use \Sabre\HTTP\ResponseInterface;
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
|
@ -26,15 +26,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\Exception\InvalidPath;
|
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||||
use OC\Connector\Sabre\Exception\FileLocked;
|
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
||||||
use OCP\Lock\ILockingProvider;
|
use OCP\Lock\ILockingProvider;
|
||||||
use OCP\Lock\LockedException;
|
use OCP\Lock\LockedException;
|
||||||
use Sabre\DAV\Exception\Locked;
|
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 {
|
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;
|
$path = $this->fileView->getAbsolutePath($this->path) . '/' . $name;
|
||||||
// using a dummy FileInfo is acceptable here since it will be refreshed after the put is complete
|
// 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);
|
$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);
|
$node->acquireLock(ILockingProvider::LOCK_SHARED);
|
||||||
return $node->put($data);
|
return $node->put($data);
|
||||||
} catch (\OCP\Files\StorageNotAvailableException $e) {
|
} catch (\OCP\Files\StorageNotAvailableException $e) {
|
||||||
|
@ -179,9 +179,9 @@ class Directory extends \OC\Connector\Sabre\Node
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($info['mimetype'] == 'httpd/unix-directory') {
|
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 {
|
} else {
|
||||||
$node = new \OC\Connector\Sabre\File($this->fileView, $info);
|
$node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
|
||||||
}
|
}
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
use Sabre\HTTP\ResponseInterface;
|
use Sabre\HTTP\ResponseInterface;
|
||||||
use Sabre\HTTP\RequestInterface;
|
use Sabre\HTTP\RequestInterface;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ use Sabre\HTTP\RequestInterface;
|
||||||
*
|
*
|
||||||
* FIXME: Remove once clients are all compliant.
|
* FIXME: Remove once clients are all compliant.
|
||||||
*
|
*
|
||||||
* @package OC\Connector\Sabre
|
* @package OCA\DAV\Connector\Sabre
|
||||||
*/
|
*/
|
||||||
class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin {
|
class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
/** @var \Sabre\DAV\Server */
|
/** @var \Sabre\DAV\Server */
|
|
@ -20,7 +20,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre\Exception;
|
namespace OCA\DAV\Connector\Sabre\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity Too Large
|
* Entity Too Large
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre\Exception;
|
namespace OCA\DAV\Connector\Sabre\Exception;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre\Exception;
|
namespace OCA\DAV\Connector\Sabre\Exception;
|
||||||
|
|
||||||
use Sabre\DAV\Exception;
|
use Sabre\DAV\Exception;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre\Exception;
|
namespace OCA\DAV\Connector\Sabre\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsupported Media Type
|
* Unsupported Media Type
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use Sabre\DAV\Exception;
|
use Sabre\DAV\Exception;
|
|
@ -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 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\Encryption\Exceptions\GenericEncryptionException;
|
||||||
use OCP\Files\EntityTooLargeException;
|
use OCP\Files\EntityTooLargeException;
|
||||||
use OCP\Files\InvalidContentException;
|
use OCP\Files\InvalidContentException;
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use Sabre\DAV\IFile;
|
use Sabre\DAV\IFile;
|
||||||
use \Sabre\DAV\PropFind;
|
use \Sabre\DAV\PropFind;
|
||||||
|
@ -161,7 +161,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
*/
|
*/
|
||||||
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
|
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) {
|
$propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) {
|
||||||
return $node->getFileId();
|
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) {
|
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) {
|
||||||
/** @var $node \OC\Connector\Sabre\File */
|
/** @var $node \OCA\DAV\Connector\Sabre\File */
|
||||||
$directDownloadUrl = $node->getDirectDownload();
|
$directDownloadUrl = $node->getDirectDownload();
|
||||||
if (isset($directDownloadUrl['url'])) {
|
if (isset($directDownloadUrl['url'])) {
|
||||||
return $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) {
|
$propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) {
|
||||||
return $node->getSize();
|
return $node->getSize();
|
||||||
});
|
});
|
||||||
|
@ -254,7 +254,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$node = $this->server->tree->getNodeForPath($filePath);
|
$node = $this->server->tree->getNodeForPath($filePath);
|
||||||
if ($node instanceof \OC\Connector\Sabre\Node) {
|
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
|
||||||
$fileId = $node->getFileId();
|
$fileId = $node->getFileId();
|
||||||
if (!is_null($fileId)) {
|
if (!is_null($fileId)) {
|
||||||
$this->server->httpResponse->setHeader('OC-FileId', $fileId);
|
$this->server->httpResponse->setHeader('OC-FileId', $fileId);
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
use OCP\SabrePluginEvent;
|
use OCP\SabrePluginEvent;
|
||||||
|
@ -57,7 +57,7 @@ class ListenerPlugin extends ServerPlugin {
|
||||||
public function emitListener() {
|
public function emitListener() {
|
||||||
$event = new SabrePluginEvent();
|
$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) {
|
if ($event->getStatusCode() !== Http::STATUS_OK) {
|
||||||
throw new SabrePluginException($event->getMessage(), $event->getStatusCode());
|
throw new SabrePluginException($event->getMessage(), $event->getStatusCode());
|
|
@ -19,18 +19,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\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\ILockingProvider;
|
||||||
use OCP\Lock\LockedException;
|
use OCP\Lock\LockedException;
|
||||||
use Sabre\DAV\Exception\NotFound;
|
use Sabre\DAV\Exception\NotFound;
|
||||||
use \Sabre\DAV\PropFind;
|
|
||||||
use \Sabre\DAV\PropPatch;
|
|
||||||
use Sabre\DAV\ServerPlugin;
|
use Sabre\DAV\ServerPlugin;
|
||||||
use Sabre\DAV\Tree;
|
use Sabre\DAV\Tree;
|
||||||
use Sabre\HTTP\RequestInterface;
|
use Sabre\HTTP\RequestInterface;
|
||||||
use Sabre\HTTP\ResponseInterface;
|
|
||||||
|
|
||||||
class LockPlugin extends ServerPlugin {
|
class LockPlugin extends ServerPlugin {
|
||||||
/**
|
/**
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use Sabre\DAV\Exception\ServiceUnavailable;
|
use Sabre\DAV\Exception\ServiceUnavailable;
|
|
@ -28,18 +28,12 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 {
|
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
|
* @var \OC\Files\View
|
|
@ -23,10 +23,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\Exception\InvalidPath;
|
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||||
use OC\Connector\Sabre\Exception\FileLocked;
|
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
||||||
use OC\Files\FileInfo;
|
use OC\Files\FileInfo;
|
||||||
use OC\Files\Mount\MoveableMount;
|
use OC\Files\Mount\MoveableMount;
|
||||||
use OCP\Files\StorageInvalidException;
|
use OCP\Files\StorageInvalidException;
|
||||||
|
@ -160,9 +160,9 @@ class ObjectTree extends \Sabre\DAV\Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($info->getType() === 'dir') {
|
if ($info->getType() === 'dir') {
|
||||||
$node = new \OC\Connector\Sabre\Directory($this->fileView, $info);
|
$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info);
|
||||||
} else {
|
} else {
|
||||||
$node = new \OC\Connector\Sabre\File($this->fileView, $info);
|
$node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache[$path] = $node;
|
$this->cache[$path] = $node;
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
|
@ -25,7 +25,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin check user quota and deny creating files when they exceeds the quota.
|
* This plugin check user quota and deny creating files when they exceeds the quota.
|
|
@ -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.
|
* This class overrides some methods from @see \Sabre\DAV\Server.
|
||||||
*
|
*
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use OCP\Files\Mount\IMountManager;
|
use OCP\Files\Mount\IMountManager;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
@ -59,22 +59,22 @@ class ServerFactory {
|
||||||
*/
|
*/
|
||||||
public function createServer($baseUri, $requestUri, BackendInterface $authBackend, callable $viewCallBack) {
|
public function createServer($baseUri, $requestUri, BackendInterface $authBackend, callable $viewCallBack) {
|
||||||
// Fire up server
|
// Fire up server
|
||||||
$objectTree = new \OC\Connector\Sabre\ObjectTree();
|
$objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
|
||||||
$server = new \OC\Connector\Sabre\Server($objectTree);
|
$server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
|
||||||
// Set URL explicitly due to reverse-proxy situations
|
// Set URL explicitly due to reverse-proxy situations
|
||||||
$server->httpRequest->setUrl($requestUri);
|
$server->httpRequest->setUrl($requestUri);
|
||||||
$server->setBaseUri($baseUri);
|
$server->setBaseUri($baseUri);
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
$defaults = new \OC_Defaults();
|
$defaults = new \OC_Defaults();
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\MaintenancePlugin($this->config));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\BlockLegacyClientPlugin($this->config));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
|
||||||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
|
$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 /
|
// 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 \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\LockPlugin($objectTree));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin($objectTree));
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\ListenerPlugin($this->dispatcher));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\ListenerPlugin($this->dispatcher));
|
||||||
|
|
||||||
// wait with registering these until auth is handled and the filesystem is setup
|
// wait with registering these until auth is handled and the filesystem is setup
|
||||||
$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
|
$server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) {
|
||||||
|
@ -84,21 +84,21 @@ class ServerFactory {
|
||||||
|
|
||||||
// Create ownCloud Dir
|
// Create ownCloud Dir
|
||||||
if ($rootInfo->getType() === 'dir') {
|
if ($rootInfo->getType() === 'dir') {
|
||||||
$root = new \OC\Connector\Sabre\Directory($view, $rootInfo);
|
$root = new \OCA\DAV\Connector\Sabre\Directory($view, $rootInfo);
|
||||||
} else {
|
} else {
|
||||||
$root = new \OC\Connector\Sabre\File($view, $rootInfo);
|
$root = new \OCA\DAV\Connector\Sabre\File($view, $rootInfo);
|
||||||
}
|
}
|
||||||
$objectTree->init($root, $view, $this->mountManager);
|
$objectTree->init($root, $view, $this->mountManager);
|
||||||
|
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\FilesPlugin($objectTree, $view));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\FilesPlugin($objectTree, $view));
|
||||||
$server->addPlugin(new \OC\Connector\Sabre\QuotaPlugin($view));
|
$server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view));
|
||||||
|
|
||||||
if($this->userSession->isLoggedIn()) {
|
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
|
// custom properties plugin must be the last one
|
||||||
$server->addPlugin(
|
$server->addPlugin(
|
||||||
new \Sabre\DAV\PropertyStorage\Plugin(
|
new \Sabre\DAV\PropertyStorage\Plugin(
|
||||||
new \OC\Connector\Sabre\CustomPropertiesBackend(
|
new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
|
||||||
$objectTree,
|
$objectTree,
|
||||||
$this->databaseConnection,
|
$this->databaseConnection,
|
||||||
$this->userSession->getUser()
|
$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
|
}, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request
|
||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
use Sabre\DAV;
|
use Sabre\DAV;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class TagList extends DAV\Property {
|
||||||
*
|
*
|
||||||
* @param \DOMElement $dom
|
* @param \DOMElement $dom
|
||||||
* @param array $propertyMap
|
* @param array $propertyMap
|
||||||
* @return \OC\Connector\Sabre\TagList
|
* @return \OCA\DAV\Connector\Sabre\TagList
|
||||||
*/
|
*/
|
||||||
static function unserialize(\DOMElement $dom, array $propertyMap) {
|
static function unserialize(\DOMElement $dom, array $propertyMap) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud
|
* ownCloud
|
||||||
|
@ -206,12 +206,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
|
||||||
PropFind $propFind,
|
PropFind $propFind,
|
||||||
\Sabre\DAV\INode $node
|
\Sabre\DAV\INode $node
|
||||||
) {
|
) {
|
||||||
if (!($node instanceof \OC\Connector\Sabre\Node)) {
|
if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// need prefetch ?
|
// need prefetch ?
|
||||||
if ($node instanceof \OC\Connector\Sabre\Directory
|
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory
|
||||||
&& $propFind->getDepth() !== 0
|
&& $propFind->getDepth() !== 0
|
||||||
&& (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME))
|
&& (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME))
|
||||||
|| !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME))
|
|| !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME))
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace Test\Connector\Sabre;
|
namespace Test\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\BlockLegacyClientPlugin;
|
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace Test\Connector\Sabre;
|
namespace Test\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\DummyGetResponsePlugin;
|
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace Test\Connector\Sabre;
|
namespace Test\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\MaintenancePlugin;
|
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
|
@ -11,14 +11,14 @@ namespace Tests\Connector\Sabre;
|
||||||
class CopyEtagPluginTest extends \Test\TestCase {
|
class CopyEtagPluginTest extends \Test\TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\CopyEtagHeaderPlugin
|
* @var \OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin
|
||||||
*/
|
*/
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->server = new \Sabre\DAV\Server();
|
$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);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CustomPropertiesBackend extends \Test\TestCase {
|
||||||
private $tree;
|
private $tree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\CustomPropertiesBackend
|
* @var \OCA\DAV\Connector\Sabre\CustomPropertiesBackend
|
||||||
*/
|
*/
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class CustomPropertiesBackend extends \Test\TestCase {
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue($userId));
|
->will($this->returnValue($userId));
|
||||||
|
|
||||||
$this->plugin = new \OC\Connector\Sabre\CustomPropertiesBackend(
|
$this->plugin = new \OCA\DAV\Connector\Sabre\CustomPropertiesBackend(
|
||||||
$this->tree,
|
$this->tree,
|
||||||
\OC::$server->getDatabaseConnection(),
|
\OC::$server->getDatabaseConnection(),
|
||||||
$this->user
|
$this->user
|
||||||
|
@ -143,7 +143,7 @@ class CustomPropertiesBackend extends \Test\TestCase {
|
||||||
* Test setting/getting properties
|
* Test setting/getting properties
|
||||||
*/
|
*/
|
||||||
public function testSetGetPropertiesForFile() {
|
public function testSetGetPropertiesForFile() {
|
||||||
$node = $this->createTestNode('\OC\Connector\Sabre\File');
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||||
$this->tree->expects($this->any())
|
$this->tree->expects($this->any())
|
||||||
->method('getNodeForPath')
|
->method('getNodeForPath')
|
||||||
->with('/dummypath')
|
->with('/dummypath')
|
||||||
|
@ -175,9 +175,9 @@ class CustomPropertiesBackend extends \Test\TestCase {
|
||||||
* Test getting properties from directory
|
* Test getting properties from directory
|
||||||
*/
|
*/
|
||||||
public function testGetPropertiesForDirectory() {
|
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()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$nodeSub->expects($this->any())
|
$nodeSub->expects($this->any())
|
||||||
|
@ -259,7 +259,7 @@ class CustomPropertiesBackend extends \Test\TestCase {
|
||||||
* Test delete property
|
* Test delete property
|
||||||
*/
|
*/
|
||||||
public function testDeleteProperty() {
|
public function testDeleteProperty() {
|
||||||
$node = $this->createTestNode('\OC\Connector\Sabre\File');
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||||
$this->tree->expects($this->any())
|
$this->tree->expects($this->any())
|
||||||
->method('getNodeForPath')
|
->method('getNodeForPath')
|
||||||
->with('/dummypath')
|
->with('/dummypath')
|
|
@ -29,7 +29,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
|
||||||
->method('getPath')
|
->method('getPath')
|
||||||
->will($this->returnValue($path));
|
->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')
|
->method('getRelativePath')
|
||||||
->will($this->returnValue(''));
|
->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();
|
$nodes = $dir->getChildren();
|
||||||
|
|
||||||
$this->assertEquals(2, count($nodes));
|
$this->assertEquals(2, count($nodes));
|
||||||
|
@ -142,12 +142,12 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
|
||||||
->method('getFileInfo')
|
->method('getFileInfo')
|
||||||
->willThrowException(new \OCP\Files\StorageNotAvailableException());
|
->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('.');
|
$dir->getChild('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath
|
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
|
||||||
*/
|
*/
|
||||||
public function testGetChildThrowInvalidPath() {
|
public function testGetChildThrowInvalidPath() {
|
||||||
$this->view->expects($this->once())
|
$this->view->expects($this->once())
|
||||||
|
@ -156,7 +156,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
|
||||||
$this->view->expects($this->never())
|
$this->view->expects($this->never())
|
||||||
->method('getFileInfo');
|
->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('.');
|
$dir->getChild('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
|
||||||
->method('getStorage')
|
->method('getStorage')
|
||||||
->will($this->returnValue($storage));
|
->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
|
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\Exception;
|
namespace Test\Connector\Sabre\Exception;
|
||||||
|
|
||||||
use OC\Connector\Sabre\Exception\InvalidPath;
|
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Thomas Müller <deepdiver@owncloud.com>
|
* Copyright (c) 2015 Thomas Müller <deepdiver@owncloud.com>
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
namespace Test\Connector\Sabre;
|
namespace Test\Connector\Sabre;
|
||||||
|
|
||||||
use OC\Connector\Sabre\Exception\InvalidPath;
|
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||||
use OC\Connector\Sabre\ExceptionLoggerPlugin as PluginToTest;
|
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin as PluginToTest;
|
||||||
use OC\Log;
|
use OC\Log;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use PHPUnit_Framework_MockObject_MockObject;
|
use PHPUnit_Framework_MockObject_MockObject;
|
|
@ -61,11 +61,11 @@ class File extends \Test\TestCase {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Files\EntityTooLargeException(),
|
new \OCP\Files\EntityTooLargeException(),
|
||||||
'OC\Connector\Sabre\Exception\EntityTooLarge'
|
'OCA\DAV\Connector\Sabre\Exception\EntityTooLarge'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Files\InvalidContentException(),
|
new \OCP\Files\InvalidContentException(),
|
||||||
'OC\Connector\Sabre\Exception\UnsupportedMediaType'
|
'OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Files\InvalidPathException(),
|
new \OCP\Files\InvalidPathException(),
|
||||||
|
@ -73,11 +73,11 @@ class File extends \Test\TestCase {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Files\LockNotAcquiredException('/test.txt', 1),
|
new \OCP\Files\LockNotAcquiredException('/test.txt', 1),
|
||||||
'OC\Connector\Sabre\Exception\FileLocked'
|
'OCA\DAV\Connector\Sabre\Exception\FileLocked'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Lock\LockedException('/test.txt'),
|
new \OCP\Lock\LockedException('/test.txt'),
|
||||||
'OC\Connector\Sabre\Exception\FileLocked'
|
'OCA\DAV\Connector\Sabre\Exception\FileLocked'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
new \OCP\Encryption\Exceptions\GenericEncryptionException(),
|
new \OCP\Encryption\Exceptions\GenericEncryptionException(),
|
||||||
|
@ -137,7 +137,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$caughtException = null;
|
$caughtException = null;
|
||||||
|
@ -196,7 +196,7 @@ class File extends \Test\TestCase {
|
||||||
$info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-0', null, null, [
|
$info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-0', null, null, [
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
], null);
|
], null);
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// put first chunk
|
// put first chunk
|
||||||
$this->assertNull($file->put('test data one'));
|
$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, [
|
$info = new \OC\Files\FileInfo('/test.txt-chunking-12345-2-1', null, null, [
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
], null);
|
], null);
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$caughtException = null;
|
$caughtException = null;
|
||||||
|
@ -249,7 +249,7 @@ class File extends \Test\TestCase {
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// beforeMethod locks
|
// beforeMethod locks
|
||||||
$view->lockFile($path, ILockingProvider::LOCK_SHARED);
|
$view->lockFile($path, ILockingProvider::LOCK_SHARED);
|
||||||
|
@ -436,7 +436,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$thrown = false;
|
$thrown = false;
|
||||||
|
@ -469,7 +469,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$thrown = false;
|
$thrown = false;
|
||||||
|
@ -481,7 +481,7 @@ class File extends \Test\TestCase {
|
||||||
|
|
||||||
// afterMethod unlocks
|
// afterMethod unlocks
|
||||||
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
|
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
|
||||||
} catch (\OC\Connector\Sabre\Exception\FileLocked $e) {
|
} catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) {
|
||||||
$thrown = true;
|
$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, [
|
$info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-0', null, null, [
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
], null);
|
], 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'));
|
$this->assertNull($file->put('test data one'));
|
||||||
|
|
||||||
$info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', null, null, [
|
$info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt-chunking-12345-2-1', null, null, [
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
], null);
|
], null);
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$thrown = false;
|
$thrown = false;
|
||||||
try {
|
try {
|
||||||
$file->put($this->getStream('test data'));
|
$file->put($this->getStream('test data'));
|
||||||
} catch (\OC\Connector\Sabre\Exception\FileLocked $e) {
|
} catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) {
|
||||||
$thrown = true;
|
$thrown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ class File extends \Test\TestCase {
|
||||||
$info = new \OC\Files\FileInfo('/*', null, null, array(
|
$info = new \OC\Files\FileInfo('/*', null, null, array(
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$thrown = false;
|
$thrown = false;
|
||||||
|
@ -548,7 +548,7 @@ class File extends \Test\TestCase {
|
||||||
|
|
||||||
// afterMethod unlocks
|
// afterMethod unlocks
|
||||||
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
|
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
|
||||||
} catch (\OC\Connector\Sabre\Exception\InvalidPath $e) {
|
} catch (\OCA\DAV\Connector\Sabre\Exception\InvalidPath $e) {
|
||||||
$thrown = true;
|
$thrown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ class File extends \Test\TestCase {
|
||||||
/**
|
/**
|
||||||
* Test setting name with setName() with invalid chars
|
* Test setting name with setName() with invalid chars
|
||||||
*
|
*
|
||||||
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath
|
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
|
||||||
*/
|
*/
|
||||||
public function testSetNameInvalidChars() {
|
public function testSetNameInvalidChars() {
|
||||||
// setup
|
// setup
|
||||||
|
@ -572,7 +572,7 @@ class File extends \Test\TestCase {
|
||||||
$info = new \OC\Files\FileInfo('/*', null, null, array(
|
$info = new \OC\Files\FileInfo('/*', null, null, array(
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
$file->setName('/super*star.txt');
|
$file->setName('/super*star.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$thrown = false;
|
$thrown = false;
|
||||||
|
@ -636,7 +636,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$file->delete();
|
$file->delete();
|
||||||
|
@ -654,7 +654,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => 0
|
'permissions' => 0
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$file->delete();
|
$file->delete();
|
||||||
|
@ -677,7 +677,7 @@ class File extends \Test\TestCase {
|
||||||
'permissions' => \OCP\Constants::PERMISSION_ALL
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
), null);
|
), null);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
// action
|
// action
|
||||||
$file->delete();
|
$file->delete();
|
||||||
|
@ -714,7 +714,7 @@ class File extends \Test\TestCase {
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \OC\Connector\Sabre\File($view, $info);
|
$file = new \OCA\DAV\Connector\Sabre\File($view, $info);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
|
$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
|
|
@ -9,12 +9,12 @@ namespace Tests\Connector\Sabre;
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
class FilesPlugin extends \Test\TestCase {
|
class FilesPlugin extends \Test\TestCase {
|
||||||
const GETETAG_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::GETETAG_PROPERTYNAME;
|
const GETETAG_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::GETETAG_PROPERTYNAME;
|
||||||
const FILEID_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::FILEID_PROPERTYNAME;
|
const FILEID_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::FILEID_PROPERTYNAME;
|
||||||
const SIZE_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::SIZE_PROPERTYNAME;
|
const SIZE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::SIZE_PROPERTYNAME;
|
||||||
const PERMISSIONS_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::PERMISSIONS_PROPERTYNAME;
|
const PERMISSIONS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::PERMISSIONS_PROPERTYNAME;
|
||||||
const LASTMODIFIED_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::LASTMODIFIED_PROPERTYNAME;
|
const LASTMODIFIED_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::LASTMODIFIED_PROPERTYNAME;
|
||||||
const DOWNLOADURL_PROPERTYNAME = \OC\Connector\Sabre\FilesPlugin::DOWNLOADURL_PROPERTYNAME;
|
const DOWNLOADURL_PROPERTYNAME = \OCA\DAV\Connector\Sabre\FilesPlugin::DOWNLOADURL_PROPERTYNAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Sabre\DAV\Server
|
* @var \Sabre\DAV\Server
|
||||||
|
@ -22,12 +22,12 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Sabre\DAV\ObjectTree
|
* @var \Sabre\DAV\Tree
|
||||||
*/
|
*/
|
||||||
private $tree;
|
private $tree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\FilesPlugin
|
* @var \OCA\DAV\Connector\Sabre\FilesPlugin
|
||||||
*/
|
*/
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->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);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public function testGetPropertiesForFile() {
|
public function testGetPropertiesForFile() {
|
||||||
$node = $this->createTestNode('\OC\Connector\Sabre\File');
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||||
|
|
||||||
$propFind = new \Sabre\DAV\PropFind(
|
$propFind = new \Sabre\DAV\PropFind(
|
||||||
'/dummyPath',
|
'/dummyPath',
|
||||||
|
@ -115,7 +115,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPublicPermissions() {
|
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);
|
$this->plugin->initialize($this->server);
|
||||||
|
|
||||||
$propFind = new \Sabre\DAV\PropFind(
|
$propFind = new \Sabre\DAV\PropFind(
|
||||||
|
@ -126,7 +126,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
$node = $this->createTestNode('\OC\Connector\Sabre\File');
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
->method('getDavPermissions')
|
->method('getDavPermissions')
|
||||||
->will($this->returnValue('DWCKMSR'));
|
->will($this->returnValue('DWCKMSR'));
|
||||||
|
@ -140,7 +140,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPropertiesForDirectory() {
|
public function testGetPropertiesForDirectory() {
|
||||||
$node = $this->createTestNode('\OC\Connector\Sabre\Directory');
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
|
||||||
|
|
||||||
$propFind = new \Sabre\DAV\PropFind(
|
$propFind = new \Sabre\DAV\PropFind(
|
||||||
'/dummyPath',
|
'/dummyPath',
|
||||||
|
@ -174,7 +174,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateProps() {
|
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';
|
$testDate = 'Fri, 13 Feb 2015 00:01:02 GMT';
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Node extends \Test\TestCase {
|
||||||
->will($this->returnValue($type));
|
->will($this->returnValue($type));
|
||||||
$view = $this->getMock('\OC\Files\View');
|
$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());
|
$this->assertEquals($expected, $node->getDavPermissions());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,11 +6,11 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\OC\Connector\Sabre;
|
namespace Test\OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
|
|
||||||
use OC\Files\FileInfo;
|
use OC\Files\FileInfo;
|
||||||
use OC\Connector\Sabre\Directory;
|
use OCA\DAV\Connector\Sabre\Directory;
|
||||||
use OC\Files\Storage\Temporary;
|
use OC\Files\Storage\Temporary;
|
||||||
|
|
||||||
class TestDoubleFileView extends \OC\Files\View {
|
class TestDoubleFileView extends \OC\Files\View {
|
||||||
|
@ -62,7 +62,7 @@ class ObjectTree extends \Test\TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider moveFailedInvalidCharsProvider
|
* @dataProvider moveFailedInvalidCharsProvider
|
||||||
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath
|
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
|
||||||
*/
|
*/
|
||||||
public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) {
|
public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) {
|
||||||
$this->moveTest($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);
|
$info = new FileInfo('', null, null, array(), null);
|
||||||
|
|
||||||
$rootDir = new Directory($view, $info);
|
$rootDir = new Directory($view, $info);
|
||||||
$objectTree = $this->getMock('\OC\Connector\Sabre\ObjectTree',
|
$objectTree = $this->getMock('\OCA\DAV\Connector\Sabre\ObjectTree',
|
||||||
array('nodeExists', 'getNodeForPath'),
|
array('nodeExists', 'getNodeForPath'),
|
||||||
array($rootDir, $view));
|
array($rootDir, $view));
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class ObjectTree extends \Test\TestCase {
|
||||||
->with($this->identicalTo($source))
|
->with($this->identicalTo($source))
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
/** @var $objectTree \OC\Connector\Sabre\ObjectTree */
|
/** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */
|
||||||
$mountManager = \OC\Files\Filesystem::getMountManager();
|
$mountManager = \OC\Files\Filesystem::getMountManager();
|
||||||
$objectTree->init($rootDir, $view, $mountManager);
|
$objectTree->init($rootDir, $view, $mountManager);
|
||||||
$objectTree->move($source, $destination);
|
$objectTree->move($source, $destination);
|
||||||
|
@ -134,7 +134,7 @@ class ObjectTree extends \Test\TestCase {
|
||||||
$_SERVER['HTTP_OC_CHUNKED'] = true;
|
$_SERVER['HTTP_OC_CHUNKED'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory')
|
$rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$mountManager = $this->getMock('\OC\Files\Mount\Manager');
|
$mountManager = $this->getMock('\OC\Files\Mount\Manager');
|
||||||
|
@ -152,7 +152,7 @@ class ObjectTree extends \Test\TestCase {
|
||||||
->with($fileInfoQueryPath)
|
->with($fileInfoQueryPath)
|
||||||
->will($this->returnValue($fileInfo));
|
->will($this->returnValue($fileInfo));
|
||||||
|
|
||||||
$tree = new \OC\Connector\Sabre\ObjectTree();
|
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
|
||||||
$tree->init($rootNode, $view, $mountManager);
|
$tree->init($rootNode, $view, $mountManager);
|
||||||
|
|
||||||
$node = $tree->getNodeForPath($inputFileName);
|
$node = $tree->getNodeForPath($inputFileName);
|
||||||
|
@ -161,9 +161,9 @@ class ObjectTree extends \Test\TestCase {
|
||||||
$this->assertEquals($outputFileName, $node->getName());
|
$this->assertEquals($outputFileName, $node->getName());
|
||||||
|
|
||||||
if ($type === 'file') {
|
if ($type === 'file') {
|
||||||
$this->assertTrue($node instanceof \OC\Connector\Sabre\File);
|
$this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\File);
|
||||||
} else {
|
} else {
|
||||||
$this->assertTrue($node instanceof \OC\Connector\Sabre\Directory);
|
$this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\Directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_SERVER['HTTP_OC_CHUNKED']);
|
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() {
|
public function testGetNodeForPathInvalidPath() {
|
||||||
$path = '/foo\bar';
|
$path = '/foo\bar';
|
||||||
|
@ -254,12 +254,12 @@ class ObjectTree extends \Test\TestCase {
|
||||||
return [$storage, ltrim($path, '/')];
|
return [$storage, ltrim($path, '/')];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory')
|
$rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$mountManager = $this->getMock('\OC\Files\Mount\Manager');
|
$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->init($rootNode, $view, $mountManager);
|
||||||
|
|
||||||
$tree->getNodeForPath($path);
|
$tree->getNodeForPath($path);
|
||||||
|
@ -278,12 +278,12 @@ class ObjectTree extends \Test\TestCase {
|
||||||
return [$storage, ltrim($path, '/')];
|
return [$storage, ltrim($path, '/')];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory')
|
$rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$mountManager = $this->getMock('\OC\Files\Mount\Manager');
|
$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->init($rootNode, $view, $mountManager);
|
||||||
|
|
||||||
$this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path));
|
$this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path));
|
|
@ -19,7 +19,7 @@ class Principal extends \Test\TestCase {
|
||||||
private $userManager;
|
private $userManager;
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
private $config;
|
private $config;
|
||||||
/** @var \OC\Connector\Sabre\Principal */
|
/** @var \OCA\DAV\Connector\Sabre\Principal */
|
||||||
private $connector;
|
private $connector;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
|
@ -28,7 +28,7 @@ class Principal extends \Test\TestCase {
|
||||||
$this->config = $this->getMockBuilder('\OCP\IConfig')
|
$this->config = $this->getMockBuilder('\OCP\IConfig')
|
||||||
->disableOriginalConstructor()->getMock();
|
->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();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends \Test\TestCase {
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\QuotaPlugin
|
* @var \OCA\DAV\Connector\Sabre\QuotaPlugin
|
||||||
*/
|
*/
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
private function init($quota) {
|
private function init($quota) {
|
||||||
$view = $this->buildFileViewMock($quota);
|
$view = $this->buildFileViewMock($quota);
|
||||||
$this->server = new \Sabre\DAV\Server();
|
$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);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use Sabre\DAV\Auth\Backend\BackendInterface;
|
use Sabre\DAV\Auth\Backend\BackendInterface;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
use OCP\Lock\ILockingProvider;
|
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() {
|
public function testDownloadWriteLocked() {
|
||||||
$user = $this->getUniqueID();
|
$user = $this->getUniqueID();
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use OC\Files\View;
|
use OC\Files\View;
|
||||||
use Test\Traits\EncryptionTrait;
|
use Test\Traits\EncryptionTrait;
|
|
@ -6,11 +6,11 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use Sabre\DAV\Exception;
|
use Sabre\DAV\Exception;
|
||||||
|
|
||||||
class ExceptionPlugin extends \OC\Connector\Sabre\ExceptionLoggerPlugin {
|
class ExceptionPlugin extends \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin {
|
||||||
/**
|
/**
|
||||||
* @var \Exception[]
|
* @var \Exception[]
|
||||||
*/
|
*/
|
|
@ -6,10 +6,10 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use OC\Connector\Sabre\Server;
|
use OCA\DAV\Connector\Sabre\Server;
|
||||||
use OC\Connector\Sabre\ServerFactory;
|
use OCA\DAV\Connector\Sabre\ServerFactory;
|
||||||
use OC\Files\Mount\MountPoint;
|
use OC\Files\Mount\MountPoint;
|
||||||
use OC\Files\Storage\StorageFactory;
|
use OC\Files\Storage\StorageFactory;
|
||||||
use OC\Files\Storage\Temporary;
|
use OC\Files\Storage\Temporary;
|
||||||
|
@ -25,7 +25,7 @@ abstract class RequestTest extends TestCase {
|
||||||
use MountProviderTrait;
|
use MountProviderTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\ServerFactory
|
* @var \OCA\DAV\Connector\Sabre\ServerFactory
|
||||||
*/
|
*/
|
||||||
protected $serverFactory;
|
protected $serverFactory;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* 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\Request;
|
||||||
use Sabre\HTTP\Response;
|
use Sabre\HTTP\Response;
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test\Connector\Sabre\RequestTest;
|
namespace OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest;
|
||||||
|
|
||||||
use OC\AppFramework\Http;
|
use OC\AppFramework\Http;
|
||||||
|
|
|
@ -10,9 +10,9 @@ namespace Tests\Connector\Sabre;
|
||||||
*/
|
*/
|
||||||
class TagsPlugin extends \Test\TestCase {
|
class TagsPlugin extends \Test\TestCase {
|
||||||
|
|
||||||
const TAGS_PROPERTYNAME = \OC\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME;
|
const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME;
|
||||||
const FAVORITE_PROPERTYNAME = \OC\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME;
|
const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME;
|
||||||
const TAG_FAVORITE = \OC\Connector\Sabre\TagsPlugin::TAG_FAVORITE;
|
const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Sabre\DAV\Server
|
* @var \Sabre\DAV\Server
|
||||||
|
@ -35,7 +35,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
private $tagger;
|
private $tagger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Connector\Sabre\TagsPlugin
|
* @var \OCA\DAV\Connector\Sabre\TagsPlugin
|
||||||
*/
|
*/
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
->method('load')
|
->method('load')
|
||||||
->with('files')
|
->with('files')
|
||||||
->will($this->returnValue($this->tagger));
|
->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);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
* @dataProvider tagsGetPropertiesDataProvider
|
* @dataProvider tagsGetPropertiesDataProvider
|
||||||
*/
|
*/
|
||||||
public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
|
public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
|
||||||
$node = $this->getMockBuilder('\OC\Connector\Sabre\Node')
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
@ -98,13 +98,13 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
* @dataProvider tagsGetPropertiesDataProvider
|
* @dataProvider tagsGetPropertiesDataProvider
|
||||||
*/
|
*/
|
||||||
public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) {
|
public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) {
|
||||||
$node1 = $this->getMockBuilder('\OC\Connector\Sabre\File')
|
$node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node1->expects($this->any())
|
$node1->expects($this->any())
|
||||||
->method('getId')
|
->method('getId')
|
||||||
->will($this->returnValue(111));
|
->will($this->returnValue(111));
|
||||||
$node2 = $this->getMockBuilder('\OC\Connector\Sabre\File')
|
$node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node2->expects($this->any())
|
$node2->expects($this->any())
|
||||||
|
@ -119,7 +119,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
$expectedCallCount = 1;
|
$expectedCallCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = $this->getMockBuilder('\OC\Connector\Sabre\Directory')
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
@ -184,7 +184,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME),
|
array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME),
|
||||||
array(
|
array(
|
||||||
200 => 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,
|
self::FAVORITE_PROPERTYNAME => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -195,7 +195,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
array(self::TAGS_PROPERTYNAME),
|
array(self::TAGS_PROPERTYNAME),
|
||||||
array(
|
array(
|
||||||
200 => 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(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME),
|
||||||
array(
|
array(
|
||||||
200 => 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,
|
self::FAVORITE_PROPERTYNAME => false,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -234,7 +234,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
public function testUpdateTags() {
|
public function testUpdateTags() {
|
||||||
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
||||||
// and keep "tagkeep"
|
// and keep "tagkeep"
|
||||||
$node = $this->getMockBuilder('\OC\Connector\Sabre\Node')
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
@ -266,7 +266,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
|
|
||||||
// properties to set
|
// properties to set
|
||||||
$propPatch = new \Sabre\DAV\PropPatch(array(
|
$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(
|
$this->plugin->handleUpdateProperties(
|
||||||
|
@ -285,7 +285,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateTagsFromScratch() {
|
public function testUpdateTagsFromScratch() {
|
||||||
$node = $this->getMockBuilder('\OC\Connector\Sabre\Node')
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
|
@ -312,7 +312,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
|
|
||||||
// properties to set
|
// properties to set
|
||||||
$propPatch = new \Sabre\DAV\PropPatch(array(
|
$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(
|
$this->plugin->handleUpdateProperties(
|
||||||
|
@ -333,7 +333,7 @@ class TagsPlugin extends \Test\TestCase {
|
||||||
public function testUpdateFav() {
|
public function testUpdateFav() {
|
||||||
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
||||||
// and keep "tagkeep"
|
// and keep "tagkeep"
|
||||||
$node = $this->getMockBuilder('\OC\Connector\Sabre\Node')
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
|
@ -12,10 +12,6 @@
|
||||||
<types>
|
<types>
|
||||||
<filesystem/>
|
<filesystem/>
|
||||||
</types>
|
</types>
|
||||||
<remote>
|
|
||||||
<files>appinfo/remote.php</files>
|
|
||||||
<webdav>appinfo/remote.php</webdav>
|
|
||||||
</remote>
|
|
||||||
<documentation>
|
<documentation>
|
||||||
<user>user-files</user>
|
<user>user-files</user>
|
||||||
</documentation>
|
</documentation>
|
||||||
|
|
|
@ -32,7 +32,7 @@ set_time_limit(0);
|
||||||
// Turn off output buffering to prevent memory problems
|
// Turn off output buffering to prevent memory problems
|
||||||
\OC_Util::obEnd();
|
\OC_Util::obEnd();
|
||||||
|
|
||||||
$serverFactory = new \OC\Connector\Sabre\ServerFactory(
|
$serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory(
|
||||||
\OC::$server->getConfig(),
|
\OC::$server->getConfig(),
|
||||||
\OC::$server->getLogger(),
|
\OC::$server->getLogger(),
|
||||||
\OC::$server->getDatabaseConnection(),
|
\OC::$server->getDatabaseConnection(),
|
||||||
|
@ -43,7 +43,7 @@ $serverFactory = new \OC\Connector\Sabre\ServerFactory(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Backends
|
// Backends
|
||||||
$authBackend = new \OC\Connector\Sabre\Auth();
|
$authBackend = new \OCA\DAV\Connector\Sabre\Auth();
|
||||||
$requestUri = \OC::$server->getRequest()->getRequestUri();
|
$requestUri = \OC::$server->getRequest()->getRequestUri();
|
||||||
|
|
||||||
$server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() {
|
$server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() {
|
||||||
|
|
|
@ -17,6 +17,5 @@ Turning the feature off removes shared files and folders on the server for all s
|
||||||
</types>
|
</types>
|
||||||
<public>
|
<public>
|
||||||
<files>public.php</files>
|
<files>public.php</files>
|
||||||
<webdav>publicwebdav.php</webdav>
|
|
||||||
</public>
|
</public>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"activity",
|
"activity",
|
||||||
"admin_audit",
|
"admin_audit",
|
||||||
"encryption",
|
"encryption",
|
||||||
|
"dav",
|
||||||
"enterprise_key",
|
"enterprise_key",
|
||||||
"external",
|
"external",
|
||||||
"files",
|
"files",
|
||||||
|
|
|
@ -372,13 +372,7 @@ abstract class Common implements Storage {
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function getETag($path) {
|
public function getETag($path) {
|
||||||
$ETagFunction = \OC\Connector\Sabre\Node::$ETagFunction;
|
return uniqid();
|
||||||
if ($ETagFunction) {
|
|
||||||
$hash = call_user_func($ETagFunction, $path);
|
|
||||||
return $hash;
|
|
||||||
} else {
|
|
||||||
return uniqid();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use OC\Connector\Sabre\ExceptionLoggerPlugin;
|
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
|
||||||
use Sabre\DAV\Exception\ServiceUnavailable;
|
use Sabre\DAV\Exception\ServiceUnavailable;
|
||||||
use Sabre\DAV\Server;
|
use Sabre\DAV\Server;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue