2016-07-19 18:17:37 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
2017-07-22 14:33:32 +03:00
|
|
|
|
2018-09-29 10:52:32 +03:00
|
|
|
namespace Shlinkio\Shlink\CLI;
|
|
|
|
|
2020-01-01 23:11:53 +03:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
|
|
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
2019-08-05 19:48:33 +03:00
|
|
|
use Shlinkio\Shlink\Common\Doctrine\NoDbNameConnectionFactory;
|
2020-09-27 13:39:02 +03:00
|
|
|
use Shlinkio\Shlink\Core\Domain\DomainService;
|
2021-05-30 13:30:03 +03:00
|
|
|
use Shlinkio\Shlink\Core\Options\TrackingOptions;
|
2022-08-05 09:38:05 +03:00
|
|
|
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
|
2024-03-03 11:48:56 +03:00
|
|
|
use Shlinkio\Shlink\Core\RedirectRule\ShortUrlRedirectRuleService;
|
2022-09-23 19:42:38 +03:00
|
|
|
use Shlinkio\Shlink\Core\ShortUrl;
|
2021-02-02 00:55:52 +03:00
|
|
|
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlStringifier;
|
2020-05-08 11:29:24 +03:00
|
|
|
use Shlinkio\Shlink\Core\Tag\TagService;
|
2020-03-27 00:17:13 +03:00
|
|
|
use Shlinkio\Shlink\Core\Visit;
|
2019-08-11 21:34:55 +03:00
|
|
|
use Shlinkio\Shlink\Installer\Factory\ProcessHelperFactory;
|
2019-08-10 14:42:37 +03:00
|
|
|
use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdater;
|
2024-03-09 11:30:05 +03:00
|
|
|
use Shlinkio\Shlink\IpGeolocation\GeoLite2\GeoLite2ReaderFactory;
|
2017-07-22 14:33:32 +03:00
|
|
|
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
2019-08-04 12:30:35 +03:00
|
|
|
use Symfony\Component\Console as SymfonyCli;
|
2019-11-30 19:21:36 +03:00
|
|
|
use Symfony\Component\Lock\LockFactory;
|
2019-08-04 12:30:35 +03:00
|
|
|
use Symfony\Component\Process\PhpExecutableFinder;
|
2016-07-19 18:17:37 +03:00
|
|
|
|
2021-09-26 12:20:29 +03:00
|
|
|
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
2020-03-22 19:42:56 +03:00
|
|
|
|
2016-07-19 18:17:37 +03:00
|
|
|
return [
|
|
|
|
|
2016-07-31 17:30:05 +03:00
|
|
|
'dependencies' => [
|
2016-07-19 18:17:37 +03:00
|
|
|
'factories' => [
|
2019-08-04 12:30:35 +03:00
|
|
|
SymfonyCli\Application::class => Factory\ApplicationFactory::class,
|
2019-08-11 21:34:55 +03:00
|
|
|
SymfonyCli\Helper\ProcessHelper::class => ProcessHelperFactory::class,
|
2019-08-04 12:30:35 +03:00
|
|
|
PhpExecutableFinder::class => InvokableFactory::class,
|
2016-07-19 18:17:37 +03:00
|
|
|
|
2022-09-18 11:01:22 +03:00
|
|
|
GeoLite\GeolocationDbUpdater::class => ConfigAbstractFactory::class,
|
2024-03-03 11:48:56 +03:00
|
|
|
RedirectRule\RedirectRuleHandler::class => InvokableFactory::class,
|
2021-02-13 00:59:40 +03:00
|
|
|
Util\ProcessRunner::class => ConfigAbstractFactory::class,
|
|
|
|
|
2021-01-10 22:14:06 +03:00
|
|
|
ApiKey\RoleResolver::class => ConfigAbstractFactory::class,
|
2019-04-14 12:19:21 +03:00
|
|
|
|
2021-12-09 11:45:15 +03:00
|
|
|
Command\ShortUrl\CreateShortUrlCommand::class => ConfigAbstractFactory::class,
|
2018-09-16 19:36:02 +03:00
|
|
|
Command\ShortUrl\ResolveUrlCommand::class => ConfigAbstractFactory::class,
|
|
|
|
Command\ShortUrl\ListShortUrlsCommand::class => ConfigAbstractFactory::class,
|
2022-05-23 21:47:37 +03:00
|
|
|
Command\ShortUrl\GetShortUrlVisitsCommand::class => ConfigAbstractFactory::class,
|
2018-09-16 19:36:02 +03:00
|
|
|
Command\ShortUrl\DeleteShortUrlCommand::class => ConfigAbstractFactory::class,
|
2023-05-15 10:43:05 +03:00
|
|
|
Command\ShortUrl\DeleteShortUrlVisitsCommand::class => ConfigAbstractFactory::class,
|
2024-04-03 19:57:09 +03:00
|
|
|
Command\ShortUrl\DeleteExpiredShortUrlsCommand::class => ConfigAbstractFactory::class,
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2021-04-08 14:12:37 +03:00
|
|
|
Command\Visit\DownloadGeoLiteDbCommand::class => ConfigAbstractFactory::class,
|
2019-04-14 10:10:00 +03:00
|
|
|
Command\Visit\LocateVisitsCommand::class => ConfigAbstractFactory::class,
|
2022-05-22 20:34:08 +03:00
|
|
|
Command\Visit\GetOrphanVisitsCommand::class => ConfigAbstractFactory::class,
|
2023-05-18 10:35:42 +03:00
|
|
|
Command\Visit\DeleteOrphanVisitsCommand::class => ConfigAbstractFactory::class,
|
2022-05-22 20:34:08 +03:00
|
|
|
Command\Visit\GetNonOrphanVisitsCommand::class => ConfigAbstractFactory::class,
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2023-09-21 09:58:05 +03:00
|
|
|
Command\Api\GenerateKeyCommand::class => ConfigAbstractFactory::class,
|
2017-07-22 14:33:32 +03:00
|
|
|
Command\Api\DisableKeyCommand::class => ConfigAbstractFactory::class,
|
|
|
|
Command\Api\ListKeysCommand::class => ConfigAbstractFactory::class,
|
2023-09-21 10:29:59 +03:00
|
|
|
Command\Api\InitialApiKeyCommand::class => ConfigAbstractFactory::class,
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2017-07-22 14:33:32 +03:00
|
|
|
Command\Tag\ListTagsCommand::class => ConfigAbstractFactory::class,
|
|
|
|
Command\Tag\RenameTagCommand::class => ConfigAbstractFactory::class,
|
|
|
|
Command\Tag\DeleteTagsCommand::class => ConfigAbstractFactory::class,
|
2022-05-23 21:47:37 +03:00
|
|
|
Command\Tag\GetTagVisitsCommand::class => ConfigAbstractFactory::class,
|
2019-08-04 12:30:35 +03:00
|
|
|
|
|
|
|
Command\Db\CreateDatabaseCommand::class => ConfigAbstractFactory::class,
|
2019-08-06 21:48:48 +03:00
|
|
|
Command\Db\MigrateDatabaseCommand::class => ConfigAbstractFactory::class,
|
2020-09-27 13:39:02 +03:00
|
|
|
|
|
|
|
Command\Domain\ListDomainsCommand::class => ConfigAbstractFactory::class,
|
2021-07-21 22:09:33 +03:00
|
|
|
Command\Domain\DomainRedirectsCommand::class => ConfigAbstractFactory::class,
|
2022-05-22 20:34:08 +03:00
|
|
|
Command\Domain\GetDomainVisitsCommand::class => ConfigAbstractFactory::class,
|
2024-03-03 00:44:22 +03:00
|
|
|
|
|
|
|
Command\RedirectRule\ManageRedirectRulesCommand::class => ConfigAbstractFactory::class,
|
2017-07-22 14:33:32 +03:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
ConfigAbstractFactory::class => [
|
2022-09-18 11:01:22 +03:00
|
|
|
GeoLite\GeolocationDbUpdater::class => [
|
2021-05-30 13:30:03 +03:00
|
|
|
DbUpdater::class,
|
2024-03-09 11:30:05 +03:00
|
|
|
GeoLite2ReaderFactory::class,
|
2021-05-30 13:30:03 +03:00
|
|
|
LOCAL_LOCK_FACTORY,
|
|
|
|
TrackingOptions::class,
|
|
|
|
],
|
2021-02-13 00:59:40 +03:00
|
|
|
Util\ProcessRunner::class => [SymfonyCli\Helper\ProcessHelper::class],
|
2022-02-19 21:23:36 +03:00
|
|
|
ApiKey\RoleResolver::class => [DomainService::class, 'config.url_shortener.domain.hostname'],
|
2019-04-14 12:19:21 +03:00
|
|
|
|
2021-12-09 11:45:15 +03:00
|
|
|
Command\ShortUrl\CreateShortUrlCommand::class => [
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\UrlShortener::class,
|
2021-02-02 00:55:52 +03:00
|
|
|
ShortUrlStringifier::class,
|
2022-08-05 09:38:05 +03:00
|
|
|
UrlShortenerOptions::class,
|
2020-02-18 22:34:48 +03:00
|
|
|
],
|
2022-09-23 19:42:38 +03:00
|
|
|
Command\ShortUrl\ResolveUrlCommand::class => [ShortUrl\ShortUrlResolver::class],
|
2021-02-02 00:55:52 +03:00
|
|
|
Command\ShortUrl\ListShortUrlsCommand::class => [
|
2022-12-13 21:37:02 +03:00
|
|
|
ShortUrl\ShortUrlListService::class,
|
2022-09-23 19:42:38 +03:00
|
|
|
ShortUrl\Transformer\ShortUrlDataTransformer::class,
|
2021-02-02 00:55:52 +03:00
|
|
|
],
|
2022-05-23 21:47:37 +03:00
|
|
|
Command\ShortUrl\GetShortUrlVisitsCommand::class => [Visit\VisitsStatsHelper::class],
|
2022-09-23 19:42:38 +03:00
|
|
|
Command\ShortUrl\DeleteShortUrlCommand::class => [ShortUrl\DeleteShortUrlService::class],
|
2023-05-15 10:43:05 +03:00
|
|
|
Command\ShortUrl\DeleteShortUrlVisitsCommand::class => [ShortUrl\ShortUrlVisitsDeleter::class],
|
2024-04-03 19:57:09 +03:00
|
|
|
Command\ShortUrl\DeleteExpiredShortUrlsCommand::class => [ShortUrl\DeleteShortUrlService::class],
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2022-09-18 11:01:22 +03:00
|
|
|
Command\Visit\DownloadGeoLiteDbCommand::class => [GeoLite\GeolocationDbUpdater::class],
|
2019-04-14 10:10:00 +03:00
|
|
|
Command\Visit\LocateVisitsCommand::class => [
|
2022-09-23 15:50:26 +03:00
|
|
|
Visit\Geolocation\VisitLocator::class,
|
|
|
|
Visit\Geolocation\VisitToLocationHelper::class,
|
2019-11-30 19:21:36 +03:00
|
|
|
LockFactory::class,
|
2016-07-19 18:17:37 +03:00
|
|
|
],
|
2022-05-22 20:34:08 +03:00
|
|
|
Command\Visit\GetOrphanVisitsCommand::class => [Visit\VisitsStatsHelper::class],
|
2023-05-18 10:35:42 +03:00
|
|
|
Command\Visit\DeleteOrphanVisitsCommand::class => [Visit\VisitsDeleter::class],
|
2022-05-23 22:19:59 +03:00
|
|
|
Command\Visit\GetNonOrphanVisitsCommand::class => [Visit\VisitsStatsHelper::class, ShortUrlStringifier::class],
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2023-09-21 09:58:05 +03:00
|
|
|
Command\Api\GenerateKeyCommand::class => [ApiKeyService::class, ApiKey\RoleResolver::class],
|
2018-11-18 18:02:52 +03:00
|
|
|
Command\Api\DisableKeyCommand::class => [ApiKeyService::class],
|
|
|
|
Command\Api\ListKeysCommand::class => [ApiKeyService::class],
|
2023-09-21 10:29:59 +03:00
|
|
|
Command\Api\InitialApiKeyCommand::class => [ApiKeyService::class],
|
2018-09-15 18:57:12 +03:00
|
|
|
|
2020-05-08 11:29:24 +03:00
|
|
|
Command\Tag\ListTagsCommand::class => [TagService::class],
|
|
|
|
Command\Tag\RenameTagCommand::class => [TagService::class],
|
|
|
|
Command\Tag\DeleteTagsCommand::class => [TagService::class],
|
2022-05-23 22:19:59 +03:00
|
|
|
Command\Tag\GetTagVisitsCommand::class => [Visit\VisitsStatsHelper::class, ShortUrlStringifier::class],
|
2019-08-04 12:30:35 +03:00
|
|
|
|
2021-01-04 17:02:37 +03:00
|
|
|
Command\Domain\ListDomainsCommand::class => [DomainService::class],
|
2021-07-21 22:09:33 +03:00
|
|
|
Command\Domain\DomainRedirectsCommand::class => [DomainService::class],
|
2022-05-23 22:19:59 +03:00
|
|
|
Command\Domain\GetDomainVisitsCommand::class => [Visit\VisitsStatsHelper::class, ShortUrlStringifier::class],
|
2020-09-27 13:39:02 +03:00
|
|
|
|
2024-03-03 00:44:22 +03:00
|
|
|
Command\RedirectRule\ManageRedirectRulesCommand::class => [
|
|
|
|
ShortUrl\ShortUrlResolver::class,
|
2024-03-03 11:48:56 +03:00
|
|
|
ShortUrlRedirectRuleService::class,
|
|
|
|
RedirectRule\RedirectRuleHandler::class,
|
2024-03-03 00:44:22 +03:00
|
|
|
],
|
|
|
|
|
2019-08-04 12:30:35 +03:00
|
|
|
Command\Db\CreateDatabaseCommand::class => [
|
2019-11-30 19:21:36 +03:00
|
|
|
LockFactory::class,
|
2021-02-13 00:59:40 +03:00
|
|
|
Util\ProcessRunner::class,
|
2019-08-04 12:30:35 +03:00
|
|
|
PhpExecutableFinder::class,
|
2023-02-15 10:52:17 +03:00
|
|
|
'em',
|
2019-08-05 19:48:33 +03:00
|
|
|
NoDbNameConnectionFactory::SERVICE_NAME,
|
2019-08-04 12:30:35 +03:00
|
|
|
],
|
2019-08-06 21:48:48 +03:00
|
|
|
Command\Db\MigrateDatabaseCommand::class => [
|
2019-11-30 19:21:36 +03:00
|
|
|
LockFactory::class,
|
2021-02-13 00:59:40 +03:00
|
|
|
Util\ProcessRunner::class,
|
2019-08-06 21:48:48 +03:00
|
|
|
PhpExecutableFinder::class,
|
|
|
|
],
|
2016-07-19 18:17:37 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|