concrete/src/Entity/File/Version.php
public function refreshAttributes($rescanThumbnails = true)
    {
        $app = Application::getFacadeApplication();

        $storage = $this->getFile()->getFileStorageLocationObject();
        if ($storage !== null) {
            $fs = $storage->getFileSystemObject();
            $adapter = $fs->getAdapter();
            if ($adapter instanceof CachedAdapter) {
                $cache = $adapter->getCache();
                $cf = $app->make('helper/concrete/file');
                $path = Util::normalizePath($cf->prefix($this->fvPrefix, $this->fvFilename));
                $cache->delete($path);
            }
        }

        $em = $app->make(EntityManagerInterface::class);
        $fh = $app->make('helper/file');
        $ext = $fh->getExtension($this->fvFilename);
        $ftl = FileTypeList::getType($ext);

        $cl = $ftl->getCustomInspector();
        if ($cl !== null) {
            $this->fvGenericType = $ftl->getGenericType();
            $cl->inspect($this);
        }

        $em->refresh($this);

        try {
            $fsr = $this->getFileResource();
            if (!$fsr->isFile()) {
                return Importer::E_FILE_INVALID;
            }
        } catch (FileNotFoundException $e) {
            return Importer::E_FILE_INVALID;
        }

        $this->fvExtension = $ext;
        $this->fvType = $ftl->getGenericType();
        if ($this->fvTitle === null) {
            $this->fvTitle = $this->getFileName();
        }
        $this->fvSize = $fsr->getSize();

        if ($rescanThumbnails) {
            $this->rescanThumbnails();
        }

        $this->save();

        $f = $this->getFile();
        $f->reindex();
    }
public function refreshAttributes($rescanThumbnails = true)
    {
        $app = Application::getFacadeApplication();

        $storage = $this->getFile()->getFileStorageLocationObject();
        if ($storage !== null) {
            $fs = $storage->getFileSystemObject();
            $adapter = $fs->getAdapter();
            if ($adapter instanceof CachedAdapter) {
                $cache = $adapter->getCache();
                $cf = $app->make('helper/concrete/file');
                $path = Util::normalizePath($cf->prefix($this->fvPrefix, $this->fvFilename));
                $cache->delete($path);
            }
        }

        $em = $app->make(EntityManagerInterface::class);
        $fh = $app->make('helper/file');
        $ext = $fh->getExtension($this->fvFilename);
        $ftl = FileTypeList::getType($ext);

        $cl = $ftl->getCustomInspector();
        if ($cl !== null) {
            $this->fvGenericType = $ftl->getGenericType();
            $cl->inspect($this);
        }

        $em->refresh($this);

        try {
            $fsr = $this->getFileResource();
            if (!$fsr->isFile()) {
                return Importer::E_FILE_INVALID;
            }
        } catch (FileNotFoundException $e) {
            return Importer::E_FILE_INVALID;
        }

        $this->fvExtension = $ext;
        $this->fvType = $ftl->getGenericType();
        if ($this->fvTitle === null) {
            $this->fvTitle = $this->getFileName();
        }
        $this->fvSize = $fsr->getSize();

        if ($rescanThumbnails) {
            $this->rescanThumbnails();
        }

        $this->save();

        $f = $this->getFile();
        $f->reindex();
    }
public function refreshAttributes ( $ rescanThumbnails = true ) { $ app = Application :: getFacadeApplication ( ) ; $ storage = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) ; if ( $ storage !== null ) { $ fs = $ storage -> getFileSystemObject ( ) ; $ adapter = $ fs -> getAdapter ( ) ; if ( $ adapter instanceof CachedAdapter ) { $ cache = $ adapter -> getCache ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; $ path = Util :: normalizePath ( $ cf -> prefix ( $ this -> fvPrefix , $ this -> fvFilename ) ) ; $ cache -> delete ( $ path ) ; } } $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ fh = $ app -> make ( 'helper/file' ) ; $ ext = $ fh -> getExtension ( $ this -> fvFilename ) ; $ ftl = FileTypeList :: getType ( $ ext ) ; $ cl = $ ftl -> getCustomInspector ( ) ; if ( $ cl !== null ) { $ this -> fvGenericType = $ ftl -> getGenericType ( ) ; $ cl -> inspect ( $ this ) ; } $ em -> refresh ( $ this ) ; try { $ fsr = $ this -> getFileResource ( ) ; if ( ! $ fsr -> isFile ( ) ) { return Importer :: E_FILE_INVALID ; } } catch ( FileNotFoundException $ e ) { return Importer :: E_FILE_INVALID ; } $ this -> fvExtension = $ ext ; $ this -> fvType = $ ftl -> getGenericType ( ) ; if ( $ this -> fvTitle === null ) { $ this -> fvTitle = $ this -> getFileName ( ) ; } $ this -> fvSize = $ fsr -> getSize ( ) ; if ( $ rescanThumbnails ) { $ this -> rescanThumbnails ( ) ; } $ this -> save ( ) ; $ f = $ this -> getFile ( ) ; $ f -> reindex ( ) ; }
Rescan all the attributes of this file version.
This will run any type-based import routines, and store those attributes, generate thumbnails, etc...

@param bool $rescanThumbnails Should thumbnails be rescanned as well?

@return null|int Return one of the \Concrete\Core\File\Importer::E_... constants in case of errors, NULL otherwise.
Rescan all the attributes of this file version . This will run any type - based import routines and store those attributes generate thumbnails etc ...