From 459477e2c3981d28605f6cb304afedd8ec6f5a3b Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 25 Oct 2016 11:42:16 +0200 Subject: Move function to LargeFileHelper Signed-off-by: Lukas Reschke --- lib/private/LargeFileHelper.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/private/LargeFileHelper.php') 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; -- cgit v1.2.3 From 62bb991050b20b443f8f11cf04e0a331648d2519 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 25 Oct 2016 12:01:03 +0200 Subject: Add check for linux os Signed-off-by: Lukas Reschke --- lib/private/LargeFileHelper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/private/LargeFileHelper.php') diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index b75cdcc210e..258e53acf9d 100644 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -1,6 +1,7 @@ * * @author Andreas Fischer * @author Lukas Reschke @@ -195,7 +196,10 @@ class LargeFileHelper { */ public function getFileMtime($fullPath) { if (\OC_Helper::is_function_enabled('exec')) { - return $this->exec('stat -c %Y ' . escapeshellarg($fullPath)); + $os = strtolower(php_uname('s')); + if (strpos($os, 'linux') !== false) { + return $this->exec('stat -c %Y ' . escapeshellarg($fullPath)); + } } return filemtime($fullPath); -- cgit v1.2.3