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
This commit is contained in:
Robin Appelman 2012-02-29 23:42:40 +01:00 committed by Klaas Freitag
parent f89f3701df
commit 2528778651
4 changed files with 18 additions and 6 deletions

View file

@ -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);
}
}
}
?>
?>

View file

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

View file

@ -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);

View file

@ -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){