migrateFile example

/** * Used as internal check for the liveMigration config flag. * * @param string $path */
    private function migrateFileLive($path)
    {
        if (!$this->container->getParameter('shopware.cdn.liveMigration')) {
            return;
        }

        $this->migrateFile($path);
    }
}

    private function migrateFile($path, MediaServiceInterface $fromFilesystem, MediaServiceInterface $toFileSystem)
    {
        // only do migration if it's on the local filesystem since could take a long time         // to read and write all the files         if ($fromFilesystem->getAdapterType() === 'local') {
            if (!$fromFilesystem->isEncoded($path)) {
                ++$this->counter['migrated'];
                $fromFilesystem->migrateFile($path);
            }
        }

        // file already exists         if ($toFileSystem->has($path)) {
            ++$this->counter['skipped'];

            return;
        }

        // move file to new filesystem and remove the old one
Home | Imprint | This part of the site doesn't use cookies.