aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/LargeFileHelper.php
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-23 09:55:03 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-02-07 11:23:29 +0100
commitd9dbed91050e80ab15768c278a1aecdfc3a1efda (patch)
tree6b29c1164d64e22f06c426175d0195f1d412a4f0 /lib/private/LargeFileHelper.php
parentff776a90b133fa113c29511a5a7983a7a1a8b73c (diff)
downloadnextcloud-server-d9dbed91050e80ab15768c278a1aecdfc3a1efda.tar.gz
nextcloud-server-d9dbed91050e80ab15768c278a1aecdfc3a1efda.zip
Fix psalm errors related to filesizes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/LargeFileHelper.php')
-rwxr-xr-xlib/private/LargeFileHelper.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php
index c726737a604..2b2fed4e9f1 100755
--- a/lib/private/LargeFileHelper.php
+++ b/lib/private/LargeFileHelper.php
@@ -184,13 +184,10 @@ class LargeFileHelper {
/**
* Returns the current mtime for $fullPath
- *
- * @param string $fullPath
- * @return int
*/
public function getFileMtime(string $fullPath): int {
try {
- $result = filemtime($fullPath);
+ $result = filemtime($fullPath) ?: -1;
} catch (\Exception $e) {
$result = - 1;
}
@@ -198,7 +195,7 @@ class LargeFileHelper {
if (\OCP\Util::isFunctionEnabled('exec')) {
$os = strtolower(php_uname('s'));
if (strpos($os, 'linux') !== false) {
- return $this->exec('stat -c %Y ' . escapeshellarg($fullPath));
+ return (int)($this->exec('stat -c %Y ' . escapeshellarg($fullPath)) ?? -1);
}
}
}