/** * collect all fileinformations of given file and * save them to the global fileinformation array * * @param string $file * @return boolean is valid file? */ protected function setFileInformations($file) { $this->fileInfo = array(); // reset previously information to have a cleaned object $this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL; if (is_string($file) && !empty($file)) { $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file); $this->fileInfo['mtime'] = filemtime($file); $this->fileInfo['atime'] = fileatime($file); $this->fileInfo['owner'] = fileowner($file); $this->fileInfo['group'] = filegroup($file); $this->fileInfo['size'] = filesize($file); $this->fileInfo['type'] = filetype($file); $this->fileInfo['perms'] = fileperms($file); $this->fileInfo['is_dir'] = is_dir($file); $this->fileInfo['is_file'] = is_file($file); $this->fileInfo['is_link'] = is_link($file); $this->fileInfo['is_readable'] = is_readable($file); $this->fileInfo['is_uploaded'] = is_uploaded_file($file); $this->fileInfo['is_writeable'] = is_writeable($file); } if ($file instanceof \TYPO3\CMS\Core\Resource\File) { $pathInfo = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($file->getName()); $this->fileInfo = array('file' => $file->getName(), 'filebody' => $file->getNameWithoutExtension(), 'fileext' => $file->getExtension(), 'realFileext' => $pathInfo['extension'], 'atime' => $file->getCreationTime(), 'mtime' => $file->getModificationTime(), 'owner' => '', 'group' => '', 'size' => $file->getSize(), 'type' => 'file', 'perms' => '', 'is_dir' => FALSE, 'is_file' => $file->getStorage()->getDriverType() === 'Local' ? is_file($file->getForLocalProcessing(FALSE)) : TRUE, 'is_link' => $file->getStorage()->getDriverType() === 'Local' ? is_link($file->getForLocalProcessing(FALSE)) : FALSE, 'is_readable' => TRUE, 'is_uploaded' => FALSE, 'is_writeable' => FALSE); } return $this->fileInfo !== array(); }