Closed lbcd closed 8 months ago
Hi, thank you for the idea.
There is no such feature within the bundle itself, but you can easily do it on your own. You can register an event listener at the very end of the dump command, then send your files to S3, something like this:
<?php
declare(strict_types=1);
namespace App\Sitemap;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: ConsoleEvents::TERMINATE, method: 'onConsoleTerminate')]
final class SendSitemapToCdnListener
{
public function onConsoleTerminate(ConsoleTerminateEvent $event): void
{
if ($event->getCommand()?->getName() !== 'presta:sitemaps:dump') {
return;
}
$files = \glob(__DIR__ . '/../../public/sitemap.*');
// todo send $files to your CDN
}
}
Might end in a documentation section, if someone experienced such feature on a project But I'm not sure we will ever do something like this IN the bundle
Description
Is it possible to push file on S3 / Minio storage ? Could be interfaced using flysystem