Skip to content

Commit

Permalink
Merge pull request #583 from ChuckCCW/feature/SANTA-222-PHP
Browse files Browse the repository at this point in the history
Feature/santa 222 php
  • Loading branch information
tvlooy authored Oct 17, 2024
2 parents fd5dc63 + 6bb9c82 commit 198477c
Show file tree
Hide file tree
Showing 39 changed files with 208 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
extensions: apcu
- name: Configure recaptcha secrets
run: cp config/recaptcha_secrets.json.dist config/recaptcha_secrets.json
Expand Down
4 changes: 2 additions & 2 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ excludes:
- var/cache
- node_modules
config:
php: '8.2'
php: '8.3'
config:
php: lando/php/php.ini
vhosts: lando/apache/000-default.conf
Expand All @@ -21,7 +21,7 @@ services:
- 'apt-get update'
- '/bin/bash /app/shell_provisioner/run.sh'
overrides:
image: 'devwithlando/php:8.2-apache-4'
image: 'devwithlando/php:8.3-apache-4'
build:
context: ./lando
dockerfile: Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "project",
"license": "proprietary",
"require": {
"php": "^8.2",
"php": "^8.3",
"ext-apcu": "*",
"ext-ctype": "*",
"ext-iconv": "*",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ framework:
secret: '%env(APP_SECRET)%'
csrf_protection: true
http_method_override: true
handle_all_throwables: true

translator: { fallback: "%locale%" }
default_locale: "%locale%"
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ chmod -R a+rwX var/log var/cache
printOk

printAction "Stopping FPM"
sudo systemctl stop php8.2-fpm
sudo systemctl stop php8.3-fpm
printOk
#printAction "Running doctrine schema update"
#bin/console doctrine:schema:update --force ${Q}
Expand All @@ -77,7 +77,7 @@ printAction "Activate new version"
ln -sfn releases/${VERSION} current
printOk
printAction "Starting FPM"
sudo systemctl start php8.2-fpm
sudo systemctl start php8.3-fpm
printOk

printAction "Cleanup old versions, keep last 2"
Expand Down
2 changes: 1 addition & 1 deletion lando/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM devwithlando/php:8.2-apache-4
FROM devwithlando/php:8.3-apache-4

RUN apt-get update -y

Expand Down
20 changes: 8 additions & 12 deletions src/Command/EnrichParticipantInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,31 @@
use Doctrine\ORM\EntityManagerInterface;
use GeoIp2\Database\Reader;
use GeoIp2\Exception\AddressNotFoundException;
use MaxMind\Db\Reader\InvalidDatabaseException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class EnrichParticipantInfoCommand extends Command
{
private ParticipantRepository $participantRepository;
private EntityManagerInterface $em;
private string $geoIpDbPath;

public function __construct(
ParticipantRepository $participantRepository,
EntityManagerInterface $em,
string $geoIpDbPath,
private ParticipantRepository $participantRepository,
private EntityManagerInterface $em,
private string $geoIpDbPath,
) {
$this->participantRepository = $participantRepository;
$this->em = $em;
$this->geoIpDbPath = $geoIpDbPath;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:enrich:participants')
->setDescription('Enrich the participant information');
}

/**
* @throws InvalidDatabaseException
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$batchSize = 1000;
Expand Down
11 changes: 5 additions & 6 deletions src/Command/GetBouncedMailsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@

class GetBouncedMailsCommand extends Command
{
private BounceQuery $bounceQuery;

public function __construct(BounceQuery $bounceQuery)
public function __construct(private readonly BounceQuery $bounceQuery)
{
$this->bounceQuery = $bounceQuery;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:getBounced')
->setDescription('Get bounced emails');
}

/**
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$bounces = $this->bounceQuery->getBounces();
Expand Down
12 changes: 3 additions & 9 deletions src/Command/HashBlacklistCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@

class HashBlacklistCommand extends Command
{
private EntityManagerInterface $em;
private HashService $hashService;

public function __construct(
EntityManagerInterface $em,
HashService $hashService,
private readonly EntityManagerInterface $em,
private readonly HashService $hashService,
) {
$this->em = $em;
$this->hashService = $hashService;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:hash-black-list')
Expand Down
18 changes: 11 additions & 7 deletions src/Command/HashOldDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Entity\BlacklistEmail;
use App\Entity\Participant;
use App\Service\HashService;
use Doctrine\DBAL\Logging\Middleware as LoggingMiddleware;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -13,14 +14,17 @@
class HashOldDataCommand extends Command
{
public function __construct(
private EntityManagerInterface $em,
private HashService $hashService,
private readonly EntityManagerInterface $em,
private readonly HashService $hashService,
) {
$em
->getConnection()
->getConfiguration()
->setSQLLogger(null)
;
$configuration = $em->getConnection()->getConfiguration();
$middlewares = $configuration->getMiddlewares();

$filteredMiddlewares = array_filter($middlewares, static function ($middleware) {
return !($middleware instanceof LoggingMiddleware);
});

$configuration->setMiddlewares($filteredMiddlewares);

parent::__construct();
}
Expand Down
15 changes: 4 additions & 11 deletions src/Command/ReportQueriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@

class ReportQueriesCommand extends Command
{
private ReportQueriesService $reportQueriesService;
private ExportReportQueriesService $exportReportQueriesService;

public function __construct(ReportQueriesService $reportQueriesService, ExportReportQueriesService $exportReportQueriesService)
public function __construct(private readonly ReportQueriesService $reportQueriesService, private readonly ExportReportQueriesService $exportReportQueriesService)
{
parent::__construct();
$this->reportQueriesService = $reportQueriesService;
$this->exportReportQueriesService = $exportReportQueriesService;
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:report-queries')
Expand All @@ -37,10 +32,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$year = $input->getArgument('year');

if ('all' !== $year) {
if (false === strtotime($year)) {
$year = date('Y');
}
if (('all' !== $year) && false === strtotime($year)) {
$year = date('Y');
}

$this->exportReportQueriesService->export($this->reportQueriesService->getReportResults($year), $year);
Expand Down
20 changes: 5 additions & 15 deletions src/Command/SendEmptyWishlistReminderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,16 @@

class SendEmptyWishlistReminderCommand extends Command
{
private EntityManagerInterface $em;
private ParticipantMailQuery $participantMailQuery;
private WishlistMailQuery $wishlistMailQuery;
private MailerService $mailerService;

public function __construct(
EntityManagerInterface $em,
ParticipantMailQuery $participantMailQuery,
WishlistMailQuery $wishlistMailQuery,
MailerService $mailerService,
private readonly EntityManagerInterface $em,
private readonly ParticipantMailQuery $participantMailQuery,
private readonly WishlistMailQuery $wishlistMailQuery,
private readonly MailerService $mailerService,
) {
$this->em = $em;
$this->participantMailQuery = $participantMailQuery;
$this->wishlistMailQuery = $wishlistMailQuery;
$this->mailerService = $mailerService;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:sendWishlistReminderMails')
Expand Down
16 changes: 4 additions & 12 deletions src/Command/SendParticipantViewReminderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,15 @@

class SendParticipantViewReminderCommand extends Command
{
private EntityManagerInterface $em;
private ParticipantMailQuery $participantMailQuery;
private MailerService $mailerService;

public function __construct(
EntityManagerInterface $em,
ParticipantMailQuery $participantMailQuery,
MailerService $mailerService,
private readonly EntityManagerInterface $em,
private readonly ParticipantMailQuery $participantMailQuery,
private readonly MailerService $mailerService,
) {
$this->em = $em;
$this->participantMailQuery = $participantMailQuery;
$this->mailerService = $mailerService;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:sendParticipantViewReminderMails')
Expand Down
16 changes: 4 additions & 12 deletions src/Command/SendPartyStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,15 @@

class SendPartyStatusCommand extends Command
{
private EntityManagerInterface $em;
private ParticipantMailQuery $participantMailQuery;
private MailerService $mailerService;

public function __construct(
EntityManagerInterface $em,
ParticipantMailQuery $participantMailQuery,
MailerService $mailerService,
private readonly EntityManagerInterface $em,
private readonly ParticipantMailQuery $participantMailQuery,
private readonly MailerService $mailerService,
) {
$this->em = $em;
$this->participantMailQuery = $participantMailQuery;
$this->mailerService = $mailerService;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:sendPartyStatusMails')
Expand Down
16 changes: 4 additions & 12 deletions src/Command/SendWishlistUpdatedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,15 @@

class SendWishlistUpdatedCommand extends Command
{
private EntityManagerInterface $em;
private ParticipantMailQuery $participantMailQuery;
private MailerService $mailerService;

public function __construct(
EntityManagerInterface $em,
ParticipantMailQuery $participantMailQuery,
MailerService $mailerService,
private readonly EntityManagerInterface $em,
private readonly ParticipantMailQuery $participantMailQuery,
private readonly MailerService $mailerService,
) {
$this->em = $em;
$this->participantMailQuery = $participantMailQuery;
$this->mailerService = $mailerService;

parent::__construct();
}

protected function configure()
protected function configure(): void
{
$this
->setName('app:sendWishlistUpdatedMails')
Expand Down
7 changes: 2 additions & 5 deletions src/DependencyInjection/Compiler/FormCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
*/
class FormCompilerPass implements CompilerPassInterface
{
/**
* @var array
*/
private $templates = ['jquery'];
private array $templates = ['jquery'];

public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$resources = $container->getParameter('twig.form.resources');

Expand Down
Loading

0 comments on commit 198477c

Please sign in to comment.