From f3f35218c333df5fc484aa3169fbadfd484ef05c Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 4 Jan 2020 13:18:28 +0100 Subject: [PATCH] Updated to installer v4 --- bin/install | 4 +- bin/update | 4 +- composer.json | 2 +- config/autoload/installer.global.php | 71 ++++++++++++---------------- 4 files changed, 36 insertions(+), 45 deletions(-) diff --git a/bin/install b/bin/install index 5918cac0..d20db86d 100755 --- a/bin/install +++ b/bin/install @@ -8,5 +8,5 @@ use function chdir; use function dirname; chdir(dirname(__DIR__)); -$run = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php'; -$run(false); +[$install] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php'; +$install(); diff --git a/bin/update b/bin/update index 5dd32e72..ad20ce46 100755 --- a/bin/update +++ b/bin/update @@ -8,5 +8,5 @@ use function chdir; use function dirname; chdir(dirname(__DIR__)); -$run = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php'; -$run(true); +[, $update] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php'; +$update(); diff --git a/composer.json b/composer.json index 1b7c89c2..80c29769 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "pugx/shortid-php": "^0.5", "shlinkio/shlink-common": "^2.5", "shlinkio/shlink-event-dispatcher": "^1.3", - "shlinkio/shlink-installer": "^3.3", + "shlinkio/shlink-installer": "^4.0", "shlinkio/shlink-ip-geolocation": "^1.3", "symfony/console": "^5.0", "symfony/filesystem": "^5.0", diff --git a/config/autoload/installer.global.php b/config/autoload/installer.global.php index 402e6bb3..63716906 100644 --- a/config/autoload/installer.global.php +++ b/config/autoload/installer.global.php @@ -2,51 +2,42 @@ declare(strict_types=1); -use Shlinkio\Shlink\Installer\Config\Plugin; +use Shlinkio\Shlink\Installer\Config\Option; return [ - 'installer_plugins_expected_config' => [ - Plugin\UrlShortenerConfigCustomizer::class => [ - Plugin\UrlShortenerConfigCustomizer::SCHEMA, - Plugin\UrlShortenerConfigCustomizer::HOSTNAME, - Plugin\UrlShortenerConfigCustomizer::VALIDATE_URL, - Plugin\UrlShortenerConfigCustomizer::NOTIFY_VISITS_WEBHOOKS, - Plugin\UrlShortenerConfigCustomizer::VISITS_WEBHOOKS, + 'installer' => [ + 'enabled_options' => [ + Option\DatabaseDriverConfigOption::class, + Option\DatabaseNameConfigOption::class, + Option\DatabaseHostConfigOption::class, + Option\DatabasePortConfigOption::class, + Option\DatabaseUserConfigOption::class, + Option\DatabasePasswordConfigOption::class, + Option\DatabaseSqlitePathConfigOption::class, + Option\DatabaseMySqlOptionsConfigOption::class, + Option\ShortDomainHostConfigOption::class, + Option\ShortDomainSchemaConfigOption::class, + Option\ValidateUrlConfigOption::class, + Option\VisitsWebhooksConfigOption::class, + Option\BaseUrlRedirectConfigOption::class, + Option\InvalidShortUrlRedirectConfigOption::class, + Option\Regular404RedirectConfigOption::class, + Option\DisableTrackParamConfigOption::class, + Option\CheckVisitsThresholdConfigOption::class, + Option\VisitsThresholdConfigOption::class, + Option\BasePathConfigOption::class, + Option\TaskWorkerNumConfigOption::class, + Option\WebWorkerNumConfigOption::class, ], - Plugin\ApplicationConfigCustomizer::class => [ - Plugin\ApplicationConfigCustomizer::SECRET, - Plugin\ApplicationConfigCustomizer::DISABLE_TRACK_PARAM, - Plugin\ApplicationConfigCustomizer::CHECK_VISITS_THRESHOLD, - Plugin\ApplicationConfigCustomizer::VISITS_THRESHOLD, - Plugin\ApplicationConfigCustomizer::BASE_PATH, - Plugin\ApplicationConfigCustomizer::WEB_WORKER_NUM, - Plugin\ApplicationConfigCustomizer::TASK_WORKER_NUM, - ], - - Plugin\DatabaseConfigCustomizer::class => [ - Plugin\DatabaseConfigCustomizer::DRIVER, - Plugin\DatabaseConfigCustomizer::NAME, - Plugin\DatabaseConfigCustomizer::USER, - Plugin\DatabaseConfigCustomizer::PASSWORD, - Plugin\DatabaseConfigCustomizer::HOST, - Plugin\DatabaseConfigCustomizer::PORT, - ], - - Plugin\RedirectsConfigCustomizer::class => [ - Plugin\RedirectsConfigCustomizer::INVALID_SHORT_URL_REDIRECT_TO, - Plugin\RedirectsConfigCustomizer::REGULAR_404_REDIRECT_TO, - Plugin\RedirectsConfigCustomizer::BASE_URL_REDIRECT_TO, - ], - ], - - 'installation_commands' => [ - 'db_create_schema' => [ - 'command' => 'bin/cli db:create', - ], - 'db_migrate' => [ - 'command' => 'bin/cli db:migrate', + 'installation_commands' => [ + 'db_create_schema' => [ + 'command' => 'bin/cli db:create', + ], + 'db_migrate' => [ + 'command' => 'bin/cli db:migrate', + ], ], ],