parent
ade6ed3797
commit
76e04027bc
|
@ -46,6 +46,7 @@
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
2
3rdparty
2
3rdparty
|
@ -1 +1 @@
|
||||||
Subproject commit 554277edd6155ca3f5b21e32fe16b818d7fb827e
|
Subproject commit 255f5e45c927c7d4af39c9e8aa0b1506689aadd9
|
|
@ -36,9 +36,9 @@ $server->setBaseUri($baseuri);
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
$defaults = new OC_Defaults();
|
$defaults = new OC_Defaults();
|
||||||
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName()));
|
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
|
||||||
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
|
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
|
||||||
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false));
|
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
|
||||||
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
|
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
|
||||||
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
||||||
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
|
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
|
||||||
|
|
|
@ -238,14 +238,14 @@ class Test_Encryption_Webdav extends \PHPUnit_Framework_TestCase {
|
||||||
$objectTree->init($publicDir, $view);
|
$objectTree->init($publicDir, $view);
|
||||||
|
|
||||||
// Fire up server
|
// Fire up server
|
||||||
$server = new Sabre_DAV_Server($publicDir);
|
$server = new \Sabre\DAV\Server($publicDir);
|
||||||
$server->httpRequest = $requestBackend;
|
$server->httpRequest = $requestBackend;
|
||||||
$server->setBaseUri('/remote.php/webdav/');
|
$server->setBaseUri('/remote.php/webdav/');
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, 'ownCloud'));
|
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud'));
|
||||||
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
|
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
|
||||||
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
|
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
|
||||||
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
|
$server->addPlugin(new OC_Connector_Sabre_QuotaPlugin($view));
|
||||||
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
||||||
$server->debugExceptions = true;
|
$server->debugExceptions = true;
|
||||||
|
|
|
@ -17,7 +17,7 @@ class DAV extends \OC\Files\Storage\Common {
|
||||||
private $certPath;
|
private $certPath;
|
||||||
private $ready;
|
private $ready;
|
||||||
/**
|
/**
|
||||||
* @var \Sabre_DAV_Client
|
* @var \Sabre\DAV\Client
|
||||||
*/
|
*/
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class DAV extends \OC\Files\Storage\Common {
|
||||||
'password' => $this->password,
|
'password' => $this->password,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->client = new \Sabre_DAV_Client($settings);
|
$this->client = new \Sabre\DAV\Client($settings);
|
||||||
|
|
||||||
if ($this->secure === true && $this->certPath) {
|
if ($this->secure === true && $this->certPath) {
|
||||||
$this->client->addTrustedCertificates($this->certPath);
|
$this->client->addTrustedCertificates($this->certPath);
|
||||||
|
@ -252,7 +252,7 @@ class DAV extends \OC\Files\Storage\Common {
|
||||||
if ($this->file_exists($path)) {
|
if ($this->file_exists($path)) {
|
||||||
try {
|
try {
|
||||||
$this->client->proppatch($this->encodePath($path), array('{DAV:}lastmodified' => $mtime));
|
$this->client->proppatch($this->encodePath($path), array('{DAV:}lastmodified' => $mtime));
|
||||||
} catch (\Sabre_DAV_Exception_NotImplemented $e) {
|
} catch (\Sabre\DAV\Exception\NotImplemented $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -337,6 +337,7 @@ class Api {
|
||||||
return self::updatePublicUpload($share, $params);
|
return self::updatePublicUpload($share, $params);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
return new \OC_OCS_Result(null, 400, $e->getMessage());
|
return new \OC_OCS_Result(null, 400, $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace OCA\Files_Sharing\Connector;
|
namespace OCA\Files_Sharing\Connector;
|
||||||
|
|
||||||
class PublicAuth extends \Sabre_DAV_Auth_Backend_AbstractBasic {
|
class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OCP\IConfig
|
* @var \OCP\IConfig
|
||||||
|
|
|
@ -26,9 +26,9 @@ $server->setBaseUri($baseuri);
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
$defaults = new OC_Defaults();
|
$defaults = new OC_Defaults();
|
||||||
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName()));
|
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
|
||||||
$server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend));
|
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
|
||||||
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
|
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
|
||||||
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
|
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
|
||||||
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
|
||||||
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
|
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* ownCloud
|
|
||||||
*
|
|
||||||
* @author Thomas Müller
|
|
||||||
* @copyright 2013 Thomas Müller <thomas.mueller@tmit.eu>
|
|
||||||
*
|
|
||||||
* @license AGPL3
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Sabre_DAV_Exception_ServiceUnavailable extends Sabre_DAV_Exception {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the HTTP statuscode for this exception
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getHTTPCode() {
|
|
||||||
|
|
||||||
return 503;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,12 +12,12 @@
|
||||||
* This plugin will verify if the uploaded data has been stored completely.
|
* This plugin will verify if the uploaded data has been stored completely.
|
||||||
* This is done by comparing the content length of the request with the file size on storage.
|
* This is done by comparing the content length of the request with the file size on storage.
|
||||||
*/
|
*/
|
||||||
class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPlugin {
|
class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to main server object
|
* Reference to main server object
|
||||||
*
|
*
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
|
||||||
/**
|
/**
|
||||||
* This initializes the plugin.
|
* This initializes the plugin.
|
||||||
*
|
*
|
||||||
* This function is called by Sabre_DAV_Server, after
|
* This function is called by \Sabre\DAV\Server, after
|
||||||
* addPlugin is called.
|
* addPlugin is called.
|
||||||
*
|
*
|
||||||
* This method should set up the requires event subscriptions.
|
* This method should set up the requires event subscriptions.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
*/
|
*/
|
||||||
public function initialize(Sabre_DAV_Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
|
|
||||||
|
@ -53,10 +53,10 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filePath
|
* @param string $filePath
|
||||||
* @param Sabre_DAV_INode $node
|
* @param \Sabre\DAV\INode $node
|
||||||
* @throws Sabre_DAV_Exception_BadRequest
|
* @throws \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function verifyContentLength($filePath, Sabre_DAV_INode $node = null) {
|
public function verifyContentLength($filePath, \Sabre\DAV\INode $node = null) {
|
||||||
|
|
||||||
// we should only react on PUT which is used for upload
|
// we should only react on PUT which is used for upload
|
||||||
// e.g. with LOCK this will not work, but LOCK uses createFile() as well
|
// e.g. with LOCK this will not work, but LOCK uses createFile() as well
|
||||||
|
@ -78,7 +78,7 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
|
||||||
$actual = $this->fileView->filesize($filePath);
|
$actual = $this->fileView->filesize($filePath);
|
||||||
if ($actual != $expected) {
|
if ($actual != $expected) {
|
||||||
$this->fileView->unlink($filePath);
|
$this->fileView->unlink($filePath);
|
||||||
throw new Sabre_DAV_Exception_BadRequest('expected filesize ' . $expected . ' got ' . $actual);
|
throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
class OC_Connector_Sabre_Auth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
||||||
/**
|
/**
|
||||||
* Validates a username and password
|
* Validates a username and password
|
||||||
*
|
*
|
||||||
|
@ -69,11 +69,11 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
||||||
* even if there are no HTTP Basic Auth headers.
|
* even if there are no HTTP Basic Auth headers.
|
||||||
* In other case, just fallback to the parent implementation.
|
* In other case, just fallback to the parent implementation.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @param $realm
|
* @param $realm
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authenticate(Sabre_DAV_Server $server, $realm) {
|
public function authenticate(\Sabre\DAV\Server $server, $realm) {
|
||||||
|
|
||||||
$result = $this->auth($server, $realm);
|
$result = $this->auth($server, $realm);
|
||||||
|
|
||||||
|
@ -84,11 +84,11 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @param $realm
|
* @param $realm
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function auth(Sabre_DAV_Server $server, $realm) {
|
private function auth(\Sabre\DAV\Server $server, $realm) {
|
||||||
if (OC_User::handleApacheAuth() || OC_User::isLoggedIn()) {
|
if (OC_User::handleApacheAuth() || OC_User::isLoggedIn()) {
|
||||||
$user = OC_User::getUser();
|
$user = OC_User::getUser();
|
||||||
OC_Util::setupFS($user);
|
OC_Util::setupFS($user);
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
|
class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node
|
||||||
|
implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new file in the directory
|
* Creates a new file in the directory
|
||||||
|
@ -45,7 +46,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
*
|
*
|
||||||
* @param string $name Name of the file
|
* @param string $name Name of the file
|
||||||
* @param resource|string $data Initial payload
|
* @param resource|string $data Initial payload
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
public function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
|
@ -58,13 +59,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
$info = OC_FileChunking::decodeName($name);
|
$info = OC_FileChunking::decodeName($name);
|
||||||
if (!$this->fileView->isCreatable($this->path) &&
|
if (!$this->fileView->isCreatable($this->path) &&
|
||||||
!$this->fileView->isUpdatable($this->path . '/' . $info['name'])) {
|
!$this->fileView->isUpdatable($this->path . '/' . $info['name'])) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// For non-chunked upload it is enough to check if we can create a new file
|
// For non-chunked upload it is enough to check if we can create a new file
|
||||||
if (!$this->fileView->isCreatable($this->path)) {
|
if (!$this->fileView->isCreatable($this->path)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,17 +80,17 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
* Creates a new subdirectory
|
* Creates a new subdirectory
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
if (!$this->fileView->isCreatable($this->path)) {
|
if (!$this->fileView->isCreatable($this->path)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
$newPath = $this->path . '/' . $name;
|
$newPath = $this->path . '/' . $name;
|
||||||
if(!$this->fileView->mkdir($newPath)) {
|
if(!$this->fileView->mkdir($newPath)) {
|
||||||
throw new Sabre_DAV_Exception_Forbidden('Could not create directory '.$newPath);
|
throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,8 +100,8 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param \OCP\Files\FileInfo $info
|
* @param \OCP\Files\FileInfo $info
|
||||||
* @throws Sabre_DAV_Exception_NotFound
|
* @throws \Sabre\DAV\Exception\FileNotFound
|
||||||
* @return Sabre_DAV_INode
|
* @return \Sabre\DAV\INode
|
||||||
*/
|
*/
|
||||||
public function getChild($name, $info = null) {
|
public function getChild($name, $info = null) {
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$info) {
|
if (!$info) {
|
||||||
throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
|
throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($info['mimetype'] == 'httpd/unix-directory') {
|
if ($info['mimetype'] == 'httpd/unix-directory') {
|
||||||
|
@ -124,7 +125,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
/**
|
/**
|
||||||
* Returns an array with all the child nodes
|
* Returns an array with all the child nodes
|
||||||
*
|
*
|
||||||
* @return Sabre_DAV_INode[]
|
* @return \Sabre\DAV\INode[]
|
||||||
*/
|
*/
|
||||||
public function getChildren() {
|
public function getChildren() {
|
||||||
|
|
||||||
|
@ -183,12 +184,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
|
||||||
* Deletes all files in this directory, and then itself
|
* Deletes all files in this directory, and then itself
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete() {
|
||||||
|
|
||||||
if (!$this->info->isDeletable()) {
|
if (!$this->info->isDeletable()) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fileView->rmdir($this->path);
|
$this->fileView->rmdir($this->path);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This exception is thrown whenever a user tries to upload a file which exceeds hard limitations
|
* This exception is thrown whenever a user tries to upload a file which exceeds hard limitations
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class OC_Connector_Sabre_Exception_EntityTooLarge extends Sabre_DAV_Exception {
|
class OC_Connector_Sabre_Exception_EntityTooLarge extends \Sabre\DAV\Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HTTP status code for this exception
|
* Returns the HTTP status code for this exception
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Exception_FileLocked extends Sabre_DAV_Exception {
|
class OC_Connector_Sabre_Exception_FileLocked extends \Sabre\DAV\Exception {
|
||||||
|
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null) {
|
public function __construct($message = "", $code = 0, Exception $previous = null) {
|
||||||
if($previous instanceof \OCP\Files\LockNotAcquiredException) {
|
if($previous instanceof \OCP\Files\LockNotAcquiredException) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This exception is thrown whenever a user tries to upload a file which holds content which is not allowed
|
* This exception is thrown whenever a user tries to upload a file which holds content which is not allowed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class OC_Connector_Sabre_Exception_UnsupportedMediaType extends Sabre_DAV_Exception {
|
class OC_Connector_Sabre_Exception_UnsupportedMediaType extends \Sabre\DAV\Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HTTP status code for this exception
|
* Returns the HTTP status code for this exception
|
||||||
|
|
|
@ -9,17 +9,17 @@
|
||||||
* @license AGPL3
|
* @license AGPL3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_ExceptionLoggerPlugin extends Sabre_DAV_ServerPlugin
|
class OC_Connector_Sabre_ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin
|
||||||
{
|
{
|
||||||
private $nonFatalExceptions = array(
|
private $nonFatalExceptions = array(
|
||||||
'Sabre_DAV_Exception_NotAuthenticated' => true,
|
'Sabre\DAV\Exception\NotAuthenticated' => true,
|
||||||
// the sync client uses this to find out whether files exist,
|
// the sync client uses this to find out whether files exist,
|
||||||
// so it is not always an error, log it as debug
|
// so it is not always an error, log it as debug
|
||||||
'Sabre_DAV_Exception_NotFound' => true,
|
'Sabre\DAV\Exception\NotFound' => true,
|
||||||
// this one mostly happens when the same file is uploaded at
|
// this one mostly happens when the same file is uploaded at
|
||||||
// exactly the same time from two clients, only one client
|
// exactly the same time from two clients, only one client
|
||||||
// wins, the second one gets "Precondition failed"
|
// wins, the second one gets "Precondition failed"
|
||||||
'Sabre_DAV_Exception_PreconditionFailed' => true,
|
'Sabre\DAV\Exception\PreconditionFailed' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
private $appName;
|
private $appName;
|
||||||
|
@ -34,15 +34,15 @@ class OC_Connector_Sabre_ExceptionLoggerPlugin extends Sabre_DAV_ServerPlugin
|
||||||
/**
|
/**
|
||||||
* This initializes the plugin.
|
* This initializes the plugin.
|
||||||
*
|
*
|
||||||
* This function is called by Sabre_DAV_Server, after
|
* This function is called by \Sabre\DAV\Server, after
|
||||||
* addPlugin is called.
|
* addPlugin is called.
|
||||||
*
|
*
|
||||||
* This method should set up the required event subscriptions.
|
* This method should set up the required event subscriptions.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(Sabre_DAV_Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
|
|
||||||
$server->subscribeEvent('exception', array($this, 'logException'), 10);
|
$server->subscribeEvent('exception', array($this, 'logException'), 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_DAV_IFile {
|
class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\DAV\IFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the data
|
* Updates the data
|
||||||
|
@ -41,28 +41,28 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
* return an ETag, and just return null.
|
* return an ETag, and just return null.
|
||||||
*
|
*
|
||||||
* @param resource $data
|
* @param resource $data
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
* @throws OC_Connector_Sabre_Exception_UnsupportedMediaType
|
* @throws OC_Connector_Sabre_Exception_UnsupportedMediaType
|
||||||
* @throws Sabre_DAV_Exception_BadRequest
|
* @throws \Sabre\DAV\Exception\BadRequest
|
||||||
* @throws Sabre_DAV_Exception
|
* @throws \Sabre\DAV\Exception
|
||||||
* @throws OC_Connector_Sabre_Exception_EntityTooLarge
|
* @throws OC_Connector_Sabre_Exception_EntityTooLarge
|
||||||
* @throws Sabre_DAV_Exception_ServiceUnavailable
|
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function put($data) {
|
public function put($data) {
|
||||||
if ($this->info && $this->fileView->file_exists($this->path) &&
|
if ($this->info && $this->fileView->file_exists($this->path) &&
|
||||||
!$this->info->isUpdateable()) {
|
!$this->info->isUpdateable()) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw an exception if encryption was disabled but the files are still encrypted
|
// throw an exception if encryption was disabled but the files are still encrypted
|
||||||
if (\OC_Util::encryptedFiles()) {
|
if (\OC_Util::encryptedFiles()) {
|
||||||
throw new \Sabre_DAV_Exception_ServiceUnavailable();
|
throw new \Sabre\DAV\Exception\ServiceUnavailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = basename($this->path);
|
$fileName = basename($this->path);
|
||||||
if (!\OCP\Util::isValidFileName($fileName)) {
|
if (!\OCP\Util::isValidFileName($fileName)) {
|
||||||
throw new \Sabre_DAV_Exception_BadRequest();
|
throw new \Sabre\DAV\Exception\BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// chunked handling
|
// chunked handling
|
||||||
|
@ -79,11 +79,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
\OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
|
\OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
|
||||||
$this->fileView->unlink($partpath);
|
$this->fileView->unlink($partpath);
|
||||||
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
|
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
|
||||||
throw new Sabre_DAV_Exception('Could not write file contents');
|
throw new \Sabre\DAV\Exception('Could not write file contents');
|
||||||
}
|
}
|
||||||
} catch (\OCP\Files\NotPermittedException $e) {
|
} catch (\OCP\Files\NotPermittedException $e) {
|
||||||
// a more general case - due to whatever reason the content could not be written
|
// a more general case - due to whatever reason the content could not be written
|
||||||
throw new Sabre_DAV_Exception_Forbidden($e->getMessage());
|
throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
|
||||||
|
|
||||||
} catch (\OCP\Files\EntityTooLargeException $e) {
|
} catch (\OCP\Files\EntityTooLargeException $e) {
|
||||||
// the file is too big to be stored
|
// the file is too big to be stored
|
||||||
|
@ -96,7 +96,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
} catch (\OCP\Files\InvalidPathException $e) {
|
} catch (\OCP\Files\InvalidPathException $e) {
|
||||||
// the path for the file was not valid
|
// the path for the file was not valid
|
||||||
// TODO: find proper http status code for this case
|
// TODO: find proper http status code for this case
|
||||||
throw new Sabre_DAV_Exception_Forbidden($e->getMessage());
|
throw new \Sabre\DAV\Exception\Forbidden($e->getMessage());
|
||||||
} catch (\OCP\Files\LockNotAcquiredException $e) {
|
} catch (\OCP\Files\LockNotAcquiredException $e) {
|
||||||
// the file is currently being written to by another process
|
// the file is currently being written to by another process
|
||||||
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
|
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
|
||||||
|
@ -109,7 +109,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
if ($renameOkay === false || $fileExists === false) {
|
if ($renameOkay === false || $fileExists === false) {
|
||||||
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
|
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
|
||||||
$this->fileView->unlink($partpath);
|
$this->fileView->unlink($partpath);
|
||||||
throw new Sabre_DAV_Exception('Could not rename part file to final file');
|
throw new \Sabre\DAV\Exception('Could not rename part file to final file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (\OCP\Files\LockNotAcquiredException $e) {
|
catch (\OCP\Files\LockNotAcquiredException $e) {
|
||||||
|
@ -117,6 +117,15 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
|
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rename to correct path
|
||||||
|
$renameOkay = $this->fileView->rename($partpath, $this->path);
|
||||||
|
$fileExists = $this->fileView->file_exists($this->path);
|
||||||
|
if ($renameOkay === false || $fileExists === false) {
|
||||||
|
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
|
||||||
|
$this->fileView->unlink($partpath);
|
||||||
|
throw new \Sabre\DAV\Exception('Could not rename part file to final file');
|
||||||
|
}
|
||||||
|
|
||||||
// allow sync clients to send the mtime along in a header
|
// allow sync clients to send the mtime along in a header
|
||||||
$mtime = OC_Request::hasModificationTime();
|
$mtime = OC_Request::hasModificationTime();
|
||||||
if ($mtime !== false) {
|
if ($mtime !== false) {
|
||||||
|
@ -138,7 +147,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
|
|
||||||
//throw exception if encryption is disabled but files are still encrypted
|
//throw exception if encryption is disabled but files are still encrypted
|
||||||
if (\OC_Util::encryptedFiles()) {
|
if (\OC_Util::encryptedFiles()) {
|
||||||
throw new \Sabre_DAV_Exception_ServiceUnavailable();
|
throw new \Sabre\DAV\Exception\ServiceUnavailable();
|
||||||
} else {
|
} else {
|
||||||
return $this->fileView->fopen($this->path, 'rb');
|
return $this->fileView->fopen($this->path, 'rb');
|
||||||
}
|
}
|
||||||
|
@ -149,11 +158,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
* Delete the current file
|
* Delete the current file
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete() {
|
||||||
if (!$this->info->isDeletable()) {
|
if (!$this->info->isDeletable()) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
$this->fileView->unlink($this->path);
|
$this->fileView->unlink($this->path);
|
||||||
|
|
||||||
|
@ -205,11 +214,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
*/
|
*/
|
||||||
private function createFileChunked($data)
|
private function createFileChunked($data)
|
||||||
{
|
{
|
||||||
list($path, $name) = \Sabre_DAV_URLUtil::splitPath($this->path);
|
list($path, $name) = \Sabre\DAV\URLUtil::splitPath($this->path);
|
||||||
|
|
||||||
$info = OC_FileChunking::decodeName($name);
|
$info = OC_FileChunking::decodeName($name);
|
||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
throw new Sabre_DAV_Exception_NotImplemented();
|
throw new \Sabre\DAV\Exception\NotImplemented();
|
||||||
}
|
}
|
||||||
$chunk_handler = new OC_FileChunking($info);
|
$chunk_handler = new OC_FileChunking($info);
|
||||||
$bytesWritten = $chunk_handler->store($info['index'], $data);
|
$bytesWritten = $chunk_handler->store($info['index'], $data);
|
||||||
|
@ -220,7 +229,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
$expected = $_SERVER['CONTENT_LENGTH'];
|
$expected = $_SERVER['CONTENT_LENGTH'];
|
||||||
if ($bytesWritten != $expected) {
|
if ($bytesWritten != $expected) {
|
||||||
$chunk_handler->remove($info['index']);
|
$chunk_handler->remove($info['index']);
|
||||||
throw new Sabre_DAV_Exception_BadRequest(
|
throw new \Sabre\DAV\Exception\BadRequest(
|
||||||
'expected filesize ' . $expected . ' got ' . $bytesWritten);
|
'expected filesize ' . $expected . ' got ' . $bytesWritten);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +251,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
if ($fileExists) {
|
if ($fileExists) {
|
||||||
$this->fileView->unlink($targetPath);
|
$this->fileView->unlink($targetPath);
|
||||||
}
|
}
|
||||||
throw new Sabre_DAV_Exception('Could not rename part file assembled from chunks');
|
throw new \Sabre\DAV\Exception('Could not rename part file assembled from chunks');
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow sync clients to send the mtime along in a header
|
// allow sync clients to send the mtime along in a header
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* @license AGPL3
|
* @license AGPL3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
|
class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
// namespace
|
// namespace
|
||||||
|
@ -18,22 +18,22 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
|
||||||
/**
|
/**
|
||||||
* Reference to main server object
|
* Reference to main server object
|
||||||
*
|
*
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This initializes the plugin.
|
* This initializes the plugin.
|
||||||
*
|
*
|
||||||
* This function is called by Sabre_DAV_Server, after
|
* This function is called by \Sabre\DAV\Server, after
|
||||||
* addPlugin is called.
|
* addPlugin is called.
|
||||||
*
|
*
|
||||||
* This method should set up the required event subscriptions.
|
* This method should set up the required event subscriptions.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(Sabre_DAV_Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
|
|
||||||
$server->xmlNamespaces[self::NS_OWNCLOUD] = 'oc';
|
$server->xmlNamespaces[self::NS_OWNCLOUD] = 'oc';
|
||||||
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id';
|
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id';
|
||||||
|
@ -49,12 +49,12 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
|
||||||
* Adds all ownCloud-specific properties
|
* Adds all ownCloud-specific properties
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param Sabre_DAV_INode $node
|
* @param \Sabre\DAV\INode $node
|
||||||
* @param array $requestedProperties
|
* @param array $requestedProperties
|
||||||
* @param array $returnedProperties
|
* @param array $returnedProperties
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function beforeGetProperties($path, Sabre_DAV_INode $node, array &$requestedProperties, array &$returnedProperties) {
|
public function beforeGetProperties($path, \Sabre\DAV\INode $node, array &$requestedProperties, array &$returnedProperties) {
|
||||||
|
|
||||||
if ($node instanceof OC_Connector_Sabre_Node) {
|
if ($node instanceof OC_Connector_Sabre_Node) {
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filePath
|
* @param string $filePath
|
||||||
* @param Sabre_DAV_INode $node
|
* @param \Sabre\DAV\INode $node
|
||||||
* @throws Sabre_DAV_Exception_BadRequest
|
* @throws \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) {
|
public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) {
|
||||||
// chunked upload handling
|
// chunked upload handling
|
||||||
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
|
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
|
||||||
list($path, $name) = \Sabre_DAV_URLUtil::splitPath($filePath);
|
list($path, $name) = \Sabre\DAV\URLUtil::splitPath($filePath);
|
||||||
$info = OC_FileChunking::decodeName($name);
|
$info = OC_FileChunking::decodeName($name);
|
||||||
if (!empty($info)) {
|
if (!empty($info)) {
|
||||||
$filePath = $path . '/' . $info['name'];
|
$filePath = $path . '/' . $info['name'];
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
class OC_Connector_Sabre_Locks extends \Sabre\DAV\Locks\Backend\AbstractBackend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of Sabre_DAV_Locks_LockInfo objects
|
* Returns a list of \Sabre\DAV\Locks_LockInfo objects
|
||||||
*
|
*
|
||||||
* This method should return all the locks for a particular uri, including
|
* This method should return all the locks for a particular uri, including
|
||||||
* locks that might be set on a parent uri.
|
* locks that might be set on a parent uri.
|
||||||
|
@ -93,7 +93,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
||||||
$lockList = array();
|
$lockList = array();
|
||||||
while( $row = $result->fetchRow()) {
|
while( $row = $result->fetchRow()) {
|
||||||
|
|
||||||
$lockInfo = new Sabre_DAV_Locks_LockInfo();
|
$lockInfo = new \Sabre\DAV\Locks\LockInfo();
|
||||||
$lockInfo->owner = $row['owner'];
|
$lockInfo->owner = $row['owner'];
|
||||||
$lockInfo->token = $row['token'];
|
$lockInfo->token = $row['token'];
|
||||||
$lockInfo->timeout = $row['timeout'];
|
$lockInfo->timeout = $row['timeout'];
|
||||||
|
@ -113,10 +113,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
||||||
* Locks a uri
|
* Locks a uri
|
||||||
*
|
*
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
* @param \Sabre\DAV\Locks\LockInfo $lockInfo
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
|
public function lock($uri, \Sabre\DAV\Locks\LockInfo $lockInfo) {
|
||||||
|
|
||||||
// We're making the lock timeout 5 minutes
|
// We're making the lock timeout 5 minutes
|
||||||
$lockInfo->timeout = 300;
|
$lockInfo->timeout = 300;
|
||||||
|
@ -170,10 +170,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
|
||||||
* Removes a lock from a uri
|
* Removes a lock from a uri
|
||||||
*
|
*
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param Sabre_DAV_Locks_LockInfo $lockInfo
|
* @param \Sabre\DAV\Locks\LockInfo $lockInfo
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unlock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
|
public function unlock($uri, \Sabre\DAV\Locks\LockInfo $lockInfo) {
|
||||||
|
|
||||||
$sql = 'DELETE FROM `*PREFIX*locks` WHERE `userid` = ? AND `uri` = ? AND `token` = ?';
|
$sql = 'DELETE FROM `*PREFIX*locks` WHERE `userid` = ? AND `uri` = ? AND `token` = ?';
|
||||||
if (OC_Config::getValue( "dbtype") === 'oci') {
|
if (OC_Config::getValue( "dbtype") === 'oci') {
|
||||||
|
|
|
@ -9,30 +9,28 @@
|
||||||
* @license AGPL3
|
* @license AGPL3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require 'ServiceUnavailable.php';
|
class OC_Connector_Sabre_MaintenancePlugin extends \Sabre\DAV\ServerPlugin
|
||||||
|
|
||||||
class OC_Connector_Sabre_MaintenancePlugin extends Sabre_DAV_ServerPlugin
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to main server object
|
* Reference to main server object
|
||||||
*
|
*
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This initializes the plugin.
|
* This initializes the plugin.
|
||||||
*
|
*
|
||||||
* This function is called by Sabre_DAV_Server, after
|
* This function is called by \Sabre\DAV\Server, after
|
||||||
* addPlugin is called.
|
* addPlugin is called.
|
||||||
*
|
*
|
||||||
* This method should set up the required event subscriptions.
|
* This method should set up the required event subscriptions.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(Sabre_DAV_Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->server->subscribeEvent('beforeMethod', array($this, 'checkMaintenanceMode'), 10);
|
$this->server->subscribeEvent('beforeMethod', array($this, 'checkMaintenanceMode'), 10);
|
||||||
|
@ -42,16 +40,16 @@ class OC_Connector_Sabre_MaintenancePlugin extends Sabre_DAV_ServerPlugin
|
||||||
* This method is called before any HTTP method and returns http status code 503
|
* This method is called before any HTTP method and returns http status code 503
|
||||||
* in case the system is in maintenance mode.
|
* in case the system is in maintenance mode.
|
||||||
*
|
*
|
||||||
* @throws Sabre_DAV_Exception_ServiceUnavailable
|
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||||
* @internal param string $method
|
* @internal param string $method
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkMaintenanceMode() {
|
public function checkMaintenanceMode() {
|
||||||
if (OC_Config::getValue('maintenance', false)) {
|
if (OC_Config::getValue('maintenance', false)) {
|
||||||
throw new Sabre_DAV_Exception_ServiceUnavailable();
|
throw new \Sabre\DAV\Exception\ServiceUnavailable();
|
||||||
}
|
}
|
||||||
if (OC::checkUpgrade(false)) {
|
if (OC::checkUpgrade(false)) {
|
||||||
throw new Sabre_DAV_Exception_ServiceUnavailable('Upgrade needed');
|
throw new \Sabre\DAV\Exception\ServiceUnavailable('Upgrade needed');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
use Sabre\DAV\URLUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ownCloud
|
* ownCloud
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IProperties {
|
abstract class OC_Connector_Sabre_Node implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
const GETETAG_PROPERTYNAME = '{DAV:}getetag';
|
const GETETAG_PROPERTYNAME = '{DAV:}getetag';
|
||||||
const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified';
|
const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified';
|
||||||
|
|
||||||
|
@ -81,21 +82,21 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||||
/**
|
/**
|
||||||
* Renames the node
|
* Renames the node
|
||||||
* @param string $name The new name
|
* @param string $name The new name
|
||||||
* @throws Sabre_DAV_Exception_BadRequest
|
* @throws \Sabre\DAV\Exception\BadRequest
|
||||||
* @throws Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
|
|
||||||
// rename is only allowed if the update privilege is granted
|
// rename is only allowed if the update privilege is granted
|
||||||
if (!$this->info->isUpdateable()) {
|
if (!$this->info->isUpdateable()) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
list($parentPath,) = Sabre_DAV_URLUtil::splitPath($this->path);
|
list($parentPath,) = URLUtil::splitPath($this->path);
|
||||||
list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
|
list(, $newName) = URLUtil::splitPath($name);
|
||||||
|
|
||||||
if (!\OCP\Util::isValidFileName($newName)) {
|
if (!\OCP\Util::isValidFileName($newName)) {
|
||||||
throw new \Sabre_DAV_Exception_BadRequest();
|
throw new \Sabre\DAV\Exception\BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
$newPath = $parentPath . '/' . $newName;
|
$newPath = $parentPath . '/' . $newName;
|
||||||
|
@ -139,7 +140,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates properties on this node,
|
* Updates properties on this node,
|
||||||
* @see Sabre_DAV_IProperties::updateProperties
|
* @see \Sabre\DAV\IProperties::updateProperties
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace OC\Connector\Sabre;
|
||||||
use OC\Files\FileInfo;
|
use OC\Files\FileInfo;
|
||||||
use OC\Files\Filesystem;
|
use OC\Files\Filesystem;
|
||||||
|
|
||||||
class ObjectTree extends \Sabre_DAV_ObjectTree {
|
class ObjectTree extends \Sabre\DAV\ObjectTree {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Files\View
|
* @var \OC\Files\View
|
||||||
|
@ -27,10 +27,10 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Sabre_DAV_ICollection $rootNode
|
* @param \Sabre\DAV\ICollection $rootNode
|
||||||
* @param \OC\Files\View $view
|
* @param \OC\Files\View $view
|
||||||
*/
|
*/
|
||||||
public function init(\Sabre_DAV_ICollection $rootNode, \OC\Files\View $view) {
|
public function init(\Sabre\DAV\ICollection $rootNode, \OC\Files\View $view) {
|
||||||
$this->rootNode = $rootNode;
|
$this->rootNode = $rootNode;
|
||||||
$this->fileView = $view;
|
$this->fileView = $view;
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,13 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
* Returns the INode object for the requested path
|
* Returns the INode object for the requested path
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @throws \Sabre_DAV_Exception_ServiceUnavailable
|
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||||
* @throws \Sabre_DAV_Exception_NotFound
|
* @throws \Sabre\DAV\Exception\NotFound
|
||||||
* @return \Sabre_DAV_INode
|
* @return \Sabre\DAV\INode
|
||||||
*/
|
*/
|
||||||
public function getNodeForPath($path) {
|
public function getNodeForPath($path) {
|
||||||
if (!$this->fileView) {
|
if (!$this->fileView) {
|
||||||
throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
|
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = trim($path, '/');
|
$path = trim($path, '/');
|
||||||
|
@ -79,7 +79,7 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$info) {
|
if (!$info) {
|
||||||
throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
|
throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($info->getType() === 'dir') {
|
if ($info->getType() === 'dir') {
|
||||||
|
@ -98,22 +98,22 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
*
|
*
|
||||||
* @param string $sourcePath The path to the file which should be moved
|
* @param string $sourcePath The path to the file which should be moved
|
||||||
* @param string $destinationPath The full destination path, so not just the destination parent node
|
* @param string $destinationPath The full destination path, so not just the destination parent node
|
||||||
* @throws \Sabre_DAV_Exception_BadRequest
|
* @throws \Sabre\DAV\Exception\BadRequest
|
||||||
* @throws \Sabre_DAV_Exception_ServiceUnavailable
|
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||||
* @throws \Sabre_DAV_Exception_Forbidden
|
* @throws \Sabre\DAV\Exception\Forbidden
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function move($sourcePath, $destinationPath) {
|
public function move($sourcePath, $destinationPath) {
|
||||||
if (!$this->fileView) {
|
if (!$this->fileView) {
|
||||||
throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
|
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sourceNode = $this->getNodeForPath($sourcePath);
|
$sourceNode = $this->getNodeForPath($sourcePath);
|
||||||
if ($sourceNode instanceof \Sabre_DAV_ICollection and $this->nodeExists($destinationPath)) {
|
if ($sourceNode instanceof \Sabre\DAV\ICollection and $this->nodeExists($destinationPath)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden('Could not copy directory ' . $sourceNode . ', target exists');
|
throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode . ', target exists');
|
||||||
}
|
}
|
||||||
list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath);
|
list($sourceDir,) = \Sabre\DAV\URLUtil::splitPath($sourcePath);
|
||||||
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath);
|
list($destinationDir,) = \Sabre\DAV\URLUtil::splitPath($destinationPath);
|
||||||
|
|
||||||
$isShareMountPoint = false;
|
$isShareMountPoint = false;
|
||||||
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath);
|
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath);
|
||||||
|
@ -123,38 +123,39 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
|
|
||||||
// check update privileges
|
// check update privileges
|
||||||
if (!$this->fileView->isUpdatable($sourcePath) && !$isShareMountPoint) {
|
if (!$this->fileView->isUpdatable($sourcePath) && !$isShareMountPoint) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
if ($sourceDir !== $destinationDir) {
|
if ($sourceDir !== $destinationDir) {
|
||||||
// for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir
|
// for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir
|
||||||
if (ltrim($destinationDir, '/') === '') {
|
if (ltrim($destinationDir, '/') === '') {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
if (!$this->fileView->isUpdatable($sourceDir)) {
|
if (!$this->fileView->isUpdatable($sourceDir)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
if (!$this->fileView->isUpdatable($destinationDir)) {
|
if (!$this->fileView->isUpdatable($destinationDir)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
if (!$this->fileView->isDeletable($sourcePath)) {
|
if (!$this->fileView->isDeletable($sourcePath)) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden();
|
throw new \Sabre\DAV\Exception\Forbidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = basename($destinationPath);
|
$fileName = basename($destinationPath);
|
||||||
if (!\OCP\Util::isValidFileName($fileName)) {
|
if (!\OCP\Util::isValidFileName($fileName)) {
|
||||||
throw new \Sabre_DAV_Exception_BadRequest();
|
throw new \Sabre\DAV\Exception\BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
$renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
|
$renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
|
||||||
if (!$renameOkay) {
|
if (!$renameOkay) {
|
||||||
throw new \Sabre_DAV_Exception_Forbidden('');
|
throw new \Sabre\DAV\Exception\Forbidden('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// update properties
|
// update properties
|
||||||
$query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?'
|
$query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?'
|
||||||
. ' WHERE `userid` = ? AND `propertypath` = ?');
|
. ' WHERE `userid` = ? AND `propertypath` = ?');
|
||||||
$query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), \OC\Files\Filesystem::normalizePath($sourcePath)));
|
$query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(),
|
||||||
|
\OC\Files\Filesystem::normalizePath($sourcePath)));
|
||||||
|
|
||||||
$this->markDirty($sourceDir);
|
$this->markDirty($sourceDir);
|
||||||
$this->markDirty($destinationDir);
|
$this->markDirty($destinationDir);
|
||||||
|
@ -169,12 +170,12 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
*
|
*
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
* @throws \Sabre_DAV_Exception_ServiceUnavailable
|
* @throws \Sabre\DAV\Exception\ServiceUnavailable
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function copy($source, $destination) {
|
public function copy($source, $destination) {
|
||||||
if (!$this->fileView) {
|
if (!$this->fileView) {
|
||||||
throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
|
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->fileView->is_file($source)) {
|
if ($this->fileView->is_file($source)) {
|
||||||
|
@ -192,7 +193,7 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destination);
|
list($destinationDir,) = \Sabre\DAV\URLUtil::splitPath($destination);
|
||||||
$this->markDirty($destinationDir);
|
$this->markDirty($destinationDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
|
class OC_Connector_Sabre_Principal implements Sabre\DAVACL\IPrincipalBackend {
|
||||||
/**
|
/**
|
||||||
* Returns a list of principals based on a prefix.
|
* Returns a list of principals based on a prefix.
|
||||||
*
|
*
|
||||||
|
@ -68,7 +68,7 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
|
||||||
// TODO: for now the group principal has only one member, the user itself
|
// TODO: for now the group principal has only one member, the user itself
|
||||||
$principal = $this->getPrincipalByPath($principal);
|
$principal = $this->getPrincipalByPath($principal);
|
||||||
if (!$principal) {
|
if (!$principal) {
|
||||||
throw new Sabre_DAV_Exception('Principal not found');
|
throw new \Sabre\DAV\Exception('Principal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
@ -83,13 +83,13 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getGroupMembership($principal) {
|
public function getGroupMembership($principal) {
|
||||||
list($prefix, $name) = Sabre_DAV_URLUtil::splitPath($principal);
|
list($prefix, $name) = \Sabre\DAV\URLUtil::splitPath($principal);
|
||||||
|
|
||||||
$group_membership = array();
|
$group_membership = array();
|
||||||
if ($prefix == 'principals') {
|
if ($prefix == 'principals') {
|
||||||
$principal = $this->getPrincipalByPath($principal);
|
$principal = $this->getPrincipalByPath($principal);
|
||||||
if (!$principal) {
|
if (!$principal) {
|
||||||
throw new Sabre_DAV_Exception('Principal not found');
|
throw new \Sabre\DAV\Exception('Principal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for now the user principal has only its own groups
|
// TODO: for now the user principal has only its own groups
|
||||||
|
@ -115,7 +115,7 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setGroupMemberSet($principal, array $members) {
|
public function setGroupMemberSet($principal, array $members) {
|
||||||
throw new Sabre_DAV_Exception('Setting members of the group is not supported yet');
|
throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePrincipal($path, $mutations) {
|
function updatePrincipal($path, $mutations) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
use Sabre\DAV\URLUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
* @copyright Copyright (C) 2012 entreCables S.L. All rights reserved.
|
* @copyright Copyright (C) 2012 entreCables S.L. All rights reserved.
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
class OC_Connector_Sabre_QuotaPlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\Files\View
|
* @var \OC\Files\View
|
||||||
|
@ -17,7 +18,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
||||||
/**
|
/**
|
||||||
* Reference to main server object
|
* Reference to main server object
|
||||||
*
|
*
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
|
@ -31,15 +32,15 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
||||||
/**
|
/**
|
||||||
* This initializes the plugin.
|
* This initializes the plugin.
|
||||||
*
|
*
|
||||||
* This function is called by Sabre_DAV_Server, after
|
* This function is called by \Sabre\DAV\Server, after
|
||||||
* addPlugin is called.
|
* addPlugin is called.
|
||||||
*
|
*
|
||||||
* This method should set up the requires event subscriptions.
|
* This method should set up the requires event subscriptions.
|
||||||
*
|
*
|
||||||
* @param Sabre_DAV_Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(Sabre_DAV_Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
||||||
*
|
*
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param null $data
|
* @param null $data
|
||||||
* @throws Sabre_DAV_Exception_InsufficientStorage
|
* @throws \Sabre\DAV\Exception\InsufficientStorage
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkQuota($uri, $data = null) {
|
public function checkQuota($uri, $data = null) {
|
||||||
|
@ -61,7 +62,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
||||||
if (substr($uri, 0, 1) !== '/') {
|
if (substr($uri, 0, 1) !== '/') {
|
||||||
$uri = '/' . $uri;
|
$uri = '/' . $uri;
|
||||||
}
|
}
|
||||||
list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
|
list($parentUri, $newName) = URLUtil::splitPath($uri);
|
||||||
$req = $this->server->httpRequest;
|
$req = $this->server->httpRequest;
|
||||||
if ($req->getHeader('OC-Chunked')) {
|
if ($req->getHeader('OC-Chunked')) {
|
||||||
$info = OC_FileChunking::decodeName($newName);
|
$info = OC_FileChunking::decodeName($newName);
|
||||||
|
@ -75,7 +76,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
|
||||||
if (isset($chunkHandler)) {
|
if (isset($chunkHandler)) {
|
||||||
$chunkHandler->cleanup();
|
$chunkHandler->cleanup();
|
||||||
}
|
}
|
||||||
throw new Sabre_DAV_Exception_InsufficientStorage();
|
throw new \Sabre\DAV\Exception\InsufficientStorage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_Connector_Sabre_Request extends Sabre_HTTP_Request {
|
class OC_Connector_Sabre_Request extends \Sabre\HTTP\Request {
|
||||||
/**
|
/**
|
||||||
* Returns the requested uri
|
* Returns the requested uri
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
/**
|
/**
|
||||||
* Class OC_Connector_Sabre_Server
|
* Class OC_Connector_Sabre_Server
|
||||||
*
|
*
|
||||||
* This class reimplements some methods from @see Sabre_DAV_Server.
|
* This class reimplements some methods from @see \Sabre\DAV\Server.
|
||||||
*
|
*
|
||||||
* Basically we add handling of depth: infinity.
|
* Basically we add handling of depth: infinity.
|
||||||
*
|
*
|
||||||
|
@ -24,16 +24,16 @@
|
||||||
*
|
*
|
||||||
* For ownCloud 7 we will upgrade SabreDAV and submit the patch - if needed.
|
* For ownCloud 7 we will upgrade SabreDAV and submit the patch - if needed.
|
||||||
*
|
*
|
||||||
* @see Sabre_DAV_Server
|
* @see \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
class OC_Connector_Sabre_Server extends Sabre\DAV\Server {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Sabre_DAV_Server
|
* @see \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
protected function httpPropfind($uri) {
|
protected function httpPropfind($uri) {
|
||||||
|
|
||||||
// $xml = new Sabre_DAV_XMLReader(file_get_contents('php://input'));
|
// $xml = new \Sabre\DAV\XMLReader(file_get_contents('php://input'));
|
||||||
$requestedProperties = $this->parsePropFindRequest($this->httpRequest->getBody(true));
|
$requestedProperties = $this->parsePropFindRequest($this->httpRequest->getBody(true));
|
||||||
|
|
||||||
$depth = $this->getHTTPDepth(1);
|
$depth = $this->getHTTPDepth(1);
|
||||||
|
@ -72,7 +72,7 @@ class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
||||||
private function addPathNodesRecursively(&$nodes, $path) {
|
private function addPathNodesRecursively(&$nodes, $path) {
|
||||||
foreach($this->tree->getChildren($path) as $childNode) {
|
foreach($this->tree->getChildren($path) as $childNode) {
|
||||||
$nodes[$path . '/' . $childNode->getName()] = $childNode;
|
$nodes[$path . '/' . $childNode->getName()] = $childNode;
|
||||||
if ($childNode instanceof Sabre_DAV_ICollection)
|
if ($childNode instanceof \Sabre\DAV\ICollection)
|
||||||
$this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
|
$this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,10 @@ class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
||||||
$nodes = array(
|
$nodes = array(
|
||||||
$path => $parentNode
|
$path => $parentNode
|
||||||
);
|
);
|
||||||
if ($depth==1 && $parentNode instanceof Sabre_DAV_ICollection) {
|
if ($depth==1 && $parentNode instanceof \Sabre\DAV\ICollection) {
|
||||||
foreach($this->tree->getChildren($path) as $childNode)
|
foreach($this->tree->getChildren($path) as $childNode)
|
||||||
$nodes[$path . '/' . $childNode->getName()] = $childNode;
|
$nodes[$path . '/' . $childNode->getName()] = $childNode;
|
||||||
} else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof Sabre_DAV_ICollection) {
|
} else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof \Sabre\DAV\ICollection) {
|
||||||
$this->addPathNodesRecursively($nodes, $path);
|
$this->addPathNodesRecursively($nodes, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
||||||
|
|
||||||
if (count($currentPropertyNames) > 0) {
|
if (count($currentPropertyNames) > 0) {
|
||||||
|
|
||||||
if ($node instanceof Sabre_DAV_IProperties) {
|
if ($node instanceof \Sabre\DAV\IProperties) {
|
||||||
$nodeProperties = $node->getProperties($currentPropertyNames);
|
$nodeProperties = $node->getProperties($currentPropertyNames);
|
||||||
|
|
||||||
// The getProperties method may give us too much,
|
// The getProperties method may give us too much,
|
||||||
|
@ -165,9 +165,9 @@ class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
||||||
if (isset($newProperties[200][$prop])) continue;
|
if (isset($newProperties[200][$prop])) continue;
|
||||||
|
|
||||||
switch($prop) {
|
switch($prop) {
|
||||||
case '{DAV:}getlastmodified' : if ($node->getLastModified()) $newProperties[200][$prop] = new Sabre_DAV_Property_GetLastModified($node->getLastModified()); break;
|
case '{DAV:}getlastmodified' : if ($node->getLastModified()) $newProperties[200][$prop] = new \Sabre\DAV\Property\GetLastModified($node->getLastModified()); break;
|
||||||
case '{DAV:}getcontentlength' :
|
case '{DAV:}getcontentlength' :
|
||||||
if ($node instanceof Sabre_DAV_IFile) {
|
if ($node instanceof \Sabre\DAV\IFile) {
|
||||||
$size = $node->getSize();
|
$size = $node->getSize();
|
||||||
if (!is_null($size)) {
|
if (!is_null($size)) {
|
||||||
$newProperties[200][$prop] = 0 + $size;
|
$newProperties[200][$prop] = 0 + $size;
|
||||||
|
@ -175,28 +175,28 @@ class OC_Connector_Sabre_Server extends Sabre_DAV_Server {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '{DAV:}quota-used-bytes' :
|
case '{DAV:}quota-used-bytes' :
|
||||||
if ($node instanceof Sabre_DAV_IQuota) {
|
if ($node instanceof \Sabre\DAV\IQuota) {
|
||||||
$quotaInfo = $node->getQuotaInfo();
|
$quotaInfo = $node->getQuotaInfo();
|
||||||
$newProperties[200][$prop] = $quotaInfo[0];
|
$newProperties[200][$prop] = $quotaInfo[0];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '{DAV:}quota-available-bytes' :
|
case '{DAV:}quota-available-bytes' :
|
||||||
if ($node instanceof Sabre_DAV_IQuota) {
|
if ($node instanceof \Sabre\DAV\IQuota) {
|
||||||
$quotaInfo = $node->getQuotaInfo();
|
$quotaInfo = $node->getQuotaInfo();
|
||||||
$newProperties[200][$prop] = $quotaInfo[1];
|
$newProperties[200][$prop] = $quotaInfo[1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '{DAV:}getetag' : if ($node instanceof Sabre_DAV_IFile && $etag = $node->getETag()) $newProperties[200][$prop] = $etag; break;
|
case '{DAV:}getetag' : if ($node instanceof \Sabre\DAV\IFile && $etag = $node->getETag()) $newProperties[200][$prop] = $etag; break;
|
||||||
case '{DAV:}getcontenttype' : if ($node instanceof Sabre_DAV_IFile && $ct = $node->getContentType()) $newProperties[200][$prop] = $ct; break;
|
case '{DAV:}getcontenttype' : if ($node instanceof \Sabre\DAV\IFile && $ct = $node->getContentType()) $newProperties[200][$prop] = $ct; break;
|
||||||
case '{DAV:}supported-report-set' :
|
case '{DAV:}supported-report-set' :
|
||||||
$reports = array();
|
$reports = array();
|
||||||
foreach($this->plugins as $plugin) {
|
foreach($this->plugins as $plugin) {
|
||||||
$reports = array_merge($reports, $plugin->getSupportedReportSet($myPath));
|
$reports = array_merge($reports, $plugin->getSupportedReportSet($myPath));
|
||||||
}
|
}
|
||||||
$newProperties[200][$prop] = new Sabre_DAV_Property_SupportedReportSet($reports);
|
$newProperties[200][$prop] = new \Sabre\DAV\Property\SupportedReportSet($reports);
|
||||||
break;
|
break;
|
||||||
case '{DAV:}resourcetype' :
|
case '{DAV:}resourcetype' :
|
||||||
$newProperties[200]['{DAV:}resourcetype'] = new Sabre_DAV_Property_ResourceType();
|
$newProperties[200]['{DAV:}resourcetype'] = new \Sabre\DAV\Property\ResourceType();
|
||||||
foreach($this->resourceTypeMapping as $className => $resourceType) {
|
foreach($this->resourceTypeMapping as $className => $resourceType) {
|
||||||
if ($node instanceof $className) $newProperties[200]['{DAV:}resourcetype']->add($resourceType);
|
if ($node instanceof $className) $newProperties[200]['{DAV:}resourcetype']->add($resourceType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* like request timeout.
|
* like request timeout.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OC_DAVClient extends \Sabre_DAV_Client {
|
class OC_DAVClient extends \Sabre\DAV\Client {
|
||||||
|
|
||||||
protected $requestTimeout;
|
protected $requestTimeout;
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ class OC_Request {
|
||||||
$path_info = $_SERVER['PATH_INFO'];
|
$path_info = $_SERVER['PATH_INFO'];
|
||||||
}else{
|
}else{
|
||||||
$path_info = self::getRawPathInfo();
|
$path_info = self::getRawPathInfo();
|
||||||
// following is taken from Sabre_DAV_URLUtil::decodePathSegment
|
// following is taken from \Sabre\DAV\URLUtil::decodePathSegment
|
||||||
$path_info = rawurldecode($path_info);
|
$path_info = rawurldecode($path_info);
|
||||||
$encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
|
$encoding = mb_detect_encoding($path_info, array('UTF-8', 'ISO-8859-1'));
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ class OC_Request {
|
||||||
$path_info = $requestUri;
|
$path_info = $requestUri;
|
||||||
|
|
||||||
// strip off the script name's dir and file name
|
// strip off the script name's dir and file name
|
||||||
list($path, $name) = \Sabre_DAV_URLUtil::splitPath($scriptName);
|
list($path, $name) = \Sabre\DAV\URLUtil::splitPath($scriptName);
|
||||||
if (!empty($path)) {
|
if (!empty($path)) {
|
||||||
if( $path === $path_info || strpos($path_info, $path.'/') === 0) {
|
if( $path === $path_info || strpos($path_info, $path.'/') === 0) {
|
||||||
$path_info = substr($path_info, strlen($path));
|
$path_info = substr($path_info, strlen($path));
|
||||||
|
|
|
@ -983,7 +983,7 @@ class OC_Util {
|
||||||
try {
|
try {
|
||||||
// test PROPFIND
|
// test PROPFIND
|
||||||
$client->propfind('', array('{DAV:}resourcetype'));
|
$client->propfind('', array('{DAV:}resourcetype'));
|
||||||
} catch (\Sabre_DAV_Exception_NotAuthenticated $e) {
|
} catch (\Sabre\DAV\Exception\NotAuthenticated $e) {
|
||||||
$return = true;
|
$return = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
OC_Log::write('core', 'isWebDAVWorking: NO - Reason: '.$e->getMessage(). ' ('.get_class($e).')', OC_Log::WARN);
|
OC_Log::write('core', 'isWebDAVWorking: NO - Reason: '.$e->getMessage(). ' ('.get_class($e).')', OC_Log::WARN);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Framework_TestCase {
|
class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame
|
||||||
private $plugin;
|
private $plugin;
|
||||||
|
|
||||||
private function init($view) {
|
private function init($view) {
|
||||||
$this->server = new Sabre_DAV_Server();
|
$this->server = new \Sabre\DAV\Server();
|
||||||
$this->plugin = new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view);
|
$this->plugin = new OC_Connector_Sabre_AbortedUploadDetectionPlugin($view);
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame
|
||||||
public function testLength($expected, $headers) {
|
public function testLength($expected, $headers) {
|
||||||
$this->init(null);
|
$this->init(null);
|
||||||
|
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new \Sabre\HTTP\Request($headers);
|
||||||
$length = $this->plugin->getLength();
|
$length = $this->plugin->getLength();
|
||||||
$this->assertEquals($expected, $length);
|
$this->assertEquals($expected, $length);
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,14 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame
|
||||||
$this->init($this->buildFileViewMock($fileSize));
|
$this->init($this->buildFileViewMock($fileSize));
|
||||||
|
|
||||||
$headers['REQUEST_METHOD'] = $method;
|
$headers['REQUEST_METHOD'] = $method;
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new Sabre\HTTP\Request($headers);
|
||||||
$this->plugin->verifyContentLength('foo.txt');
|
$this->plugin->verifyContentLength('foo.txt');
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider verifyContentLengthFailedProvider
|
* @dataProvider verifyContentLengthFailedProvider
|
||||||
* @expectedException Sabre_DAV_Exception_BadRequest
|
* @expectedException \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function testVerifyContentLengthFailed($method, $fileSize, $headers) {
|
public function testVerifyContentLengthFailed($method, $fileSize, $headers) {
|
||||||
$view = $this->buildFileViewMock($fileSize);
|
$view = $this->buildFileViewMock($fileSize);
|
||||||
|
@ -58,7 +58,7 @@ class Test_OC_Connector_Sabre_AbortedUploadDetectionPlugin extends PHPUnit_Frame
|
||||||
$view->expects($this->once())->method('unlink');
|
$view->expects($this->once())->method('unlink');
|
||||||
|
|
||||||
$headers['REQUEST_METHOD'] = $method;
|
$headers['REQUEST_METHOD'] = $method;
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new Sabre\HTTP\Request($headers);
|
||||||
$this->plugin->verifyContentLength('foo.txt');
|
$this->plugin->verifyContentLength('foo.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
* @expectedException \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function testCreateSharedFileFails() {
|
public function testCreateSharedFileFails() {
|
||||||
$dir = $this->getRootDir();
|
$dir = $this->getRootDir();
|
||||||
|
@ -31,7 +31,7 @@ class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
* @expectedException \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function testCreateSharedFolderFails() {
|
public function testCreateSharedFolderFails() {
|
||||||
$dir = $this->getRootDir();
|
$dir = $this->getRootDir();
|
||||||
|
@ -39,7 +39,7 @@ class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
* @expectedException \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function testDeleteSharedFolderFails() {
|
public function testDeleteSharedFolderFails() {
|
||||||
$dir = $this->getRootDir();
|
$dir = $this->getRootDir();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
|
class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception
|
* @expectedException \Sabre\DAV\Exception
|
||||||
*/
|
*/
|
||||||
public function testSimplePutFails() {
|
public function testSimplePutFails() {
|
||||||
// setup
|
// setup
|
||||||
|
@ -33,7 +33,7 @@ class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception
|
* @expectedException \Sabre\DAV\Exception
|
||||||
*/
|
*/
|
||||||
public function testSimplePutFailsOnRename() {
|
public function testSimplePutFailsOnRename() {
|
||||||
// setup
|
// setup
|
||||||
|
@ -62,7 +62,7 @@ class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception_BadRequest
|
* @expectedException \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function testSimplePutInvalidChars() {
|
public function testSimplePutInvalidChars() {
|
||||||
// setup
|
// setup
|
||||||
|
@ -86,7 +86,7 @@ class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test setting name with setName() with invalid chars
|
* Test setting name with setName() with invalid chars
|
||||||
* @expectedException Sabre_DAV_Exception_BadRequest
|
* @expectedException \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function testSetNameInvalidChars() {
|
public function testSetNameInvalidChars() {
|
||||||
// setup
|
// setup
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace Test\OC\Connector\Sabre;
|
||||||
use OC\Files\FileInfo;
|
use OC\Files\FileInfo;
|
||||||
use OC_Connector_Sabre_Directory;
|
use OC_Connector_Sabre_Directory;
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
use Sabre_DAV_Exception_Forbidden;
|
|
||||||
|
|
||||||
class TestDoubleFileView extends \OC\Files\View{
|
class TestDoubleFileView extends \OC\Files\View{
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider moveFailedProvider
|
* @dataProvider moveFailedProvider
|
||||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
* @expectedException \Sabre\DAV\Exception\Forbidden
|
||||||
*/
|
*/
|
||||||
public function testMoveFailed($source, $dest, $updatables, $deletables) {
|
public function testMoveFailed($source, $dest, $updatables, $deletables) {
|
||||||
$this->moveTest($source, $dest, $updatables, $deletables);
|
$this->moveTest($source, $dest, $updatables, $deletables);
|
||||||
|
@ -59,7 +58,7 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider moveFailedInvalidCharsProvider
|
* @dataProvider moveFailedInvalidCharsProvider
|
||||||
* @expectedException Sabre_DAV_Exception_BadRequest
|
* @expectedException \Sabre\DAV\Exception\BadRequest
|
||||||
*/
|
*/
|
||||||
public function testMoveFailedInvalidChars($source, $dest, $updatables, $deletables) {
|
public function testMoveFailedInvalidChars($source, $dest, $updatables, $deletables) {
|
||||||
$this->moveTest($source, $dest, $updatables, $deletables);
|
$this->moveTest($source, $dest, $updatables, $deletables);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
|
class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Sabre_DAV_Server
|
* @var \Sabre\DAV\Server
|
||||||
*/
|
*/
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
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 OC_Connector_Sabre_QuotaPlugin($view);
|
||||||
$this->plugin->initialize($this->server);
|
$this->plugin->initialize($this->server);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
|
||||||
*/
|
*/
|
||||||
public function testLength($expected, $headers) {
|
public function testLength($expected, $headers) {
|
||||||
$this->init(0);
|
$this->init(0);
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new \Sabre\HTTP\Request($headers);
|
||||||
$length = $this->plugin->getLength();
|
$length = $this->plugin->getLength();
|
||||||
$this->assertEquals($expected, $length);
|
$this->assertEquals($expected, $length);
|
||||||
}
|
}
|
||||||
|
@ -41,19 +41,19 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
|
||||||
public function testCheckQuota($quota, $headers) {
|
public function testCheckQuota($quota, $headers) {
|
||||||
$this->init($quota);
|
$this->init($quota);
|
||||||
|
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new Sabre\HTTP\Request($headers);
|
||||||
$result = $this->plugin->checkQuota('');
|
$result = $this->plugin->checkQuota('');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Sabre_DAV_Exception_InsufficientStorage
|
* @expectedException \Sabre\DAV\Exception\InsufficientStorage
|
||||||
* @dataProvider quotaExceededProvider
|
* @dataProvider quotaExceededProvider
|
||||||
*/
|
*/
|
||||||
public function testCheckExceededQuota($quota, $headers) {
|
public function testCheckExceededQuota($quota, $headers) {
|
||||||
$this->init($quota);
|
$this->init($quota);
|
||||||
|
|
||||||
$this->server->httpRequest = new Sabre_HTTP_Request($headers);
|
$this->server->httpRequest = new Sabre\HTTP\Request($headers);
|
||||||
$this->plugin->checkQuota('');
|
$this->plugin->checkQuota('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue