chore: cleanup
This commit is contained in:
@@ -58,11 +58,6 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
$connection: '@doctrine.dbal.default_connection'
|
$connection: '@doctrine.dbal.default_connection'
|
||||||
|
|
||||||
App\Command\GenerateThumbnailsCommand:
|
|
||||||
arguments:
|
|
||||||
$cacheManager: '@liip_imagine.cache.manager'
|
|
||||||
$filterService: '@liip_imagine.service.filter'
|
|
||||||
|
|
||||||
App\BusProNet\ApiClient:
|
App\BusProNet\ApiClient:
|
||||||
arguments:
|
arguments:
|
||||||
$logger: '@monolog.logger.bpn'
|
$logger: '@monolog.logger.bpn'
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Command;
|
|
||||||
|
|
||||||
use App\Entity\Teamer;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
|
||||||
use Liip\ImagineBundle\Service\FilterService;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
||||||
|
|
||||||
#[AsCommand(
|
|
||||||
name: 'app:generate-thumbnails',
|
|
||||||
description: 'Generates thumbnails of profile images',
|
|
||||||
)]
|
|
||||||
class GenerateThumbnailsCommand extends Command
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly EntityManagerInterface $entityManager,
|
|
||||||
private readonly CacheManager $cacheManager,
|
|
||||||
private readonly FilterService $filterService,
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
||||||
{
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
|
||||||
|
|
||||||
$images = $this
|
|
||||||
->entityManager
|
|
||||||
->getRepository(Teamer::class)
|
|
||||||
->createQueryBuilder('t')
|
|
||||||
->select('t.id', 'p.filename')
|
|
||||||
->innerJoin('t.photo', 'p')
|
|
||||||
->getQuery()
|
|
||||||
->getArrayResult()
|
|
||||||
;
|
|
||||||
|
|
||||||
$imagesCount = count($images);
|
|
||||||
|
|
||||||
$io->info('Generating thumbnails for '.$imagesCount.' profile images...');
|
|
||||||
|
|
||||||
$progressbar = $io->createProgressBar($imagesCount);
|
|
||||||
$progressbar->start();
|
|
||||||
|
|
||||||
foreach ($images as $image) {
|
|
||||||
try {
|
|
||||||
$this->filterService->warmUpCache($image['filename'], 'thumbnail');
|
|
||||||
$this->filterService->warmUpCache($image['filename'], 'profile');
|
|
||||||
$this->cacheManager->getBrowserPath($image['filename'], 'thumbnail');
|
|
||||||
$this->cacheManager->getBrowserPath($image['filename'], 'profile');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
$progressbar->advance();
|
|
||||||
}
|
|
||||||
|
|
||||||
$progressbar->finish();
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,6 @@ class AppRuntime implements RuntimeExtensionInterface
|
|||||||
private readonly CountryDataProvider $countries,
|
private readonly CountryDataProvider $countries,
|
||||||
private readonly PickupDataProvider $pickups,
|
private readonly PickupDataProvider $pickups,
|
||||||
private readonly PickupResolver $pickupResolver,
|
private readonly PickupResolver $pickupResolver,
|
||||||
private readonly UploadHandler $uploadHandler,
|
|
||||||
private readonly string $environment,
|
private readonly string $environment,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user