/** * @param string $identifier * @return array * @SuppressWarnings(PHPMD.Superglobals) */ public function getDetails($identifier) { $details = []; $details['size'] = $this->sftp->size($identifier); $details['atime'] = $this->sftp->fileatime($identifier); $details['mtime'] = $this->sftp->filemtime($identifier); // ctime is not returned by phpseclinb so we just use mtime // because it will mostly be the same. // @see http://www.linux-faqs.info/general/difference-between-mtime-ctime-and-atime $details['ctime'] = $details['mtime']; $mimeType = false; if ($this->sftp->is_file($identifier)) { $fileExtMapping = $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType']; $lcFileExtension = strtolower(substr($identifier, strrpos($identifier, '.') + 1)); if (!empty($fileExtMapping[$lcFileExtension])) { $mimeType = $fileExtMapping[$lcFileExtension]; } } if (false === $mimeType && isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuessers']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuesser'])) { $mimeTypeGuessers = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FileInfo::class]['mimeTypeGuesser']; foreach ($mimeTypeGuessers as $mimeTypeGuesser) { $hookParameters = ['mimeType' => &$mimeType]; GeneralUtility::callUserFunction($mimeTypeGuesser, $hookParameters, $this); } } $details['mimetype'] = $mimeType; return $details; }