Merge pull request #12469 from owncloud/issue/12460-port-local-changes2mapped

Issue/12460 port local changes2mapped
This commit is contained in:
Vincent Petry 2014-12-01 10:42:39 +01:00
commit 8db4dd7585
1 changed files with 21 additions and 2 deletions

View File

@ -109,6 +109,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
} }
public function stat($path) { public function stat($path) {
clearstatcache();
$fullPath = $this->getSourcePath($path); $fullPath = $this->getSourcePath($path);
$statResult = stat($fullPath); $statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) { if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
@ -159,6 +160,9 @@ class MappedLocal extends \OC\Files\Storage\Common {
// sets the modification time of the file to the given value. // sets the modification time of the file to the given value.
// If mtime is nil the current time is set. // If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time. // note that the access time of the file always changes to the current time.
if ($this->file_exists($path) and !$this->isUpdatable($path)) {
return false;
}
if (!is_null($mtime)) { if (!is_null($mtime)) {
$result = touch($this->getSourcePath($path), $mtime); $result = touch($this->getSourcePath($path), $mtime);
} else { } else {
@ -292,7 +296,11 @@ class MappedLocal extends \OC\Files\Storage\Common {
} }
public function free_space($path) { public function free_space($path) {
return @disk_free_space($this->getSourcePath($path)); $space = @disk_free_space($this->getSourcePath($path));
if ($space === false || is_null($space)) {
return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
return $space;
} }
public function search($query) { public function search($query) {
@ -337,7 +345,11 @@ class MappedLocal extends \OC\Files\Storage\Common {
* @return bool * @return bool
*/ */
public function hasUpdated($path, $time) { public function hasUpdated($path, $time) {
return $this->filemtime($path) > $time; if ($this->file_exists($path)) {
return $this->filemtime($path) > $time;
} else {
return true;
}
} }
/** /**
@ -352,6 +364,13 @@ class MappedLocal extends \OC\Files\Storage\Common {
return $this->mapper->logicToPhysical($fullPath, true); return $this->mapper->logicToPhysical($fullPath, true);
} }
/**
* {@inheritdoc}
*/
public function isLocal() {
return true;
}
/** /**
* @param string $path * @param string $path
* @return string * @return string