concrete/src/Entity/File/Version.php
public function updateContents($contents, $rescanThumbnails = true)
    {
        $this->releaseImagineImage();
        $storage = $this->getFile()->getFileStorageLocationObject();
        if ($storage !== null) {
            $app = Application::getFacadeApplication();
            $cf = $app->make('helper/concrete/file');
            $path = $cf->prefix($this->fvPrefix, $this->fvFilename);
            $filesystem = $storage->getFileSystemObject();
            try {
                if ($filesystem->has($path)) {
                    $filesystem->delete($path);
                }
            } catch (FileNotFoundException $x) {
            }
            $filesystem->write($path, $contents);
            $this->logVersionUpdate(self::UT_CONTENTS);
            $fve = new FileVersionEvent($this);
            $app->make(EventDispatcherInterface::class)->dispatch('on_file_version_update_contents', $fve);
            $this->refreshAttributes($rescanThumbnails);
        }
    }
public function updateContents($contents, $rescanThumbnails = true)
    {
        $this->releaseImagineImage();
        $storage = $this->getFile()->getFileStorageLocationObject();
        if ($storage !== null) {
            $app = Application::getFacadeApplication();
            $cf = $app->make('helper/concrete/file');
            $path = $cf->prefix($this->fvPrefix, $this->fvFilename);
            $filesystem = $storage->getFileSystemObject();
            try {
                if ($filesystem->has($path)) {
                    $filesystem->delete($path);
                }
            } catch (FileNotFoundException $x) {
            }
            $filesystem->write($path, $contents);
            $this->logVersionUpdate(self::UT_CONTENTS);
            $fve = new FileVersionEvent($this);
            $app->make(EventDispatcherInterface::class)->dispatch('on_file_version_update_contents', $fve);
            $this->refreshAttributes($rescanThumbnails);
        }
    }
public function updateContents ( $ contents , $ rescanThumbnails = true ) { $ this -> releaseImagineImage ( ) ; $ storage = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) ; if ( $ storage !== null ) { $ app = Application :: getFacadeApplication ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; $ path = $ cf -> prefix ( $ this -> fvPrefix , $ this -> fvFilename ) ; $ filesystem = $ storage -> getFileSystemObject ( ) ; try { if ( $ filesystem -> has ( $ path ) ) { $ filesystem -> delete ( $ path ) ; } } catch ( FileNotFoundException $ x ) { } $ filesystem -> write ( $ path , $ contents ) ; $ this -> logVersionUpdate ( self :: UT_CONTENTS ) ; $ fve = new FileVersionEvent ( $ this ) ; $ app -> make ( EventDispatcherInterface :: class ) -> dispatch ( 'on_file_version_update_contents' , $ fve ) ; $ this -> refreshAttributes ( $ rescanThumbnails ) ; } }
Update the contents of the file.

@param string $contents The new content of the file
@param bool $rescanThumbnails Should thumbnails be rescanned as well?
Update the contents of the file .