Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGit'Fellow <carlos@reendex.com>2022-07-11 20:31:48 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2022-11-13 23:47:50 +0300
commitb83b33d0d05a535ad60fb10d7f12835ce742c853 (patch)
treee5793d263a594ac2f661a6216d265152a114b939
parent87105a21d4982935eb4346fcc19898a946c87c60 (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>
-rw-r--r--apps/files_external/lib/Lib/Storage/FTP.php14
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'])) {