aboutsummaryrefslogtreecommitdiffstats
path: root/lib/connector
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connector')
-rw-r--r--lib/connector/sabre/auth.php2
-rw-r--r--lib/connector/sabre/directory.php23
-rw-r--r--lib/connector/sabre/node.php12
-rw-r--r--lib/connector/sabre/principal.php12
4 files changed, 30 insertions, 19 deletions
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index 34fc5fee50c..0c34c7ea29f 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -36,7 +36,7 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
return true;
} else {
OC_Util::setUpFS();//login hooks may need early access to the filesystem
- if(OC_User::login($username,$password)) {
+ if(OC_User::login($username, $password)) {
OC_Util::setUpFS($username);
return true;
}
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 8fff77ac749..413efef73b7 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -50,17 +50,19 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
public function createFile($name, $data = null) {
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
$info = OC_FileChunking::decodeName($name);
+ if (empty($info)) {
+ throw new Sabre_DAV_Exception_NotImplemented();
+ }
$chunk_handler = new OC_FileChunking($info);
$chunk_handler->store($info['index'], $data);
if ($chunk_handler->isComplete()) {
$newPath = $this->path . '/' . $info['name'];
- $f = OC_Filesystem::fopen($newPath, 'w');
- $chunk_handler->assemble($f);
+ $chunk_handler->file_assemble($newPath);
return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath);
}
} else {
$newPath = $this->path . '/' . $name;
- OC_Filesystem::file_put_contents($newPath,$data);
+ OC_Filesystem::file_put_contents($newPath, $data);
return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath);
}
@@ -91,10 +93,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
$path = $this->path . '/' . $name;
if (is_null($info)) {
- $info = OC_FileCache::get($path);
+ $info = OC_Files::getFileInfo($path);
}
- if (!$info) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
+ if (!$info) {
+ throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
+ }
if ($info['mimetype'] == 'httpd/unix-directory') {
$node = new OC_Connector_Sabre_Directory($path);
@@ -113,7 +117,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function getChildren() {
- $folder_content = OC_FileCache::getFolderContent($this->path);
+ $folder_content = OC_Files::getDirectoryContent($this->path);
$paths = array();
foreach($folder_content as $info) {
$paths[] = $this->path.'/'.$info['name'];
@@ -195,10 +199,9 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function getProperties($properties) {
$props = parent::getProperties($properties);
- if (in_array(self::GETETAG_PROPERTYNAME, $properties)
- && !isset($props[self::GETETAG_PROPERTYNAME])) {
- $props[self::GETETAG_PROPERTYNAME] =
- OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
+ if (in_array(self::GETETAG_PROPERTYNAME, $properties) && !isset($props[self::GETETAG_PROPERTYNAME])) {
+ $props[self::GETETAG_PROPERTYNAME]
+ = OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
}
return $props;
}
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index 2916575e2d5..55fa0dfde66 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -23,7 +23,9 @@
abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IProperties {
const GETETAG_PROPERTYNAME = '{DAV:}getetag';
-
+ const LASTMODIFIED_PROPERTYNAME_DEPRECIATED = '{DAV:}lastmodified'; // FIXME: keept for the transition period, can be removed for OC 4.5.1 if the sync client update too
+ const GETLASTMODIFIED_PROPERTYNAME = '{DAV:}getlastmodified';
+
/**
* The path to the current node
*
@@ -142,7 +144,6 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
public function updateProperties($properties) {
$existing = $this->getProperties(array());
foreach($properties as $propertyName => $propertyValue) {
- $propertyName = preg_replace("/^{.*}/", "", $propertyName); // remove leading namespace from property name
// If it was null, we need to delete the property
if (is_null($propertyValue)) {
if(array_key_exists( $propertyName, $existing )) {
@@ -150,8 +151,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$query->execute( array( OC_User::getUser(), $this->path, $propertyName ));
}
}
- else {
- if( strcmp( $propertyName, "lastmodified") === 0) {
+ else { //FIXME: first part of if statement can be removed together with the LASTMODIFIED_PROPERTYNAME_DEPRECIATED const for oc4.5.1 if the sync client was updated too
+ if( strcmp( $propertyName, self::LASTMODIFIED_PROPERTYNAME_DEPRECIATED) === 0 ||
+ strcmp( $propertyName, self::GETLASTMODIFIED_PROPERTYNAME) === 0 ) {
$this->touch($propertyValue);
} else {
if(!array_key_exists( $propertyName, $existing )) {
@@ -235,7 +237,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
static public function removeETagPropertyForPath($path) {
// remove tags from this and parent paths
$paths = array();
- while ($path != '/' && $path != '') {
+ while ($path != '/' && $path != '.' && $path != '') {
$paths[] = $path;
$path = dirname($path);
}
diff --git a/lib/connector/sabre/principal.php b/lib/connector/sabre/principal.php
index cfc72eda9f9..ee95ae63306 100644
--- a/lib/connector/sabre/principal.php
+++ b/lib/connector/sabre/principal.php
@@ -66,7 +66,7 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
*/
public function getGroupMemberSet($principal) {
// TODO: for now the group principal has only one member, the user itself
- list($prefix,$name) = Sabre_DAV_URLUtil::splitPath($principal);
+ list($prefix, $name) = Sabre_DAV_URLUtil::splitPath($principal);
$principal = $this->getPrincipalByPath($prefix);
if (!$principal) throw new Sabre_DAV_Exception('Principal not found');
@@ -115,6 +115,12 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
public function setGroupMemberSet($principal, array $members) {
throw new Sabre_DAV_Exception('Setting members of the group is not supported yet');
}
- function updatePrincipal($path, $mutations) {return 0;}
- function searchPrincipals($prefixPath, array $searchProperties) {return 0;}
+
+ function updatePrincipal($path, $mutations) {
+ return 0;
+ }
+
+ function searchPrincipals($prefixPath, array $searchProperties) {
+ return 0;
+ }
}