Migrate existing files

Permalink Browser Info Environment
I wrote this job to migrate files and figured it could be useful to others. Just make sure you set the correct file storage location ID to load for fromLocation and toLocation. This is written to migrate files in a queue based on the built in Fill thumbnail database table job.

It could probably be fancier and maybe built into the package but it's accomplished what I needed at this time.

Note* the local version of your file will be deleted after it's been moved.

<?php
namespace Application\Job;
use Concrete\Core\Entity\File\File;
use Concrete\Core\File\FileList;
use Concrete\Core\Entity\File\StorageLocation\StorageLocation;
use Concrete\Core\Job\QueueableJob;
use Doctrine\ORM\EntityManagerInterface;
use ZendQueue\Message;
use ZendQueue\Queue;
class S3StoragePush extends QueueableJob
{
    /**
     * @var EntityManagerInterface
     */
    protected $entityManager;

Type: Discussion
Status: Resolved
View Replies:

concrete5 Environment Information

{}

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.