Skip to content

Commit 34aa816

Browse files
solracsfkesselb
authored andcommitted
Fix timestamp detection on external FTP
Context: #31510 Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent f635609 commit 34aa816

File tree

1 file changed

+6
-8
lines changed
  • apps/files_external/lib/Lib/Storage

1 file changed

+6
-8
lines changed

apps/files_external/lib/Lib/Storage/FTP.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ public function __construct($params) {
5050
$this->username = $params['user'];
5151
$this->password = $params['password'];
5252
if (isset($params['secure'])) {
53-
if (is_string($params['secure'])) {
54-
$this->secure = ($params['secure'] === 'true');
55-
} else {
56-
$this->secure = (bool)$params['secure'];
57-
}
53+
$this->secure = is_string($params['secure']) ? ($params['secure'] === 'true') : (bool) $params['secure'];
5854
} else {
5955
$this->secure = false;
6056
}
@@ -355,10 +351,12 @@ public function getDirectoryContent($directory): \Traversable {
355351

356352
$data = [];
357353
$data['mimetype'] = $isDir ? FileInfo::MIMETYPE_FOLDER : $mimeTypeDetector->detectPath($name);
358-
$data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp();
359-
if ($data['mtime'] === false) {
354+
$modifyDate = \DateTime::createFromFormat('YmdGis', $file['modify']);
355+
if ($modifyDate === false) {
360356
$data['mtime'] = time();
361-
}
357+
} else {
358+
$data['mtime'] = $modifyDate->getTimestamp();
359+
}
362360
if ($isDir) {
363361
$data['size'] = -1; //unknown
364362
} elseif (isset($file['size'])) {

0 commit comments

Comments
 (0)