protected function moveBetweenFileStore(
        ParsedFileID $parsedFileID,
        Filesystem $from,
        FileResolutionStrategy $fromStrategy,
        Filesystem $to,
        FileResolutionStrategy $toStrategy,
        $swap = false
    ) {
        // Let's find all the variants on the origin store ... those need to be moved to the destination
        /** @var ParsedFileID $variantParsedFileID */
        foreach ($fromStrategy->findVariants($parsedFileID, $from) as $variantParsedFileID) {
            // Copy via stream
            $fromFileID = $variantParsedFileID->getFileID();
            $toFileID = $toStrategy->buildFileID($variantParsedFileID);

            $stream = $from->readStream($fromFileID);
            $to->putStream($toFileID, $stream);
            if (is_resource($stream)) {
                fclose($stream);
            }

            // Remove the origin file and keep the file ID
            $idsToDelete[] = $fromFileID;
            $from->delete($fromFileID);
            $this->truncateDirectory(dirname($fromFileID), $from);
        }
    }
protected function moveBetweenFileStore(
        ParsedFileID $parsedFileID,
        Filesystem $from,
        FileResolutionStrategy $fromStrategy,
        Filesystem $to,
        FileResolutionStrategy $toStrategy,
        $swap = false
    ) {
        // Let's find all the variants on the origin store ... those need to be moved to the destination
        /** @var ParsedFileID $variantParsedFileID */
        foreach ($fromStrategy->findVariants($parsedFileID, $from) as $variantParsedFileID) {
            // Copy via stream
            $fromFileID = $variantParsedFileID->getFileID();
            $toFileID = $toStrategy->buildFileID($variantParsedFileID);

            $stream = $from->readStream($fromFileID);
            $to->putStream($toFileID, $stream);
            if (is_resource($stream)) {
                fclose($stream);
            }

            // Remove the origin file and keep the file ID
            $idsToDelete[] = $fromFileID;
            $from->delete($fromFileID);
            $this->truncateDirectory(dirname($fromFileID), $from);
        }
    }
protected function moveBetweenFileStore ( ParsedFileID $ parsedFileID , Filesystem $ from , FileResolutionStrategy $ fromStrategy , Filesystem $ to , FileResolutionStrategy $ toStrategy , $ swap = false ) { // Let's find all the variants on the origin store ... those need to be moved to the destination /** @var ParsedFileID $variantParsedFileID */ foreach ( $ fromStrategy -> findVariants ( $ parsedFileID , $ from ) as $ variantParsedFileID ) { // Copy via stream $ fromFileID = $ variantParsedFileID -> getFileID ( ) ; $ toFileID = $ toStrategy -> buildFileID ( $ variantParsedFileID ) ; $ stream = $ from -> readStream ( $ fromFileID ) ; $ to -> putStream ( $ toFileID , $ stream ) ; if ( is_resource ( $ stream ) ) { fclose ( $ stream ) ; } // Remove the origin file and keep the file ID $ idsToDelete [ ] = $ fromFileID ; $ from -> delete ( $ fromFileID ) ; $ this -> truncateDirectory ( dirname ( $ fromFileID ) , $ from ) ; } }
Move a file and its associated variant from one file store to another adjusting the file name format.
@param ParsedFileID $parsedFileID
@param Filesystem $from
@param FileResolutionStrategy $fromStrategy
@param Filesystem $to
@param FileResolutionStrategy $toStrategy
Move a file and its associated variant from one file store to another adjusting the file name format .