Merge pull request #1890 from nextcloud/downstream-25428
fixing php 32 bit (arm) filemtime on large file issue (#18971) (#25428)
This commit is contained in:
commit
27ba46c40e
|
@ -173,8 +173,16 @@ class Local extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filemtime($path) {
|
public function filemtime($path) {
|
||||||
clearstatcache($this->getSourcePath($path));
|
$fullPath = $this->getSourcePath($path);
|
||||||
return $this->file_exists($path) ? filemtime($this->getSourcePath($path)) : false;
|
clearstatcache($fullPath);
|
||||||
|
if (!$this->file_exists($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (PHP_INT_SIZE === 4) {
|
||||||
|
$helper = new \OC\LargeFileHelper();
|
||||||
|
return $helper->getFileMtime($fullPath);
|
||||||
|
}
|
||||||
|
return filemtime($fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function touch($path, $mtime = null) {
|
public function touch($path, $mtime = null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||||
|
* @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch>
|
||||||
*
|
*
|
||||||
* @author Andreas Fischer <bantu@owncloud.com>
|
* @author Andreas Fischer <bantu@owncloud.com>
|
||||||
* @author Lukas Reschke <lukas@statuscode.ch>
|
* @author Lukas Reschke <lukas@statuscode.ch>
|
||||||
|
@ -177,6 +178,23 @@ class LargeFileHelper {
|
||||||
return $result;
|
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) {
|
protected function exec($cmd) {
|
||||||
$result = trim(exec($cmd));
|
$result = trim(exec($cmd));
|
||||||
return ctype_digit($result) ? 0 + $result : null;
|
return ctype_digit($result) ? 0 + $result : null;
|
||||||
|
|
Loading…
Reference in New Issue