summaryrefslogtreecommitdiffstats
path: root/lib/private/LargeFileHelper.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-25 14:44:27 +0200
committerGitHub <noreply@github.com>2016-10-25 14:44:27 +0200
commit27ba46c40ed1d365965a1cb79ed7d8a38d759d2c (patch)
treee3ca5b0f5229fe50ff25665e955f23205cee0e53 /lib/private/LargeFileHelper.php
parent01a85a98f2acebe01b2af7bffb7e0a7dab7c121a (diff)
parent62bb991050b20b443f8f11cf04e0a331648d2519 (diff)
downloadnextcloud-server-27ba46c40ed1d365965a1cb79ed7d8a38d759d2c.tar.gz
nextcloud-server-27ba46c40ed1d365965a1cb79ed7d8a38d759d2c.zip
Merge pull request #1890 from nextcloud/downstream-25428
fixing php 32 bit (arm) filemtime on large file issue (#18971) (#25428)
Diffstat (limited to 'lib/private/LargeFileHelper.php')
-rw-r--r--lib/private/LargeFileHelper.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php
index 4363fb42cc6..9f18a6acd6b 100644
--- a/lib/private/LargeFileHelper.php
+++ b/lib/private/LargeFileHelper.php
@@ -1,6 +1,7 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch>
*
* @author Andreas Fischer <bantu@owncloud.com>
* @author Lukas Reschke <lukas@statuscode.ch>
@@ -177,6 +178,23 @@ 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')) {
+ $os = strtolower(php_uname('s'));
+ if (strpos($os, 'linux') !== false) {
+ 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;