protected function setFileInformations($file)
    {
        $this->fileInfo = array(); // reset previously information to have a cleaned object
        if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
            $this->file = $file;
        } elseif ($file instanceof \TYPO3\CMS\Core\Resource\FileReference) {
            $this->file = $file = $file->getOriginalFile();
        }

        if (is_string($file) && !empty($file)) {
            $this->fileInfo = 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();
    }
protected function setFileInformations($file)
    {
        $this->fileInfo = array(); // reset previously information to have a cleaned object
        if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
            $this->file = $file;
        } elseif ($file instanceof \TYPO3\CMS\Core\Resource\FileReference) {
            $this->file = $file = $file->getOriginalFile();
        }

        if (is_string($file) && !empty($file)) {
            $this->fileInfo = 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();
    }
protected function setFileInformations ( $ file ) { $ this -> fileInfo = array ( ) ; // reset previously information to have a cleaned object if ( $ file instanceof \ TYPO3 \ CMS \ Core \ Resource \ File ) { $ this -> file = $ file ; } elseif ( $ file instanceof \ TYPO3 \ CMS \ Core \ Resource \ FileReference ) { $ this -> file = $ file = $ file -> getOriginalFile ( ) ; } if ( is_string ( $ file ) && ! empty ( $ file ) ) { $ this -> fileInfo = 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 ( ) ; }
collect all fileinformations of given file and
save them to the global fileinformation array
@param string $file
@return boolean is valid file?
collect all fileinformations of given file and save them to the global fileinformation array