diff options
author | Git'Fellow <carlos@reendex.com> | 2022-07-11 20:31:48 +0300 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2022-11-13 23:47:50 +0300 |
commit | b83b33d0d05a535ad60fb10d7f12835ce742c853 (patch) | |
tree | e5793d263a594ac2f661a6216d265152a114b939 /apps/files_external | |
parent | 87105a21d4982935eb4346fcc19898a946c87c60 (diff) |
Fix timestamp detection on external FTPfix-ftp-timestamp
Context: https://github.com/nextcloud/server/issues/31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FTP.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 0350035a11a..e3147d28845 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -50,11 +50,7 @@ class FTP extends Common { $this->username = $params['user']; $this->password = $params['password']; if (isset($params['secure'])) { - if (is_string($params['secure'])) { - $this->secure = ($params['secure'] === 'true'); - } else { - $this->secure = (bool)$params['secure']; - } + $this->secure = is_string($params['secure']) ? ($params['secure'] === 'true') : (bool) $params['secure']; } else { $this->secure = false; } @@ -355,10 +351,12 @@ class FTP extends Common { $data = []; $data['mimetype'] = $isDir ? FileInfo::MIMETYPE_FOLDER : $mimeTypeDetector->detectPath($name); - $data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp(); - if ($data['mtime'] === false) { + $modifyDate = \DateTime::createFromFormat('YmdGis', $file['modify']); + if ($modifyDate === false) { $data['mtime'] = time(); - } + } else { + $data['mtime'] = $modifyDate->getTimestamp(); + } if ($isDir) { $data['size'] = -1; //unknown } elseif (isset($file['size'])) { |