From 909e42b0be2a20171e23868488f3abfc471c2401 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 23 Sep 2022 14:50:26 +0200 Subject: [PATCH 1/2] Moved services related to geolocating visits to the Visit\Geolocation namespace --- module/CLI/config/dependencies.config.php | 4 ++-- module/CLI/src/Command/Visit/LocateVisitsCommand.php | 6 +++--- module/CLI/test/Command/Visit/LocateVisitsCommandTest.php | 6 +++--- module/Core/config/dependencies.config.php | 8 ++++---- module/Core/config/event_dispatcher.config.php | 4 ++-- module/Core/src/EventDispatcher/LocateUnlocatedVisits.php | 6 +++--- .../{ => Geolocation}/VisitGeolocationHelperInterface.php | 2 +- module/Core/src/Visit/{ => Geolocation}/VisitLocator.php | 2 +- .../src/Visit/{ => Geolocation}/VisitLocatorInterface.php | 2 +- .../src/Visit/{ => Geolocation}/VisitToLocationHelper.php | 2 +- .../{ => Geolocation}/VisitToLocationHelperInterface.php | 2 +- .../test/EventDispatcher/LocateUnlocatedVisitsTest.php | 4 ++-- .../test/Visit/{ => Geolocation}/VisitLocatorTest.php | 6 +++--- .../Visit/{ => Geolocation}/VisitToLocationHelperTest.php | 4 ++-- 14 files changed, 29 insertions(+), 29 deletions(-) rename module/Core/src/Visit/{ => Geolocation}/VisitGeolocationHelperInterface.php (90%) rename module/Core/src/Visit/{ => Geolocation}/VisitLocator.php (98%) rename module/Core/src/Visit/{ => Geolocation}/VisitLocatorInterface.php (87%) rename module/Core/src/Visit/{ => Geolocation}/VisitToLocationHelper.php (95%) rename module/Core/src/Visit/{ => Geolocation}/VisitToLocationHelperInterface.php (87%) rename module/Core/test/Visit/{ => Geolocation}/VisitLocatorTest.php (97%) rename module/Core/test/Visit/{ => Geolocation}/VisitToLocationHelperTest.php (94%) diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index dffc6010..59ea08a5 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -93,8 +93,8 @@ return [ Command\Visit\DownloadGeoLiteDbCommand::class => [GeoLite\GeolocationDbUpdater::class], Command\Visit\LocateVisitsCommand::class => [ - Visit\VisitLocator::class, - Visit\VisitToLocationHelper::class, + Visit\Geolocation\VisitLocator::class, + Visit\Geolocation\VisitToLocationHelper::class, LockFactory::class, ], Command\Visit\GetOrphanVisitsCommand::class => [Visit\VisitsStatsHelper::class], diff --git a/module/CLI/src/Command/Visit/LocateVisitsCommand.php b/module/CLI/src/Command/Visit/LocateVisitsCommand.php index 59db9367..781bf024 100644 --- a/module/CLI/src/Command/Visit/LocateVisitsCommand.php +++ b/module/CLI/src/Command/Visit/LocateVisitsCommand.php @@ -11,10 +11,10 @@ use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitGeolocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocatorInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelperInterface; use Shlinkio\Shlink\Core\Visit\Model\UnlocatableIpType; -use Shlinkio\Shlink\Core\Visit\VisitGeolocationHelperInterface; -use Shlinkio\Shlink\Core\Visit\VisitLocatorInterface; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelperInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Input\ArrayInput; diff --git a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php index 63ad3e52..5e4a7306 100644 --- a/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php +++ b/module/CLI/test/Command/Visit/LocateVisitsCommandTest.php @@ -15,9 +15,9 @@ use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; use Shlinkio\Shlink\Core\Model\Visitor; -use Shlinkio\Shlink\Core\Visit\VisitGeolocationHelperInterface; -use Shlinkio\Shlink\Core\Visit\VisitLocator; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitGeolocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocator; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelperInterface; use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Model\Location; use ShlinkioTest\Shlink\CLI\CliTestUtilsTrait; diff --git a/module/Core/config/dependencies.config.php b/module/Core/config/dependencies.config.php index 49b2857a..2491f6ca 100644 --- a/module/Core/config/dependencies.config.php +++ b/module/Core/config/dependencies.config.php @@ -44,8 +44,8 @@ return [ Visit\VisitsTracker::class => ConfigAbstractFactory::class, Visit\RequestTracker::class => ConfigAbstractFactory::class, - Visit\VisitLocator::class => ConfigAbstractFactory::class, - Visit\VisitToLocationHelper::class => ConfigAbstractFactory::class, + Visit\Geolocation\VisitLocator::class => ConfigAbstractFactory::class, + Visit\Geolocation\VisitToLocationHelper::class => ConfigAbstractFactory::class, Visit\VisitsStatsHelper::class => ConfigAbstractFactory::class, Visit\Transformer\OrphanVisitDataTransformer::class => InvokableFactory::class, @@ -109,8 +109,8 @@ return [ ShortUrl\Helper\ShortUrlTitleResolutionHelper::class, ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class, ], - Visit\VisitLocator::class => ['em'], - Visit\VisitToLocationHelper::class => [IpLocationResolverInterface::class], + Visit\Geolocation\VisitLocator::class => ['em'], + Visit\Geolocation\VisitToLocationHelper::class => [IpLocationResolverInterface::class], Visit\VisitsStatsHelper::class => ['em'], Tag\TagService::class => ['em'], Service\ShortUrl\DeleteShortUrlService::class => [ diff --git a/module/Core/config/event_dispatcher.config.php b/module/Core/config/event_dispatcher.config.php index 3d473010..e4bf3c0c 100644 --- a/module/Core/config/event_dispatcher.config.php +++ b/module/Core/config/event_dispatcher.config.php @@ -10,8 +10,8 @@ use Shlinkio\Shlink\CLI\GeoLite\GeolocationDbUpdater; use Shlinkio\Shlink\Common\Cache\RedisPublishingHelper; use Shlinkio\Shlink\Common\Mercure\MercureHubPublishingHelper; use Shlinkio\Shlink\Common\RabbitMq\RabbitMqPublishingHelper; -use Shlinkio\Shlink\Core\Visit\VisitLocator; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelper; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocator; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelper; use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdater; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/Core/src/EventDispatcher/LocateUnlocatedVisits.php b/module/Core/src/EventDispatcher/LocateUnlocatedVisits.php index c036c450..17bb298d 100644 --- a/module/Core/src/EventDispatcher/LocateUnlocatedVisits.php +++ b/module/Core/src/EventDispatcher/LocateUnlocatedVisits.php @@ -8,9 +8,9 @@ use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\EventDispatcher\Event\GeoLiteDbCreated; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; -use Shlinkio\Shlink\Core\Visit\VisitGeolocationHelperInterface; -use Shlinkio\Shlink\Core\Visit\VisitLocatorInterface; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitGeolocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocatorInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelperInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; class LocateUnlocatedVisits implements VisitGeolocationHelperInterface diff --git a/module/Core/src/Visit/VisitGeolocationHelperInterface.php b/module/Core/src/Visit/Geolocation/VisitGeolocationHelperInterface.php similarity index 90% rename from module/Core/src/Visit/VisitGeolocationHelperInterface.php rename to module/Core/src/Visit/Geolocation/VisitGeolocationHelperInterface.php index 95cca4a7..16b91aa3 100644 --- a/module/Core/src/Visit/VisitGeolocationHelperInterface.php +++ b/module/Core/src/Visit/Geolocation/VisitGeolocationHelperInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Visit; +namespace Shlinkio\Shlink\Core\Visit\Geolocation; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\VisitLocation; diff --git a/module/Core/src/Visit/VisitLocator.php b/module/Core/src/Visit/Geolocation/VisitLocator.php similarity index 98% rename from module/Core/src/Visit/VisitLocator.php rename to module/Core/src/Visit/Geolocation/VisitLocator.php index e9d0a8f9..eae0197b 100644 --- a/module/Core/src/Visit/VisitLocator.php +++ b/module/Core/src/Visit/Geolocation/VisitLocator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Visit; +namespace Shlinkio\Shlink\Core\Visit\Geolocation; use Doctrine\ORM\EntityManagerInterface; use Shlinkio\Shlink\Core\Entity\Visit; diff --git a/module/Core/src/Visit/VisitLocatorInterface.php b/module/Core/src/Visit/Geolocation/VisitLocatorInterface.php similarity index 87% rename from module/Core/src/Visit/VisitLocatorInterface.php rename to module/Core/src/Visit/Geolocation/VisitLocatorInterface.php index 1c99de36..c1a0cea3 100644 --- a/module/Core/src/Visit/VisitLocatorInterface.php +++ b/module/Core/src/Visit/Geolocation/VisitLocatorInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Visit; +namespace Shlinkio\Shlink\Core\Visit\Geolocation; interface VisitLocatorInterface { diff --git a/module/Core/src/Visit/VisitToLocationHelper.php b/module/Core/src/Visit/Geolocation/VisitToLocationHelper.php similarity index 95% rename from module/Core/src/Visit/VisitToLocationHelper.php rename to module/Core/src/Visit/Geolocation/VisitToLocationHelper.php index 567d7544..3bf4dff7 100644 --- a/module/Core/src/Visit/VisitToLocationHelper.php +++ b/module/Core/src/Visit/Geolocation/VisitToLocationHelper.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Visit; +namespace Shlinkio\Shlink\Core\Visit\Geolocation; use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\Visit; diff --git a/module/Core/src/Visit/VisitToLocationHelperInterface.php b/module/Core/src/Visit/Geolocation/VisitToLocationHelperInterface.php similarity index 87% rename from module/Core/src/Visit/VisitToLocationHelperInterface.php rename to module/Core/src/Visit/Geolocation/VisitToLocationHelperInterface.php index 7d553527..5eecad36 100644 --- a/module/Core/src/Visit/VisitToLocationHelperInterface.php +++ b/module/Core/src/Visit/Geolocation/VisitToLocationHelperInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Shlinkio\Shlink\Core\Visit; +namespace Shlinkio\Shlink\Core\Visit\Geolocation; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; diff --git a/module/Core/test/EventDispatcher/LocateUnlocatedVisitsTest.php b/module/Core/test/EventDispatcher/LocateUnlocatedVisitsTest.php index 1c703f7f..64e2f891 100644 --- a/module/Core/test/EventDispatcher/LocateUnlocatedVisitsTest.php +++ b/module/Core/test/EventDispatcher/LocateUnlocatedVisitsTest.php @@ -11,8 +11,8 @@ use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\EventDispatcher\Event\GeoLiteDbCreated; use Shlinkio\Shlink\Core\EventDispatcher\LocateUnlocatedVisits; use Shlinkio\Shlink\Core\Model\Visitor; -use Shlinkio\Shlink\Core\Visit\VisitLocatorInterface; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocatorInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelperInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; class LocateUnlocatedVisitsTest extends TestCase diff --git a/module/Core/test/Visit/VisitLocatorTest.php b/module/Core/test/Visit/Geolocation/VisitLocatorTest.php similarity index 97% rename from module/Core/test/Visit/VisitLocatorTest.php rename to module/Core/test/Visit/Geolocation/VisitLocatorTest.php index 21908be8..313b4396 100644 --- a/module/Core/test/Visit/VisitLocatorTest.php +++ b/module/Core/test/Visit/Geolocation/VisitLocatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioTest\Shlink\Core\Visit; +namespace ShlinkioTest\Shlink\Core\Visit\Geolocation; use Doctrine\ORM\EntityManager; use Exception; @@ -18,8 +18,8 @@ use Shlinkio\Shlink\Core\Entity\VisitLocation; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Repository\VisitRepositoryInterface; -use Shlinkio\Shlink\Core\Visit\VisitGeolocationHelperInterface; -use Shlinkio\Shlink\Core\Visit\VisitLocator; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitGeolocationHelperInterface; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitLocator; use Shlinkio\Shlink\IpGeolocation\Model\Location; use function array_shift; diff --git a/module/Core/test/Visit/VisitToLocationHelperTest.php b/module/Core/test/Visit/Geolocation/VisitToLocationHelperTest.php similarity index 94% rename from module/Core/test/Visit/VisitToLocationHelperTest.php rename to module/Core/test/Visit/Geolocation/VisitToLocationHelperTest.php index ee22272f..8492e159 100644 --- a/module/Core/test/Visit/VisitToLocationHelperTest.php +++ b/module/Core/test/Visit/Geolocation/VisitToLocationHelperTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioTest\Shlink\Core\Visit; +namespace ShlinkioTest\Shlink\Core\Visit\Geolocation; use PHPUnit\Framework\TestCase; use Prophecy\Argument; @@ -12,7 +12,7 @@ use Shlinkio\Shlink\Common\Util\IpAddress; use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException; use Shlinkio\Shlink\Core\Model\Visitor; -use Shlinkio\Shlink\Core\Visit\VisitToLocationHelper; +use Shlinkio\Shlink\Core\Visit\Geolocation\VisitToLocationHelper; use Shlinkio\Shlink\IpGeolocation\Exception\WrongIpException; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; From a842b5b7cd38f15aa7fe0759173f797110937581 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 23 Sep 2022 14:58:00 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d491db0b..cd6d137a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* [#1551](https://github.com/shlinkio/shlink/issues/1551) Moved services related to geolocating visits to the `Visit\Geolocation` namespace. + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [3.3.0] - 2022-09-18 ### Added * [#1221](https://github.com/shlinkio/shlink/issues/1221) Added experimental support to run Shlink with [RoadRunner](https://roadrunner.dev) instead of openswoole.