Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@owncloud.com>2012-02-14 12:59:54 +0400
committerKlaas Freitag <freitag@owncloud.com>2012-02-14 12:59:54 +0400
commit60a03580fff65d969faea8e5788b278ed8b15481 (patch)
tree7b2286bbcf87cca0d52c348f8ef0116f4c055e53
parentd10f4f071d8a51128e0b8056e9af414af98cf833 (diff)
allow to set a files mtime through a PROPPATCH request on resource
'lastmodified'. Needed for syncing algorithms.
-rw-r--r--lib/connector/sabre/node.php12
-rw-r--r--lib/filestorage/local.php17
-rw-r--r--lib/filesystem.php4
-rw-r--r--lib/filesystemview.php4
4 files changed, 18 insertions, 19 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index b8b675c1203..41acb48dfb6 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -97,12 +97,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* in the second parameter or to now if the second param is empty.
* Even if the modification time is set to a custom value the access time is set to now.
*/
- public function setLastModifiedTime($mtime) {
- OC_Filesystem::setFileMtime($this->path, $mtime);
- }
-
- public function endsWith( $str, $sub ) {
- return ( substr( $str, strlen( $str ) - strlen( $sub ) ) === $sub );
+ public function touch($mtime) {
+ OC_Filesystem::touch($this->path, $mtime);
}
/**
@@ -123,8 +119,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
}
else {
- if( $this->endsWith( $propertyName, "modificationTime")) {
- $this->setLastModifiedTime($propertyValue);
+ if( strcmp( $propertyName, "lastmodified")) {
+ $this->touch($propertyValue);
} else {
if(!array_key_exists( $propertyName, $existing )){
$query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' );
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 292d2a84e7d..35db244e4d6 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -65,13 +65,16 @@ class OC_Filestorage_Local extends OC_Filestorage{
public function filemtime($path){
return filemtime($this->datadir.$path);
}
-
- public function setFileMtime($path, $mtime){
- // sets the modification time of the file to the given value. If mtime is nil the current time is set.
- // note that the access time of the file always changes to the current time.
- return touch($this->datadir.$path, $mtime);
- }
-
+ public function touch($path, $mtime){
+ // sets the modification time of the file to the given value.
+ // If mtime is nil the current time is set.
+ // note that the access time of the file always changes to the current time.
+ if( touch( $this->datadir.$path, $mtime ) ) {
+ clearstatcache( true, $this->datadir.$path );
+ }
+
+ return touch($this->datadir.$path, $mtime);
+ }
public function file_get_contents($path){
return file_get_contents($this->datadir.$path);
}
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 75997c244ff..90195bc2130 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -345,8 +345,8 @@ class OC_Filesystem{
static public function filemtime($path){
return self::$defaultInstance->filemtime($path);
}
- static public function setFileMtime($path, $mtime){
- return self::$defaultInstance->setFileMtime($path, $mtime);
+ static public function touch($path, $mtime){
+ return self::$defaultInstance->touch($path, $mtime);
}
static public function file_get_contents($path){
return self::$defaultInstance->file_get_contents($path);
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 0f1c546f4c5..91c6cd17720 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -156,8 +156,8 @@ class OC_FilesystemView {
public function filemtime($path){
return $this->basicOperation('filemtime',$path);
}
- public function setFileMtime($path, $mtime){
- return $this->basicOperation('setFileMtime',$path, array('write'), $mtime);
+ public function touch($path, $mtime){
+ return $this->basicOperation('touch', $path, array('write'), $mtime);
}
public function file_get_contents($path){
return $this->basicOperation('file_get_contents',$path,array('read'));