From d9dbed91050e80ab15768c278a1aecdfc3a1efda Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 23 Jan 2023 09:55:03 +0100 Subject: Fix psalm errors related to filesizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/LargeFileHelper.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/private/LargeFileHelper.php') 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); } } } -- cgit v1.2.3