From 14b82c93a0ebad2d1e7ad22ab628b6cc085d62b8 Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Wed, 4 Dec 2024 10:48:43 +0200 Subject: [PATCH 1/3] composer post install script Signed-off-by: MarioRadu --- .github/workflows/codecov.yml | 6 -- .github/workflows/static-analysis.yml | 6 -- .laminas-ci/pre-run.sh | 6 +- bin/composer-post-install-script.php | 35 ++++++++++ composer.json | 3 + config/autoload/mail.local.php.dist | 92 --------------------------- 6 files changed, 41 insertions(+), 107 deletions(-) create mode 100644 bin/composer-post-install-script.php delete mode 100644 config/autoload/mail.local.php.dist diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 293bb8eb..59c4b08d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -44,12 +44,6 @@ jobs: - name: Install dependencies with composer run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - name: Setup project - run: | - mv config/autoload/local.php.dist config/autoload/local.php - mv config/autoload/mail.local.php.dist config/autoload/mail.local.php - mv config/autoload/local.test.php.dist config/autoload/local.test.php - - name: Collect code coverage with PHPUnit run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6a700f5d..ee7251d0 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -44,11 +44,5 @@ jobs: - name: Install dependencies with composer run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - name: Setup project - run: | - mv config/autoload/local.php.dist config/autoload/local.php - mv config/autoload/mail.local.php.dist config/autoload/mail.local.php - mv config/autoload/local.test.php.dist config/autoload/local.test.php - - name: Run static analysis with PHPStan run: vendor/bin/phpstan analyse diff --git a/.laminas-ci/pre-run.sh b/.laminas-ci/pre-run.sh index 2b5300aa..17d81d43 100755 --- a/.laminas-ci/pre-run.sh +++ b/.laminas-ci/pre-run.sh @@ -8,8 +8,8 @@ if [[ ${COMMAND} =~ phpunit ]];then apt-get install php"${PHP_VERSION}"-sqlite3 - cp config/autoload/local.php.dist config/autoload/local.php - cp config/autoload/mail.local.php.dist config/autoload/mail.local.php - cp config/autoload/local.test.php.dist config/autoload/local.test.php +# cp config/autoload/local.php.dist config/autoload/local.php +# cp config/autoload/mail.local.php.dist config/autoload/mail.local.php +# cp config/autoload/local.test.php.dist config/autoload/local.test.php fi diff --git a/bin/composer-post-install-script.php b/bin/composer-post-install-script.php new file mode 100644 index 00000000..af2e8a93 --- /dev/null +++ b/bin/composer-post-install-script.php @@ -0,0 +1,35 @@ + 'config/autoload/local.php.dist', + 'destination' => 'config/autoload/local.php', + ], + [ + 'source' => 'config/autoload/local.test.php.dist', + 'destination' => 'config/autoload/local.test.php', + ], + [ + 'source' => 'vendor/dotkernel/dot-mail/config/mail.global.php.dist', + 'destination' => 'config/autoload/mail.global.php', + ], +]; + +array_walk($files, 'copyFile'); diff --git a/composer.json b/composer.json index 7a8bd9a0..6731def2 100644 --- a/composer.json +++ b/composer.json @@ -86,6 +86,9 @@ "post-create-project-cmd": [ "@development-enable" ], + "post-update-cmd": [ + "php bin/composer-post-install-script.php" + ], "development-disable": "laminas-development-mode disable", "development-enable": "laminas-development-mode enable", "development-status": "laminas-development-mode status", diff --git a/config/autoload/mail.local.php.dist b/config/autoload/mail.local.php.dist deleted file mode 100644 index 79bad532..00000000 --- a/config/autoload/mail.local.php.dist +++ /dev/null @@ -1,92 +0,0 @@ - [ -// the key is the mail service name, this is the default one, which does not extend any configuration - 'default' => [ -// tells which other mail service configuration to extend - 'extends' => null, - /** - * the mail transport to use - * can be any class implementing Laminas\Mail\Transport\TransportInterface - * - * for standard mail transports, you can use these aliases - * - sendmail => Laminas\Mail\Transport\Sendmail - * - smtp => Laminas\Mail\Transport\Smtp - * - file => Laminas\Mail\Transport\File - * - in_memory => Laminas\Mail\Transport\InMemory - * - * defaults to sendmail - **/ - 'transport' => Laminas\Mail\Transport\Sendmail::class, - // Uncomment the below line if you want to save a copy of all sent emails to a certain IMAP folder - // Valid only if the Transport is SMTP -// 'save_sent_message_folder' => ['INBOX.Sent'], -// message configuration - 'message_options' => [ - 'from' => '', - 'from_name' => 'Dotkernel', - 'reply_to' => '', - 'reply_to_name' => '', - 'to' => [], - 'cc' => [], - 'bcc' => [], - 'subject' => '', - 'body' => [ - 'content' => '', - 'charset' => 'utf-8', - ], - 'attachments' => [ - 'files' => [], - 'dir' => [ - 'iterate' => false, - 'path' => 'data/mail/attachments', - 'recursive' => false, - ], - ], - ], -// options that will be used only if Laminas\Mail\Transport\Smtp adapter is used - 'smtp_options' => [ - 'host' => '', - 'port' => 587, - 'connection_class' => 'login', - 'connection_config' => [ - 'username' => '', - 'password' => '', - 'ssl' => 'ssl', - ], - ], -// file options that will be used only if the adapter is Laminas\Mail\Transport\File -// 'file_options' => [ -// 'path' => 'data/mail/output', -// //a callable that will get the Laminas\Mail\Transport\File object as an argument -// //and should return the filename if null is used, and empty callable will be used -// 'callback' => null, -// ], -// listeners to register with the mail service, for mail events - 'event_listeners' => [ -// [ -// 'type' => 'service or class name', -// 'priority' => 1, -// ], - ], - ], -// option to log the SENT emails - 'log' => [ - 'sent' => getcwd() . '/log/mail/sent.log', - ], - - /** - * You can define other mail services here, with the same structure as the default block - * you can even extend from the default block, and overwrite only the differences - */ - ], -]; From 9df85a378ea422873bc4f7d5ec6d57d08108f903 Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Wed, 4 Dec 2024 10:59:29 +0200 Subject: [PATCH 2/3] composer post install script Signed-off-by: MarioRadu --- .laminas-ci/pre-run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.laminas-ci/pre-run.sh b/.laminas-ci/pre-run.sh index 17d81d43..2b5300aa 100755 --- a/.laminas-ci/pre-run.sh +++ b/.laminas-ci/pre-run.sh @@ -8,8 +8,8 @@ if [[ ${COMMAND} =~ phpunit ]];then apt-get install php"${PHP_VERSION}"-sqlite3 -# cp config/autoload/local.php.dist config/autoload/local.php -# cp config/autoload/mail.local.php.dist config/autoload/mail.local.php -# cp config/autoload/local.test.php.dist config/autoload/local.test.php + cp config/autoload/local.php.dist config/autoload/local.php + cp config/autoload/mail.local.php.dist config/autoload/mail.local.php + cp config/autoload/local.test.php.dist config/autoload/local.test.php fi From 1b27d1c24850f62a643781ff769e47da230b22e9 Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Tue, 10 Dec 2024 12:34:49 +0200 Subject: [PATCH 3/3] fixed phpcs Signed-off-by: MarioRadu --- config/autoload/local.php.dist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 9935f62b..455334fc 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -26,13 +26,13 @@ $databases = [ ]; return [ - 'application' => [ + 'application' => [ 'name' => $app['name'] ?? '', 'url' => $baseUrl, ], - 'databases' => $databases, - 'doctrine' => [ - 'connection' => [ + 'databases' => $databases, + 'doctrine' => [ + 'connection' => [ 'orm_default' => [ 'params' => $databases['default'], ],