From e3ff4471529f1a96d77780c23f11798c4b127df7 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 14 Jan 2021 20:19:38 +0100 Subject: [PATCH 1/6] Updated to mezzio-swoole 3 --- .gitignore | 1 + README.md | 4 +-- bin/test/run-api-tests.sh | 6 ++-- composer.json | 2 +- data/infra/examples/shlink-daemon.sh | 2 +- data/infra/swoole.Dockerfile | 2 +- docker/docker-entrypoint.sh | 2 +- vendor/bin/mezzio-swoole | 45 ++++++++++++++++++++++++++++ 8 files changed, 55 insertions(+), 9 deletions(-) create mode 100755 vendor/bin/mezzio-swoole diff --git a/.gitignore b/.gitignore index 8cfea409..bd42bc71 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build composer.lock composer.phar vendor/ +!vendor/bin/mezzio-swoole data/database.sqlite data/shlink-tests.db data/GeoLite2-City.mmdb diff --git a/README.md b/README.md index a54c20c8..533d5b50 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Once Shlink is configured, you need to expose it to the web, either by using a t First you need to install the swoole PHP extension with [pecl](https://pecl.php.net/package/swoole), `pecl install swoole`. - Once installed, it's actually pretty easy to get shlink up and running with swoole. Run `./vendor/bin/mezzio-swoole start -d` and you will get shlink running on port 8080. + Once installed, it's actually pretty easy to get shlink up and running with swoole. Run `./vendor/bin/laminas mezzio:swoole:start -d` and you will get shlink running on port 8080. However, by doing it this way, you are loosing all the access logs, and the service won't be automatically run if the server has to be restarted. @@ -147,7 +147,7 @@ Once Shlink is configured, you need to expose it to the web, either by using a t # Description: Shlink non-blocking server with swoole ### END INIT INFO - SCRIPT=/path/to/shlink/vendor/bin/mezzio-swoole\ start + SCRIPT=/path/to/shlink/vendor/bin/laminas\ mezzio:swoole:start RUNAS=root PIDFILE=/var/run/shlink_swoole.pid diff --git a/bin/test/run-api-tests.sh b/bin/test/run-api-tests.sh index f3236d1b..06708d18 100755 --- a/bin/test/run-api-tests.sh +++ b/bin/test/run-api-tests.sh @@ -4,16 +4,16 @@ export DB_DRIVER=mysql export TEST_ENV=api # Try to stop server just in case it hanged in last execution -vendor/bin/mezzio-swoole stop +vendor/bin/laminas mezzio:swoole:stop echo 'Starting server...' -vendor/bin/mezzio-swoole start -d +vendor/bin/laminas mezzio:swoole:start -d sleep 2 vendor/bin/phpunit --order-by=random -c phpunit-api.xml --testdox --colors=always --log-junit=build/coverage-api/junit.xml $* testsExitCode=$? -vendor/bin/mezzio-swoole stop +vendor/bin/laminas mezzio:swoole:stop # Exit this script with the same code as the tests. If tests failed, this script has to fail exit $testsExitCode diff --git a/composer.json b/composer.json index 70454cfa..f7835b3f 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "mezzio/mezzio-fastroute": "^3.1", "mezzio/mezzio-helpers": "^5.3", "mezzio/mezzio-problem-details": "^1.1", - "mezzio/mezzio-swoole": "^2.6.4", + "mezzio/mezzio-swoole": "^3.1", "monolog/monolog": "^2.0", "nikolaposa/monolog-factory": "^3.1", "ocramius/proxy-manager": "^2.11", diff --git a/data/infra/examples/shlink-daemon.sh b/data/infra/examples/shlink-daemon.sh index a18ca65a..ce905721 100644 --- a/data/infra/examples/shlink-daemon.sh +++ b/data/infra/examples/shlink-daemon.sh @@ -8,7 +8,7 @@ # Description: Shlink non-blocking server with swoole ### END INIT INFO -SCRIPT=/path/to/shlink/vendor/bin/mezzio-swoole\ start +SCRIPT=/path/to/shlink/vendor/bin/laminas\ mezzio:swoole:start RUNAS=root PIDFILE=/var/run/shlink_swoole.pid diff --git a/data/infra/swoole.Dockerfile b/data/infra/swoole.Dockerfile index b6bfb5a7..bb1f084c 100644 --- a/data/infra/swoole.Dockerfile +++ b/data/infra/swoole.Dockerfile @@ -95,4 +95,4 @@ CMD \ if [[ ! -d "./vendor" ]]; then /usr/local/bin/composer install ; fi && \ # When restarting the container, swoole might think it is already in execution # This forces the app to be started every second until the exit code is 0 - until php ./vendor/bin/mezzio-swoole start; do sleep 1 ; done + until php ./vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 055e315f..df480d2f 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -17,4 +17,4 @@ php vendor/doctrine/orm/bin/doctrine.php orm:clear-cache:metadata -n -q # When restarting the container, swoole might think it is already in execution # This forces the app to be started every second until the exit code is 0 -until php vendor/mezzio/mezzio-swoole/bin/mezzio-swoole start; do sleep 1 ; done +until php vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done diff --git a/vendor/bin/mezzio-swoole b/vendor/bin/mezzio-swoole new file mode 100755 index 00000000..d28100bf --- /dev/null +++ b/vendor/bin/mezzio-swoole @@ -0,0 +1,45 @@ +#!/usr/bin/env php +get('config')['laminas-cli']['commands'] ?? []; +$registeredCommands = []; + +foreach ($commands as $newName => $commandServiceName) { + [, $oldName] = explode('mezzio:swoole:', $newName); + $registeredCommands[$oldName] = $commandServiceName; + + $container->addDelegator($commandServiceName, static function ($c, $n, callable $factory) use ($oldName) { + /** @var Command $command */ + $command = $factory(); + $command->setAliases([$oldName]); + + return $command; + }); +} + +$commandLine = new CommandLine('Mezzio web server', $version); +$commandLine->setAutoExit(true); +$commandLine->setCommandLoader(new ContainerCommandLoader($container, $registeredCommands)); +$commandLine->run(); From a9704c6e2f36092a00d46978bc6bf4f80f5b07fa Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 14 Jan 2021 20:23:44 +0100 Subject: [PATCH 2/6] Improved mezzio-swoole helper script to ensure it only applies to mezzio:swoole commands --- vendor/bin/mezzio-swoole | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vendor/bin/mezzio-swoole b/vendor/bin/mezzio-swoole index d28100bf..2c341326 100755 --- a/vendor/bin/mezzio-swoole +++ b/vendor/bin/mezzio-swoole @@ -18,16 +18,22 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; use function explode; +use function Functional\filter; +use function str_starts_with; use function strstr; /** @var ServiceManager $container */ $container = require __DIR__ . '/../../config/container.php'; $version = strstr(Versions::getVersion('mezzio/mezzio-swoole'), '@', true); -$commands = $container->get('config')['laminas-cli']['commands'] ?? []; +$commandsPrefix = 'mezzio:swoole:'; +$commands = filter( + $container->get('config')['laminas-cli']['commands'] ?? [], + fn ($c, string $command) => str_starts_with($command, $commandsPrefix), +); $registeredCommands = []; foreach ($commands as $newName => $commandServiceName) { - [, $oldName] = explode('mezzio:swoole:', $newName); + [, $oldName] = explode($commandsPrefix, $newName); $registeredCommands[$oldName] = $commandServiceName; $container->addDelegator($commandServiceName, static function ($c, $n, callable $factory) use ($oldName) { From 6b6d751d549bca7d1e519c67c322e7026dbdc308 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Jan 2021 11:40:30 +0100 Subject: [PATCH 3/6] Updated to shlinkio/shlink-event-dispatcher 2 --- composer.json | 2 +- module/Core/src/EventDispatcher/{ => Event}/ShortUrlVisited.php | 2 +- module/Core/src/EventDispatcher/{ => Event}/VisitLocated.php | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename module/Core/src/EventDispatcher/{ => Event}/ShortUrlVisited.php (95%) rename module/Core/src/EventDispatcher/{ => Event}/VisitLocated.php (100%) diff --git a/composer.json b/composer.json index f7835b3f..ada2facc 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "ramsey/uuid": "^3.9", "shlinkio/shlink-common": "dev-main#1311861 as 3.4", "shlinkio/shlink-config": "^1.0", - "shlinkio/shlink-event-dispatcher": "^1.6", + "shlinkio/shlink-event-dispatcher": "^2.0", "shlinkio/shlink-importer": "^2.1", "shlinkio/shlink-installer": "^5.3", "shlinkio/shlink-ip-geolocation": "^1.5", diff --git a/module/Core/src/EventDispatcher/ShortUrlVisited.php b/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php similarity index 95% rename from module/Core/src/EventDispatcher/ShortUrlVisited.php rename to module/Core/src/EventDispatcher/Event/ShortUrlVisited.php index c33f805a..2cac3dbc 100644 --- a/module/Core/src/EventDispatcher/ShortUrlVisited.php +++ b/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php @@ -29,6 +29,6 @@ final class ShortUrlVisited implements JsonSerializable public function jsonSerialize(): array { - return ['visitId' => $this->visitId, 'originalIpAddress' => $this->originalIpAddress]; + return ['visitId' => $this->visitId, 'originalIpAddress' => '']; } } diff --git a/module/Core/src/EventDispatcher/VisitLocated.php b/module/Core/src/EventDispatcher/Event/VisitLocated.php similarity index 100% rename from module/Core/src/EventDispatcher/VisitLocated.php rename to module/Core/src/EventDispatcher/Event/VisitLocated.php From 2e8f5202d03b5b6754ff5678ffe48c3b978196ee Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Jan 2021 11:42:35 +0100 Subject: [PATCH 4/6] Moved event objects to a sub-namespace inside Core\EventDispatcher --- .../Core/config/event_dispatcher.config.php | 4 +-- .../Event/AbstractVisitEvent.php | 27 +++++++++++++++++++ .../EventDispatcher/Event/ShortUrlVisited.php | 19 +++---------- .../EventDispatcher/Event/VisitLocated.php | 22 ++------------- .../EventDispatcher/LocateShortUrlVisit.php | 2 ++ .../EventDispatcher/NotifyVisitToMercure.php | 1 + .../EventDispatcher/NotifyVisitToWebHooks.php | 1 + module/Core/src/Service/VisitsTracker.php | 2 +- .../LocateShortUrlVisitTest.php | 4 +-- .../NotifyVisitToMercureTest.php | 2 +- .../NotifyVisitToWebHooksTest.php | 2 +- .../Core/test/Service/VisitsTrackerTest.php | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php diff --git a/module/Core/config/event_dispatcher.config.php b/module/Core/config/event_dispatcher.config.php index c72e2d7a..83390fdd 100644 --- a/module/Core/config/event_dispatcher.config.php +++ b/module/Core/config/event_dispatcher.config.php @@ -14,13 +14,13 @@ return [ 'events' => [ 'regular' => [ - EventDispatcher\VisitLocated::class => [ + EventDispatcher\Event\VisitLocated::class => [ EventDispatcher\NotifyVisitToMercure::class, EventDispatcher\NotifyVisitToWebHooks::class, ], ], 'async' => [ - EventDispatcher\ShortUrlVisited::class => [ + EventDispatcher\Event\ShortUrlVisited::class => [ EventDispatcher\LocateShortUrlVisit::class, ], ], diff --git a/module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php b/module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php new file mode 100644 index 00000000..09869cb2 --- /dev/null +++ b/module/Core/src/EventDispatcher/Event/AbstractVisitEvent.php @@ -0,0 +1,27 @@ +visitId = $visitId; + } + + public function visitId(): string + { + return $this->visitId; + } + + public function jsonSerialize(): array + { + return ['visitId' => $this->visitId]; + } +} diff --git a/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php b/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php index 2cac3dbc..f177721f 100644 --- a/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php +++ b/module/Core/src/EventDispatcher/Event/ShortUrlVisited.php @@ -2,33 +2,20 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\EventDispatcher; +namespace Shlinkio\Shlink\Core\EventDispatcher\Event; -use JsonSerializable; - -final class ShortUrlVisited implements JsonSerializable +final class ShortUrlVisited extends AbstractVisitEvent { - private string $visitId; private ?string $originalIpAddress; public function __construct(string $visitId, ?string $originalIpAddress = null) { - $this->visitId = $visitId; + parent::__construct($visitId); $this->originalIpAddress = $originalIpAddress; } - public function visitId(): string - { - return $this->visitId; - } - public function originalIpAddress(): ?string { return $this->originalIpAddress; } - - public function jsonSerialize(): array - { - return ['visitId' => $this->visitId, 'originalIpAddress' => '']; - } } diff --git a/module/Core/src/EventDispatcher/Event/VisitLocated.php b/module/Core/src/EventDispatcher/Event/VisitLocated.php index 0e1c1176..99b7a05e 100644 --- a/module/Core/src/EventDispatcher/Event/VisitLocated.php +++ b/module/Core/src/EventDispatcher/Event/VisitLocated.php @@ -2,26 +2,8 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\EventDispatcher; +namespace Shlinkio\Shlink\Core\EventDispatcher\Event; -use JsonSerializable; - -final class VisitLocated implements JsonSerializable +final class VisitLocated extends AbstractVisitEvent { - private string $visitId; - - public function __construct(string $visitId) - { - $this->visitId = $visitId; - } - - public function visitId(): string - { - return $this->visitId; - } - - public function jsonSerialize(): array - { - return ['visitId' => $this->visitId]; - } } diff --git a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php index 6abbe02b..8b193578 100644 --- a/module/Core/src/EventDispatcher/LocateShortUrlVisit.php +++ b/module/Core/src/EventDispatcher/LocateShortUrlVisit.php @@ -11,6 +11,8 @@ use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdaterInterface; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; +use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlVisited; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/Core/src/EventDispatcher/NotifyVisitToMercure.php b/module/Core/src/EventDispatcher/NotifyVisitToMercure.php index af6dd33f..33aab7af 100644 --- a/module/Core/src/EventDispatcher/NotifyVisitToMercure.php +++ b/module/Core/src/EventDispatcher/NotifyVisitToMercure.php @@ -7,6 +7,7 @@ namespace Shlinkio\Shlink\Core\EventDispatcher; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Entity\Visit; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\Core\Mercure\MercureUpdatesGeneratorInterface; use Symfony\Component\Mercure\PublisherInterface; use Throwable; diff --git a/module/Core/src/EventDispatcher/NotifyVisitToWebHooks.php b/module/Core/src/EventDispatcher/NotifyVisitToWebHooks.php index b3923b86..2add5698 100644 --- a/module/Core/src/EventDispatcher/NotifyVisitToWebHooks.php +++ b/module/Core/src/EventDispatcher/NotifyVisitToWebHooks.php @@ -13,6 +13,7 @@ use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\RequestOptions; use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Entity\Visit; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\Core\Options\AppOptions; use Shlinkio\Shlink\Core\Transformer\ShortUrlDataTransformer; use Throwable; diff --git a/module/Core/src/Service/VisitsTracker.php b/module/Core/src/Service/VisitsTracker.php index fc35499f..46d4bd6b 100644 --- a/module/Core/src/Service/VisitsTracker.php +++ b/module/Core/src/Service/VisitsTracker.php @@ -10,7 +10,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Visit; -use Shlinkio\Shlink\Core\EventDispatcher\ShortUrlVisited; +use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlVisited; use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException; use Shlinkio\Shlink\Core\Exception\TagNotFoundException; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; diff --git a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php index ab12a349..8c9119a5 100644 --- a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php +++ b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php @@ -17,9 +17,9 @@ use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; +use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlVisited; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\Core\EventDispatcher\LocateShortUrlVisit; -use Shlinkio\Shlink\Core\EventDispatcher\ShortUrlVisited; -use Shlinkio\Shlink\Core\EventDispatcher\VisitLocated; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; diff --git a/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php b/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php index 90891db3..b8e71297 100644 --- a/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php +++ b/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php @@ -13,8 +13,8 @@ use Psr\Log\LoggerInterface; use RuntimeException; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Visit; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\Core\EventDispatcher\NotifyVisitToMercure; -use Shlinkio\Shlink\Core\EventDispatcher\VisitLocated; use Shlinkio\Shlink\Core\Mercure\MercureUpdatesGeneratorInterface; use Shlinkio\Shlink\Core\Model\Visitor; use Symfony\Component\Mercure\PublisherInterface; diff --git a/module/Core/test/EventDispatcher/NotifyVisitToWebHooksTest.php b/module/Core/test/EventDispatcher/NotifyVisitToWebHooksTest.php index 8319f448..e7021e18 100644 --- a/module/Core/test/EventDispatcher/NotifyVisitToWebHooksTest.php +++ b/module/Core/test/EventDispatcher/NotifyVisitToWebHooksTest.php @@ -19,8 +19,8 @@ use Prophecy\Prophecy\ObjectProphecy; use Psr\Log\LoggerInterface; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Visit; +use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated; use Shlinkio\Shlink\Core\EventDispatcher\NotifyVisitToWebHooks; -use Shlinkio\Shlink\Core\EventDispatcher\VisitLocated; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Options\AppOptions; diff --git a/module/Core/test/Service/VisitsTrackerTest.php b/module/Core/test/Service/VisitsTrackerTest.php index ef894aaf..17135f57 100644 --- a/module/Core/test/Service/VisitsTrackerTest.php +++ b/module/Core/test/Service/VisitsTrackerTest.php @@ -15,7 +15,7 @@ use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Visit; -use Shlinkio\Shlink\Core\EventDispatcher\ShortUrlVisited; +use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlVisited; use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException; use Shlinkio\Shlink\Core\Exception\TagNotFoundException; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; From 5ad1a124573050f97269658fdfa27ae7e74e5c95 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Jan 2021 11:43:21 +0100 Subject: [PATCH 5/6] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0003adfb..93025616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### Changed * [#912](https://github.com/shlinkio/shlink/issues/912) Changed error templates to be plain html files, removing the dependency on `league/plates` package. +* [#875](https://github.com/shlinkio/shlink/issues/875) Updated to `mezzio/mezzio-swoole` v3.1. ### Deprecated * [#917](https://github.com/shlinkio/shlink/issues/917) Deprecated `/{shortCode}/qr-code/{size}` URL, in favor of providing the size in the query instead, `/{shortCode}/qr-code?size={size}`. From 3e2701f136b3c95aebe5fd880e28c95586feb68e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Jan 2021 13:03:44 +0100 Subject: [PATCH 6/6] Updated how to copy mezzio helper script to dist file --- .dockerignore | 1 + .gitignore | 1 - {vendor/bin => bin/helper}/mezzio-swoole | 0 build.sh | 3 +++ 4 files changed, 4 insertions(+), 1 deletion(-) rename {vendor/bin => bin/helper}/mezzio-swoole (100%) diff --git a/.dockerignore b/.dockerignore index 2080adcf..f9102acb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -21,3 +21,4 @@ infection* **/test* build* **/.* +bin/helper diff --git a/.gitignore b/.gitignore index bd42bc71..8cfea409 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ build composer.lock composer.phar vendor/ -!vendor/bin/mezzio-swoole data/database.sqlite data/shlink-tests.db data/GeoLite2-City.mmdb diff --git a/vendor/bin/mezzio-swoole b/bin/helper/mezzio-swoole similarity index 100% rename from vendor/bin/mezzio-swoole rename to bin/helper/mezzio-swoole diff --git a/build.sh b/build.sh index 2f5a23bd..16610a8b 100755 --- a/build.sh +++ b/build.sh @@ -28,6 +28,9 @@ echo "Installing dependencies with $composerBin..." ${composerBin} self-update ${composerBin} install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction +# Copy mezzio helper script to vendor (deprecated - Remove with Shlink 3.0.0) +cp "${projectdir}/bin/helper/mezzio-swoole" "./vendor/bin" + # Delete development files echo 'Deleting dev files...' rm composer.*