[Pkg-owncloud-commits] [owncloud] 72/75: renamed the function to modify mtime of files to touch.

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:08:45 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v3.0.1
in repository owncloud.

commit f89f3701dfd6c3e240b7cf792e3c151927ec9724
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Feb 29 23:42:40 2012 +0100

    renamed the function to modify mtime of files to touch.
---
 lib/connector/sabre/node.php |   12 ++++--------
 lib/filestorage/local.php    |   17 ++++++++++-------
 lib/filesystem.php           |    4 ++--
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index b8b675c..41acb48 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 a94098b..71eccb5 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -70,13 +70,16 @@ class OC_Filestorage_Local extends OC_Filestorage{
 	public function fileatime($path){
 		return fileatime($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 e92dc7d..986dfea 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -369,8 +369,8 @@ class OC_Filesystem{
 	static public function fileatime($path){
 		return self::basicOperation('fileatime',$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::basicOperation('file_get_contents',$path,array('read'));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list