Skip to content

Commit

Permalink
Merge pull request #98 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 5.3.0
  • Loading branch information
acelaya authored Dec 11, 2020
2 parents 57b16ef + b55e692 commit cb5617f
Show file tree
Hide file tree
Showing 29 changed files with 814 additions and 379 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
fast_finish: true
include:
- name: "CI - 8.0"
php: '8.0snapshot'
php: '8.0'
env:
- COMPOSER_FLAGS='--ignore-platform-reqs'
- COMPOSER_FLAGS='--ignore-platform-req=php'
- name: "CI - 7.4"
php: '7.4'
env:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## [5.3.0] - 2020-12-11
### Added
* [#51](https://github.com/shlinkio/shlink-installer/issues/51) Created new command that allows updating the value of any configuration option.

### Changed
* [#96](https://github.com/shlinkio/shlink-installer/issues/96) Updated required MSI to 85%.

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* *Nothing*


## [5.2.0] - 2020-11-29
### Added
* Added explicit support for PHP 8
Expand Down
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,38 @@ The tool expects the active directory to be a valid shlink instance.

There are two main ways to run this tool:

* Using the built-in CLI entry points.
* Using the built-in CLI entry point.

Run either `vendor/bin/shlink-install` or `vendor/bin/shlink-update` in order to install or update a shlink instance.
Run `vendor/bin/shlink-installer` to print all available commands.

```
Shlink installer
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
install Guides you through the installation process, to get Shlink up and running.
list Lists commands
set-option Allows you to set new values for any config option.
update Helps you import Shlink's config from an older version to a new one.
```
> You can also run `vendor/bin/shlink-install` or `vendor/bin/shlink-update`, which alias the `install` and `update` commands respectively, but this is deprecated and will be removed in next major release.
* Using the `bin/run.php` helper script.
This script returns two functions that can be used to either install or update a shlink instance.
This script returns three functions that can be used to run the install or update, or the whole shlink installer tool.
Just require it and invoke the appropriate function:
Expand All @@ -40,9 +65,10 @@ There are two main ways to run this tool:
declare(strict_types=1);
[$install, $update] = require 'vendor/shlinkio/shlink-installer/bin/run.php';
[$install, $update, $installer] = require 'vendor/shlinkio/shlink-installer/bin/run.php';
$install(); // To install
$update(); // To update
$installer(); // To run any supported commands
```
## Customize options
Expand Down
8 changes: 6 additions & 2 deletions bin/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

/** @var ServiceLocatorInterface $container */
$container = include __DIR__ . '/../config/container.php';
$runApp = fn (bool $isUpdate) => $container->build(Application::class, ['isUpdate' => $isUpdate])->run();
$runApp = static fn (?string $command = null) => $container->build(Application::class, ['command' => $command])->run();

return [fn () => $runApp(false), fn () => $runApp(true)];
return [
static fn () => $runApp(Command\InstallCommand::NAME),
static fn () => $runApp(Command\UpdateCommand::NAME),
$runApp,
];
2 changes: 2 additions & 0 deletions bin/shlink-install
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ declare(strict_types=1);

namespace Shlinkio\Shlink\Installer;

// Deprecated. Use "shlink-installer" to interact with this tool

[$install] = require __DIR__ . '/run.php';
$install();
8 changes: 8 additions & 0 deletions bin/shlink-installer
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);

namespace Shlinkio\Shlink\Installer;

[,, $app] = require __DIR__ . '/run.php';
$app();
2 changes: 2 additions & 0 deletions bin/shlink-update
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ declare(strict_types=1);

namespace Shlinkio\Shlink\Installer;

// Deprecated. Use "shlink-installer" to interact with this tool

[, $update] = require __DIR__ . '/run.php';
$update();
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"laminas/laminas-servicemanager": "^3.4",
"laminas/laminas-stdlib": "^3.2",
"lstrojny/functional-php": "^1.9",
"shlinkio/shlink-config": "^1.0",
"shlinkio/shlink-config": "^1.1.1",
"symfony/console": "^5.1",
"symfony/filesystem": "^5.1",
"symfony/process": "^5.1"
Expand Down Expand Up @@ -56,7 +56,7 @@
"test": "phpdbg -qrr vendor/bin/phpunit --order-by=random --testdox --colors=always",
"test:ci": "@test --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml",
"test:pretty": "@test --coverage-html build/coverage-html",
"infect": "infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered",
"infect": "infection --threads=4 --min-msi=85 --log-verbosity=default --only-covered",
"infect:ci": "@infect --coverage=build --skip-initial-tests",
"infect:show": "@infect --show-mutations",
"infect:show:ci": "@infect --show-mutations --coverage=build",
Expand All @@ -82,6 +82,7 @@
},
"bin": [
"bin/shlink-install",
"bin/shlink-update"
"bin/shlink-update",
"bin/shlink-installer"
]
}
108 changes: 76 additions & 32 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Shlinkio\Shlink\Installer;

use Laminas\Config\Writer\PhpArray as PhpArrayConfigWriter;
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Symfony\Component\Console;
Expand All @@ -14,61 +15,69 @@

'dependencies' => [
'factories' => [
Console\Application::class => Factory\InstallApplicationFactory::class,
Console\Application::class => Factory\ApplicationFactory::class,
Filesystem::class => InvokableFactory::class,
PhpExecutableFinder::class => InvokableFactory::class,
PhpArrayConfigWriter::class => InvokableFactory::class,
Console\Helper\ProcessHelper::class => Factory\ProcessHelperFactory::class,

Service\InstallationCommandsRunner::class => ConfigAbstractFactory::class,
Service\ShlinkAssetsHandler::class => ConfigAbstractFactory::class,
Config\ConfigGenerator::class => Config\ConfigGeneratorFactory::class,
Config\ConfigGenerator::class => ConfigAbstractFactory::class,
Config\ConfigOptionsManager::class => Config\ConfigOptionsManagerFactory::class,
Factory\SwooleInstalledFactory::SWOOLE_INSTALLED => Factory\SwooleInstalledFactory::class,

Command\InstallCommand::class => ConfigAbstractFactory::class,
Command\UpdateCommand::class => ConfigAbstractFactory::class,
Command\SetOptionCommand::class => ConfigAbstractFactory::class,
],
],

'config_options' => [
'groups' => [
'DATABASE' => [
Config\Option\Database\DatabaseDriverConfigOption::class,
Config\Option\Database\DatabaseNameConfigOption::class,
Config\Option\Database\DatabaseHostConfigOption::class,
Config\Option\Database\DatabasePortConfigOption::class,
Config\Option\Database\DatabaseUserConfigOption::class,
Config\Option\Database\DatabasePasswordConfigOption::class,
Config\Option\Database\DatabaseUnixSocketConfigOption::class,
Config\Option\Database\DatabaseSqlitePathConfigOption::class,
'Database > Driver' => Config\Option\Database\DatabaseDriverConfigOption::class,
'Database > Name' => Config\Option\Database\DatabaseNameConfigOption::class,
'Database > Host (or unix socket for PostgreSQL)'
=> Config\Option\Database\DatabaseHostConfigOption::class,
'Database > Port' => Config\Option\Database\DatabasePortConfigOption::class,
'Database > User' => Config\Option\Database\DatabaseUserConfigOption::class,
'Database > Password' => Config\Option\Database\DatabasePasswordConfigOption::class,
'Database > Unix socket (Mysql/MariaDB)'
=> Config\Option\Database\DatabaseUnixSocketConfigOption::class,
'Database > Path (SQLite)' => Config\Option\Database\DatabaseSqlitePathConfigOption::class,
Config\Option\Database\DatabaseMySqlOptionsConfigOption::class,
],
'URL SHORTENER' => [
Config\Option\UrlShortener\ShortDomainHostConfigOption::class,
Config\Option\UrlShortener\ShortDomainSchemaConfigOption::class,
Config\Option\UrlShortener\ValidateUrlConfigOption::class,
Config\Option\UrlShortener\ShortCodeLengthOption::class,
Config\Option\Visit\VisitsWebhooksConfigOption::class,
Config\Option\UrlShortener\GeoLiteLicenseKeyConfigOption::class,
Config\Option\UrlShortener\IpAnonymizationConfigOption::class,
Config\Option\UrlShortener\RedirectStatusCodeConfigOption::class,
Config\Option\UrlShortener\RedirectCacheLifeTimeConfigOption::class,
'URL shortener > Short domain' => Config\Option\UrlShortener\ShortDomainHostConfigOption::class,
'URL shortener > Schema' => Config\Option\UrlShortener\ShortDomainSchemaConfigOption::class,
'URL shortener > Validate URLs' => Config\Option\UrlShortener\ValidateUrlConfigOption::class,
'URL shortener > Short codes length' => Config\Option\UrlShortener\ShortCodeLengthOption::class,
'Webhooks' => Config\Option\Visit\VisitsWebhooksConfigOption::class,
'GeoLite2 license key' => Config\Option\UrlShortener\GeoLiteLicenseKeyConfigOption::class,
'IP Anonymization' => Config\Option\UrlShortener\IpAnonymizationConfigOption::class,
'Redirects > Status code (301/302)' => Config\Option\UrlShortener\RedirectStatusCodeConfigOption::class,
'Redirects > Caching life time' => Config\Option\UrlShortener\RedirectCacheLifeTimeConfigOption::class,
],
'REDIRECTS' => [
Config\Option\Redirect\BaseUrlRedirectConfigOption::class,
Config\Option\Redirect\InvalidShortUrlRedirectConfigOption::class,
Config\Option\Redirect\Regular404RedirectConfigOption::class,
'Redirects > Base URL' => Config\Option\Redirect\BaseUrlRedirectConfigOption::class,
'Redirects > Invalid short URL' => Config\Option\Redirect\InvalidShortUrlRedirectConfigOption::class,
'Redirects > Regular 404' => Config\Option\Redirect\Regular404RedirectConfigOption::class,
],
'APPLICATION' => [
Config\Option\DisableTrackParamConfigOption::class,
Config\Option\Visit\CheckVisitsThresholdConfigOption::class,
Config\Option\Visit\VisitsThresholdConfigOption::class,
Config\Option\BasePathConfigOption::class,
Config\Option\Worker\TaskWorkerNumConfigOption::class,
Config\Option\Worker\WebWorkerNumConfigOption::class,
'Param to disable tracking' => Config\Option\DisableTrackParamConfigOption::class,
'Delete short URLs > Check threshold' => Config\Option\Visit\CheckVisitsThresholdConfigOption::class,
'Delete short URLs > Visits threshold amount' => Config\Option\Visit\VisitsThresholdConfigOption::class,
'Base path' => Config\Option\BasePathConfigOption::class,
'Swoole > Amount of task workers' => Config\Option\Worker\TaskWorkerNumConfigOption::class,
'Swoole > Amount of web workers' => Config\Option\Worker\WebWorkerNumConfigOption::class,
],
'INTEGRATIONS' => [
Config\Option\RedisServersConfigOption::class,
'Redis servers' => Config\Option\RedisServersConfigOption::class,
Config\Option\Mercure\EnableMercureConfigOption::class,
Config\Option\Mercure\MercurePublicUrlConfigOption::class,
Config\Option\Mercure\MercureInternalUrlConfigOption::class,
Config\Option\Mercure\MercureJwtSecretConfigOption::class,
'Mercure > Public URL' => Config\Option\Mercure\MercurePublicUrlConfigOption::class,
'Mercure > Internal URL' => Config\Option\Mercure\MercureInternalUrlConfigOption::class,
'Mercure > JWT Secret' => Config\Option\Mercure\MercureJwtSecretConfigOption::class,
],
],

Expand Down Expand Up @@ -118,15 +127,50 @@
Factory\SwooleInstalledFactory::SWOOLE_INSTALLED,
],
Config\Option\Mercure\MercureJwtSecretConfigOption::class => [Factory\SwooleInstalledFactory::SWOOLE_INSTALLED],

Config\ConfigGenerator::class => [
Config\ConfigOptionsManager::class,
'config.config_options.groups',
'config.installer.enabled_options',
],
Service\ShlinkAssetsHandler::class => [Filesystem::class],
Service\InstallationCommandsRunner::class => [
Console\Helper\ProcessHelper::class,
PhpExecutableFinder::class,
'config.installer.installation_commands',
],

Command\InstallCommand::class => [
PhpArrayConfigWriter::class,
Service\ShlinkAssetsHandler::class,
Config\ConfigGenerator::class,
Service\InstallationCommandsRunner::class,
],
Command\UpdateCommand::class => [
PhpArrayConfigWriter::class,
Service\ShlinkAssetsHandler::class,
Config\ConfigGenerator::class,
Service\InstallationCommandsRunner::class,
],
Command\SetOptionCommand::class => [
PhpArrayConfigWriter::class,
Service\ShlinkAssetsHandler::class,
Config\ConfigOptionsManager::class,
Filesystem::class,
'config.config_options.groups',
'config.installer.enabled_options',
],
],

'installer' => [
'commands' => [
Command\InstallCommand::NAME => Command\InstallCommand::class,
Command\UpdateCommand::NAME => Command\UpdateCommand::class,
Command\SetOptionCommand::NAME => Command\SetOptionCommand::class,
],

'enabled_options' => null,

'installation_commands' => [
'db_create_schema' => [
'command' => 'vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:create',
Expand Down
Loading

0 comments on commit cb5617f

Please sign in to comment.