aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-10-25 11:42:16 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-10-25 12:00:57 +0200
commit459477e2c3981d28605f6cb304afedd8ec6f5a3b (patch)
tree6bf49d2463c5001382d9a828deacc882016105cf
parentcfc0d9249bf53449dc8daed9c9811dc78fe7086c (diff)
downloadnextcloud-server-459477e2c3981d28605f6cb304afedd8ec6f5a3b.tar.gz
nextcloud-server-459477e2c3981d28605f6cb304afedd8ec6f5a3b.zip
Move function to LargeFileHelper
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r--lib/private/Files/Storage/Local.php3
-rw-r--r--lib/private/LargeFileHelper.php14
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 97201621645..294e3d0a34c 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -179,7 +179,8 @@ class Local extends \OC\Files\Storage\Common {
return false;
}
if (PHP_INT_SIZE === 4) {
- return (int) exec ('stat -c %Y '. escapeshellarg ($fullPath));
+ $helper = new \OC\LargeFileHelper();
+ return $helper->getFileMtime($fullPath);
}
return filemtime($fullPath);
}
diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php
index 9d0fe864033..b75cdcc210e 100644
--- a/lib/private/LargeFileHelper.php
+++ b/lib/private/LargeFileHelper.php
@@ -187,6 +187,20 @@ class LargeFileHelper {
return $result;
}
+ /**
+ * Returns the current mtime for $fullPath
+ *
+ * @param string $fullPath
+ * @return int
+ */
+ public function getFileMtime($fullPath) {
+ if (\OC_Helper::is_function_enabled('exec')) {
+ return $this->exec('stat -c %Y ' . escapeshellarg($fullPath));
+ }
+
+ return filemtime($fullPath);
+ }
+
protected function exec($cmd) {
$result = trim(exec($cmd));
return ctype_digit($result) ? 0 + $result : null;