summaryrefslogtreecommitdiffstats
path: root/lib/filestorage.php
diff options
context:
space:
mode:
authorMatthew Dawson <matthew@mjdsystems.ca>2011-03-11 12:03:30 -0500
committerRobin Appelman <icewind1991@gmail.com>2011-03-17 20:57:28 +0100
commitf2627dd7578f33ca5ab392164cb29714ebff1f6b (patch)
tree85c68b3d12a30783134e3da6afbf4549ecf63ecb /lib/filestorage.php
parent49a78333fb4d9b5473ab82aca28d500b80739bde (diff)
downloadnextcloud-server-f2627dd7578f33ca5ab392164cb29714ebff1f6b.tar.gz
nextcloud-server-f2627dd7578f33ca5ab392164cb29714ebff1f6b.zip
When moving a file from/to a temporary location, also update the file access/modification times.
When PHP moves a file across filesystem boundaries, it does not update the access/modification times. Thus do it manually so that this information is not lost.
Diffstat (limited to 'lib/filestorage.php')
-rw-r--r--lib/filestorage.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 3a0d124cbf2..68f232d3a60 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -360,7 +360,9 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
public function toTmpFile($path){
$tmpFolder=sys_get_temp_dir();
$filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.')));
+ $fileStats = stat($this->datadir.$path);
if(copy($this->datadir.$path,$filename)){
+ touch($filename, $fileStats['mtime'], $fileStats['atime']);
$this->notifyObservers($path,OC_FILEACTION_READ);
return $filename;
}else{
@@ -369,7 +371,9 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
public function fromTmpFile($tmpFile,$path){
+ $fileStats = stat($tmpFile);
if(rename($tmpFile,$this->datadir.$path)){
+ touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']);
$this->notifyObservers($path,OC_FILEACTION_CREATE);
return true;
}else{