Skip to content

Commit

Permalink
Merge pull request #217 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 9.0.0
  • Loading branch information
acelaya authored Mar 3, 2024
2 parents ae3fa45 + 8162b39 commit bbd2a79
Show file tree
Hide file tree
Showing 47 changed files with 312 additions and 696 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ docker-compose.override.yml.dist export-ignore
docker-compose.yml export-ignore
Dockerfile export-ignore
indocker export-ignore
infection.json export-ignore
phpcs.xml export-ignore
phpstan.neon export-ignore
phpunit.xml.dist export-ignore
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ on:
jobs:
ci:
uses: shlinkio/github-actions/.github/workflows/php-lib-ci.yml@main
secrets:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ 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).

## [9.0.0] - 2024-03-03
### Added
* Add QR code options for foreground color, background color and logo URL.

### Changed
* Update dependencies
* Default value for QR codes enabled for disabled short URLs is now true.
* Title resolution defaults to true now.

### Deprecated
* *Nothing*

### Removed
* Remove config options related with webhooks.
* Remove config option to decode redis credentials.
* Remove support for openswoole.
* Remove infection and mutation tests.
* Remove web and task worker config options.

### Fixed
* *Nothing*


## [8.7.0] - 2023-12-26
### Added
* Add config option to enable/disable QR codes for disables short URLs.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ A PHP command line tool used to install [shlink](https://shlink.io/).

[![Build Status](https://img.shields.io/github/actions/workflow/status/shlinkio/shlink-installer/ci.yml?branch=develop&logo=github&style=flat-square)](https://github.com/shlinkio/shlink-installer/actions/workflows/ci.yml?query=workflow%3A%22Continuous+integration%22)
[![Code Coverage](https://img.shields.io/codecov/c/gh/shlinkio/shlink-installer/develop?style=flat-square)](https://app.codecov.io/gh/shlinkio/shlink-installer)
[![Infection MSI](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fshlinkio%2Fshlink-installer%2Fdevelop)](https://dashboard.stryker-mutator.io/reports/github.com/shlinkio/shlink-installer/develop)
[![Latest Stable Version](https://img.shields.io/github/release/shlinkio/shlink-installer.svg?style=flat-square)](https://packagist.org/packages/shlinkio/shlink-installer)
[![License](https://img.shields.io/github/license/shlinkio/shlink-installer.svg?style=flat-square)](https://github.com/shlinkio/shlink-installer/blob/main/LICENSE)
[![Paypal donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=aaaaaa)](https://slnk.to/donate)
Expand Down
40 changes: 13 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
"laminas/laminas-config": "^3.9",
"laminas/laminas-config-aggregator": "^1.14",
"laminas/laminas-servicemanager": "^3.22",
"laminas/laminas-stdlib": "^3.18",
"shlinkio/shlink-config": "^2.4",
"symfony/console": "^6.3",
"symfony/filesystem": "^6.3",
"symfony/process": "^6.3"
"laminas/laminas-stdlib": "^3.19",
"shlinkio/shlink-config": "^3.0 || ^2.5",
"symfony/console": "^7.0 || ^6.4",
"symfony/filesystem": "^7.0 || ^6.4",
"symfony/process": "^7.0 || ^6.4"
},
"require-dev": {
"devster/ubench": "^2.1",
"infection/infection": "^0.27.7",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^10.4",
"phpunit/phpunit": "^10.5",
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.3.0",
"symfony/var-dumper": "^6.3"
"symfony/var-dumper": "^7.0 || ^6.4"
},
"autoload": {
"psr-4": {
Expand All @@ -46,41 +45,28 @@
"ci": [
"@cs",
"@stan",
"@test:ci",
"@infect:ci"
"@test:ci"
],
"cs": "phpcs",
"cs:fix": "phpcbf",
"stan": "phpstan analyse src test test-resources config --level=8",
"test": "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=90 --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",
"infect:test": [
"@test:ci",
"@infect:show:ci"
]
"test:ci": "@test --coverage-clover=build/clover.xml",
"test:pretty": "@test --coverage-html=build/coverage-html"
},
"scripts-descriptions": {
"ci": "<fg=blue;options=bold>Alias for \"cs\", \"stan\", \"test:ci\" and \"infect:ci\"</>",
"ci": "<fg=blue;options=bold>Alias for \"cs\", \"stan\" and \"test:ci\"</>",
"cs": "<fg=blue;options=bold>Checks coding styles</>",
"cs:fix": "<fg=blue;options=bold>Fixes coding styles, when possible</>",
"stan": "<fg=blue;options=bold>Inspects code with phpstan</>",
"test": "<fg=blue;options=bold>Runs unit tests with no coverage reports</>",
"test:ci": "<fg=blue;options=bold>Runs unit tests generating coverage reports and logs</>",
"test:pretty": "<fg=blue;options=bold>Runs unit tests generating coverage reports in html</>",
"infect": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing</>",
"infect:ci": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing with existing reports and logs</>",
"infect:show": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing and shows applied mutators</>"
"test:pretty": "<fg=blue;options=bold>Runs unit tests generating coverage reports in html</>"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"bin": [
Expand Down
16 changes: 6 additions & 10 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
=> Config\Option\UrlShortener\EnableMultiSegmentSlugsConfigOption::class,
'URL shortener > Trailing slashes' => Config\Option\UrlShortener\EnableTrailingSlashConfigOption::class,
'URL shortener > Mode' => Config\Option\UrlShortener\ShortUrlModeConfigOption::class,
'Webhooks > List' => Config\Option\Visit\VisitsWebhooksConfigOption::class,
'Webhooks > Orphan visits' => Config\Option\Visit\OrphanVisitsWebhooksConfigOption::class,
'GeoLite2 license key' => Config\Option\UrlShortener\GeoLiteLicenseKeyConfigOption::class,
'Redirects > Status code (301/302)' => Config\Option\UrlShortener\RedirectStatusCodeConfigOption::class,
'Redirects > Caching life time' => Config\Option\UrlShortener\RedirectCacheLifeTimeConfigOption::class,
Expand All @@ -91,6 +89,9 @@
'QR codes > Default format' => Config\Option\QrCode\DefaultFormatConfigOption::class,
'QR codes > Default error correction' => Config\Option\QrCode\DefaultErrorCorrectionConfigOption::class,
'QR codes > Default round block size' => Config\Option\QrCode\DefaultRoundBlockSizeConfigOption::class,
'QR codes > Default color' => Config\Option\QrCode\DefaultColorConfigOption::class,
'QR codes > Default background color' => Config\Option\QrCode\DefaultBgColorConfigOption::class,
'QR codes > Default logo URL' => Config\Option\QrCode\DefaultLogoUrlConfigOption::class,
'QR codes > Enabled for disabled short URLs'
=> Config\Option\QrCode\EnabledForDisabledShortUrlsConfigOption::class,
],
Expand All @@ -99,12 +100,9 @@
'Base path' => Config\Option\BasePathConfigOption::class,
'Timezone' => Config\Option\TimezoneConfigOption::class,
'Cache > namespace' => Config\Option\Cache\CacheNamespaceConfigOption::class,
'Server > Amount of task workers' => Config\Option\Worker\TaskWorkerNumConfigOption::class,
'Server > Amount of web workers' => Config\Option\Worker\WebWorkerNumConfigOption::class,
],
'INTEGRATIONS' => [
'Redis > servers' => Config\Option\Redis\RedisServersConfigOption::class,
'Redis > decode credentials' => Config\Option\Redis\RedisDecodeCredentialsConfigOption::class,
'Redis > sentinels service' => Config\Option\Redis\RedisSentinelServiceConfigOption::class,
'Redis > Pub/sub enabled' => Config\Option\Redis\RedisPubSubConfigOption::class,
Config\Option\Mercure\EnableMercureConfigOption::class,
Expand Down Expand Up @@ -149,13 +147,8 @@
Config\Option\UrlShortener\EnableTrailingSlashConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\ShortUrlModeConfigOption::class => InvokableFactory::class,
Config\Option\Redis\RedisServersConfigOption::class => InvokableFactory::class,
Config\Option\Redis\RedisDecodeCredentialsConfigOption::class => InvokableFactory::class,
Config\Option\Redis\RedisSentinelServiceConfigOption::class => InvokableFactory::class,
Config\Option\Redis\RedisPubSubConfigOption::class => InvokableFactory::class,
Config\Option\Visit\VisitsWebhooksConfigOption::class => InvokableFactory::class,
Config\Option\Visit\OrphanVisitsWebhooksConfigOption::class => InvokableFactory::class,
Config\Option\Worker\TaskWorkerNumConfigOption::class => InvokableFactory::class,
Config\Option\Worker\WebWorkerNumConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\ShortCodeLengthOption::class => InvokableFactory::class,
Config\Option\Mercure\EnableMercureConfigOption::class => InvokableFactory::class,
Config\Option\Mercure\MercurePublicUrlConfigOption::class => InvokableFactory::class,
Expand Down Expand Up @@ -188,6 +181,9 @@
Config\Option\QrCode\DefaultFormatConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\DefaultErrorCorrectionConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\DefaultRoundBlockSizeConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\DefaultColorConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\DefaultBgColorConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\DefaultLogoUrlConfigOption::class => InvokableFactory::class,
Config\Option\QrCode\EnabledForDisabledShortUrlsConfigOption::class => InvokableFactory::class,
],
],
Expand Down
26 changes: 0 additions & 26 deletions infection.json5

This file was deleted.

2 changes: 1 addition & 1 deletion src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function configure(): void
);
}

protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$config = new ShlinkInitConfig(
initializeDb: ! $this->skipInitDb->get($input),
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SetOptionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
}
}

protected function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$optionTitle = $io->choice('What config option do you want to change', array_keys($this->groups));
Expand Down
26 changes: 26 additions & 0 deletions src/Config/Option/QrCode/DefaultBgColorConfigOption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Installer\Config\Option\QrCode;

use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class DefaultBgColorConfigOption extends BaseConfigOption
{
public function getEnvVar(): string
{
return 'DEFAULT_QR_CODE_BG_COLOR';
}

public function ask(StyleInterface $io, array $currentOptions): ?string
{
return $io->ask(
'What\'s the default background color for generated QR codes',
'#FFFFFF',
ConfigOptionsValidator::validateHexColor(...),
);
}
}
26 changes: 26 additions & 0 deletions src/Config/Option/QrCode/DefaultColorConfigOption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Installer\Config\Option\QrCode;

use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class DefaultColorConfigOption extends BaseConfigOption
{
public function getEnvVar(): string
{
return 'DEFAULT_QR_CODE_COLOR';
}

public function ask(StyleInterface $io, array $currentOptions): ?string
{
return $io->ask(
'What\'s the default foreground color for generated QR codes',
'#000000',
ConfigOptionsValidator::validateHexColor(...),
);
}
}
25 changes: 25 additions & 0 deletions src/Config/Option/QrCode/DefaultLogoUrlConfigOption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Installer\Config\Option\QrCode;

use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class DefaultLogoUrlConfigOption extends BaseConfigOption
{
public function getEnvVar(): string
{
return 'DEFAULT_QR_CODE_LOGO_URL';
}

public function ask(StyleInterface $io, array $currentOptions): ?string
{
return $io->ask(
'Provide a URL for a logo to be placed inside the QR code (leave empty to use no logo)',
validator: ConfigOptionsValidator::validateUrl(...),
);
}
}
6 changes: 2 additions & 4 deletions src/Config/Option/QrCode/DefaultMarginConfigOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
namespace Shlinkio\Shlink\Installer\Config\Option\QrCode;

use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidatorsTrait;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class DefaultMarginConfigOption extends BaseConfigOption
{
use ConfigOptionsValidatorsTrait;

public function getEnvVar(): string
{
return 'DEFAULT_QR_CODE_MARGIN';
Expand All @@ -22,7 +20,7 @@ public function ask(StyleInterface $io, array $currentOptions): int
return $io->ask(
'What\'s the default margin, in pixels, you want generated QR codes to have',
'0',
fn (mixed $value) => $this->validateNumberGreaterThan($value, 0),
fn (mixed $value) => ConfigOptionsValidator::validateNumberGreaterThan($value, 0),
);
}
}
6 changes: 2 additions & 4 deletions src/Config/Option/QrCode/DefaultSizeConfigOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
namespace Shlinkio\Shlink\Installer\Config\Option\QrCode;

use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidatorsTrait;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class DefaultSizeConfigOption extends BaseConfigOption
{
use ConfigOptionsValidatorsTrait;

private const MIN_SIZE = 50;
private const MAX_SIZE = 1000;

Expand All @@ -25,7 +23,7 @@ public function ask(StyleInterface $io, array $currentOptions): int
return $io->ask(
'What\'s the default size, in pixels, you want generated QR codes to have (50 to 1000)',
'300',
fn (mixed $value) => $this->validateNumberBetween($value, self::MIN_SIZE, self::MAX_SIZE),
fn (mixed $value) => ConfigOptionsValidator::validateNumberBetween($value, self::MIN_SIZE, self::MAX_SIZE),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public function ask(StyleInterface $io, array $currentOptions): bool
'Should Shlink be able to generate QR codes for short URLs which are not enabled? (Short URLs are not '
. 'enabled if they have a "valid since" in the future, a "valid until" in the past, or reached the maximum '
. 'amount of allowed visits)',
// Deprecated. Shlink 4.0.0 should change default value to `true`
false,
);
}
}
6 changes: 2 additions & 4 deletions src/Config/Option/RabbitMq/RabbitMqPortConfigOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

namespace Shlinkio\Shlink\Installer\Config\Option\RabbitMq;

use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidatorsTrait;
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator;
use Symfony\Component\Console\Style\StyleInterface;

class RabbitMqPortConfigOption extends AbstractRabbitMqEnabledConfigOption
{
use ConfigOptionsValidatorsTrait;

public function getEnvVar(): string
{
return 'RABBITMQ_PORT';
Expand All @@ -22,7 +20,7 @@ public function ask(StyleInterface $io, array $currentOptions): int
return (int) $io->ask(
'RabbitMQ port',
$useSsl ? '5671' : '5672',
fn (mixed $value) => $this->validateNumberBetween($value, 1, 65535),
fn (mixed $value) => ConfigOptionsValidator::validateNumberBetween($value, 1, 65535),
);
}

Expand Down
Loading

0 comments on commit bbd2a79

Please sign in to comment.