diff --git a/CHANGELOG.md b/CHANGELOG.md index 27cc0f8..b37ef3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ 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). +## [7.0.1] - 2022-02-09 +### Added +* *Nothing* + +### Changed +* *Nothing* + +### Changed +* *Nothing* + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* Fixed non-sqlite questions being asked when importing a pre-7.0 config using SQLite. + + ## [7.0.0] - 2022-01-27 ### Added * [#143](https://github.com/shlinkio/shlink-installer/issues/143) Reworked how config options are "persisted", switching from regular config to an env var map. diff --git a/src/Config/Option/Database/AbstractNonSqliteDependentConfigOption.php b/src/Config/Option/Database/AbstractNonSqliteDependentConfigOption.php index da28de3..0646436 100644 --- a/src/Config/Option/Database/AbstractNonSqliteDependentConfigOption.php +++ b/src/Config/Option/Database/AbstractNonSqliteDependentConfigOption.php @@ -4,10 +4,15 @@ namespace Shlinkio\Shlink\Installer\Config\Option\Database; +use function str_contains; + abstract class AbstractNonSqliteDependentConfigOption extends AbstractDriverDependentConfigOption { protected function shouldBeAskedForDbDriver(string $dbDriver): bool { - return $dbDriver !== DatabaseDriverConfigOption::SQLITE_DRIVER; + // DEPRECATED. + // Should just compare with strict equality ($dbDriver === DatabaseDriverConfigOption::SQLITE_DRIVER) + // Using str_contains instead for backwards compatibility when importing the pdo_sqlite value + return ! str_contains($dbDriver, DatabaseDriverConfigOption::SQLITE_DRIVER); } } diff --git a/test/Config/Option/Database/DatabaseHostConfigOptionTest.php b/test/Config/Option/Database/DatabaseHostConfigOptionTest.php index c7287c0..c33d4a6 100644 --- a/test/Config/Option/Database/DatabaseHostConfigOptionTest.php +++ b/test/Config/Option/Database/DatabaseHostConfigOptionTest.php @@ -86,6 +86,7 @@ public function provideCurrentOptions(): iterable }; yield 'sqlite' => [$buildCollection(DatabaseDriverConfigOption::SQLITE_DRIVER), false]; + yield 'old sqlite' => [$buildCollection('pdo_sqlite'), false]; yield 'mysql' => [$buildCollection(DatabaseDriverConfigOption::MYSQL_DRIVER), true]; yield 'postgres' => [$buildCollection(DatabaseDriverConfigOption::POSTGRES_DRIVER), true]; yield 'mysql with value' => [$buildCollection(DatabaseDriverConfigOption::MYSQL_DRIVER, true), false];