From b886d3d645eef8f40c38daebd250b56ae035f37a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 Nov 2014 11:39:58 +0100 Subject: [PATCH 1/5] Make MappedLocal::isLocal() true like for Local Missed in 788c8540aa6aac50795c37b088eeaa561d44b86c --- lib/private/files/storage/mappedlocal.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index 1b26e3ac0f..d749e0e9d5 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -352,6 +352,13 @@ class MappedLocal extends \OC\Files\Storage\Common { return $this->mapper->logicToPhysical($fullPath, true); } + /** + * {@inheritdoc} + */ + public function isLocal() { + return true; + } + /** * @param string $path * @return string From 1062f4fe44229ad186df35729487d3d0f6785682 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 Nov 2014 11:41:11 +0100 Subject: [PATCH 2/5] Check file existance in MappedLocal in hasUpdated() Only fixed in Local by eeee9eacea333035e22ef3ed938e36f56bc762cd --- lib/private/files/storage/mappedlocal.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index d749e0e9d5..6745dad77f 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -337,7 +337,11 @@ class MappedLocal extends \OC\Files\Storage\Common { * @return bool */ public function hasUpdated($path, $time) { - return $this->filemtime($path) > $time; + if ($this->file_exists($path)) { + return $this->filemtime($path) > $time; + } else { + return true; + } } /** From c5427da76d6d01fe9967204d3c019b493ceae6b9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 Nov 2014 11:42:49 +0100 Subject: [PATCH 3/5] Check return of disk_free_space before returning it Local changes copied from ed8359737199a8a6640986e00df80d971aa6e1d7 and 25370fcb8235d2129cab0f8a5843c4784b3673d0 --- lib/private/files/storage/mappedlocal.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index 6745dad77f..e1d234dda1 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -292,7 +292,11 @@ class MappedLocal extends \OC\Files\Storage\Common { } 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) { From 50f85bfd1f0856cd8a3446570d6de4c234685bf6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 Nov 2014 11:45:03 +0100 Subject: [PATCH 4/5] Check whether file exists before trying to touch() it Local changes from d069ee8a8bce6a08d8b7921ad378c60af2a0439e and 258ad38fd3c1e3cdc4ec20238b166e78c334b814 --- lib/private/files/storage/mappedlocal.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index e1d234dda1..f7d448d14a 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -159,6 +159,9 @@ class MappedLocal extends \OC\Files\Storage\Common { // 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 ($this->file_exists($path) and !$this->isUpdatable($path)) { + return false; + } if (!is_null($mtime)) { $result = touch($this->getSourcePath($path), $mtime); } else { From 7761f0288e39c5af1815d783e0f98eeb94759889 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 Nov 2014 11:53:12 +0100 Subject: [PATCH 5/5] Also clearstatcache() in MappedLocal before using the stats Local change 283c10f010f5da4ca0b6b7658ac1fa730b8858bf --- lib/private/files/storage/mappedlocal.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index f7d448d14a..fe6fff4ebd 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -109,6 +109,7 @@ class MappedLocal extends \OC\Files\Storage\Common { } public function stat($path) { + clearstatcache(); $fullPath = $this->getSourcePath($path); $statResult = stat($fullPath); if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {