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