concrete/src/Entity/File/Version.php
public function duplicateUnderlyingFile()
    {
        $app = Application::getFacadeApplication();
        $importer = new Importer();
        $cf = $app->make('helper/concrete/file');
        $filesystem = $this->getFile()->getFileStorageLocationObject()->getFileSystemObject();
        $fileName = $this->getFileName();
        do {
            $prefix = $importer->generatePrefix();
            $path = $cf->prefix($prefix, $fileName);
        } while ($filesystem->has($path));
        $fileContents = $this->getFileResource()->read();
        $mimeType = Util::guessMimeType($fileName, $fileContents);
        $filesystem->write(
            $path,
            $fileContents,
            [
                'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
                'mimetype' => $mimeType,
            ]
        );
        $this->updateFile($fileName, $prefix);
    }
public function duplicateUnderlyingFile()
    {
        $app = Application::getFacadeApplication();
        $importer = new Importer();
        $cf = $app->make('helper/concrete/file');
        $filesystem = $this->getFile()->getFileStorageLocationObject()->getFileSystemObject();
        $fileName = $this->getFileName();
        do {
            $prefix = $importer->generatePrefix();
            $path = $cf->prefix($prefix, $fileName);
        } while ($filesystem->has($path));
        $fileContents = $this->getFileResource()->read();
        $mimeType = Util::guessMimeType($fileName, $fileContents);
        $filesystem->write(
            $path,
            $fileContents,
            [
                'visibility' => AdapterInterface::VISIBILITY_PUBLIC,
                'mimetype' => $mimeType,
            ]
        );
        $this->updateFile($fileName, $prefix);
    }
public function duplicateUnderlyingFile ( ) { $ app = Application :: getFacadeApplication ( ) ; $ importer = new Importer ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; $ filesystem = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> getFileSystemObject ( ) ; $ fileName = $ this -> getFileName ( ) ; do { $ prefix = $ importer -> generatePrefix ( ) ; $ path = $ cf -> prefix ( $ prefix , $ fileName ) ; } while ( $ filesystem -> has ( $ path ) ) ; $ fileContents = $ this -> getFileResource ( ) -> read ( ) ; $ mimeType = Util :: guessMimeType ( $ fileName , $ fileContents ) ; $ filesystem -> write ( $ path , $ fileContents , [ 'visibility' => AdapterInterface :: VISIBILITY_PUBLIC , 'mimetype' => $ mimeType , ] ) ; $ this -> updateFile ( $ fileName , $ prefix ) ; }
Duplicate the underlying file and assign its new position to this instance.
Duplicate the underlying file and assign its new position to this instance .