[Pkg-owncloud-commits] [owncloud] 73/75: add touch() to all storage backands, and make parameter optional

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 252877865104c4d455249ade5ae7de737d69a2f3
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Feb 29 23:42:40 2012 +0100

    add touch() to all storage backands, and make  parameter optional
    
    Conflicts:
    
    	lib/filestorage.php
    	lib/filestorage/common.php
    	lib/filestorage/commontest.php
    	lib/filestorage/local.php
    	lib/filesystemview.php
---
 apps/files_sharing/sharedstorage.php |   10 ++++++++--
 lib/filestorage.php                  |    1 +
 lib/filestorage/local.php            |   11 ++++++++---
 lib/filesystem.php                   |    2 +-
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index b0eaeec..bbb245a 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -569,7 +569,13 @@ class OC_Filestorage_Shared extends OC_Filestorage {
 			return $storage->getLocalFile($this->getInternalPath($source));
 		}
 	}
-	
+	public function touch($path, $mtime=null){
+		$source = $this->getSource($path);
+		if ($source) {
+			$storage = OC_Filesystem::getStorage($source);
+			return $storage->touch($this->getInternalPath($source),$time);
+		}
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 34fa645..d6197b8 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -53,5 +53,6 @@ class OC_Filestorage{
 	public function hash($type,$path,$raw){}
 	public function free_space($path){}
 	public function search($query){}
+	public function touch($path, $mtime=null){}
 	public function getLocalFile($path){}// get a path to a local version of the file, whether the original file is local or remote
 }
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 71eccb5..ccf5763 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -70,15 +70,20 @@ class OC_Filestorage_Local extends OC_Filestorage{
 	public function fileatime($path){
 		return fileatime($this->datadir.$path);
 	}
-	public function touch($path, $mtime){
+	public function touch($path, $mtime=null){
 		// 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 ) ) {
+		if(!is_null($mtime)){
+			$result=touch( $this->datadir.$path, $mtime );
+		}else{
+			$result=touch( $this->datadir.$path);
+		}
+		if( $result ) {
 			clearstatcache( true, $this->datadir.$path );
 		}
 		
-		return touch($this->datadir.$path, $mtime);
+		return $result;
 	}
 	public function file_get_contents($path){
 		return file_get_contents($this->datadir.$path);
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 986dfea..4dfdbc7 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -369,7 +369,7 @@ class OC_Filesystem{
 	static public function fileatime($path){
 		return self::basicOperation('fileatime',$path);
 	}
-	static public function touch($path, $mtime){
+	static public function touch($path, $mtime=null){
 		return self::$defaultInstance->touch($path, $mtime);
 	}
 	static public function file_get_contents($path){

-- 
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