diff --git a/CHANGELOG.md b/CHANGELOG.md index d95519d7..cb9c59e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * [#429](https://github.com/shlinkio/shlink/issues/429) Added support for PHP 7.4 * [#529](https://github.com/shlinkio/shlink/issues/529) Created an UPGRADING.md file explaining how to upgrade from v1.x to v2.x +* [#594](https://github.com/shlinkio/shlink/issues/594) Updated external shlink packages, including installer v4.0, which adds the option to ask for the redis cluster config. #### Changed 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 8a1b075f..80c29769 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "guzzlehttp/guzzle": "^6.5.1", "laminas/laminas-config": "^3.3", "laminas/laminas-config-aggregator": "^1.1", - "laminas/laminas-dependency-plugin": "^0.2", + "laminas/laminas-dependency-plugin": "^1.0", "laminas/laminas-diactoros": "^2.1.3", "laminas/laminas-inputfilter": "^2.10", "laminas/laminas-paginator": "^2.8", @@ -47,10 +47,10 @@ "phly/phly-event-dispatcher": "^1.0", "predis/predis": "^1.1", "pugx/shortid-php": "^0.5", - "shlinkio/shlink-common": "^2.4", - "shlinkio/shlink-event-dispatcher": "^1.1", - "shlinkio/shlink-installer": "^3.3", - "shlinkio/shlink-ip-geolocation": "^1.2", + "shlinkio/shlink-common": "^2.5", + "shlinkio/shlink-event-dispatcher": "^1.3", + "shlinkio/shlink-installer": "^4.0", + "shlinkio/shlink-ip-geolocation": "^1.3", "symfony/console": "^5.0", "symfony/filesystem": "^5.0", "symfony/lock": "^5.0", @@ -64,7 +64,7 @@ "phpunit/phpunit": "^8.3", "roave/security-advisories": "dev-master", "shlinkio/php-coding-standard": "~2.1.0", - "shlinkio/shlink-test-utils": "^1.2", + "shlinkio/shlink-test-utils": "^1.3", "symfony/var-dumper": "^5.0" }, "autoload": { diff --git a/config/autoload/installer.global.php b/config/autoload/installer.global.php index 402e6bb3..296c0635 100644 --- a/config/autoload/installer.global.php +++ b/config/autoload/installer.global.php @@ -2,51 +2,43 @@ 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, + Option\RedisServersConfigOption::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', + ], ], ], diff --git a/config/autoload/redis.local.php.local b/config/autoload/redis.local.php.local index f89201f1..08dbae32 100644 --- a/config/autoload/redis.local.php.local +++ b/config/autoload/redis.local.php.local @@ -1,13 +1,16 @@ [ - 'servers' => 'tcp://shlink_redis:6379', -// 'servers' => [ -// 'tcp://shlink_redis:6379', -// ], + 'cache' => [ + 'redis' => [ + 'servers' => 'tcp://shlink_redis:6379', +// 'servers' => [ +// 'tcp://shlink_redis:6379', +// ], + ], ], 'dependencies' => [ diff --git a/data/migrations/Version20160820191203.php b/data/migrations/Version20160820191203.php index 2d8a7c38..d0a4d673 100644 --- a/data/migrations/Version20160820191203.php +++ b/data/migrations/Version20160820191203.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace ShlinkMigrations; use Doctrine\DBAL\Schema\Schema; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; /** @@ -30,12 +30,12 @@ class Version20160820191203 extends AbstractMigration private function createTagsTable(Schema $schema): void { $table = $schema->createTable('tags'); - $table->addColumn('id', Type::BIGINT, [ + $table->addColumn('id', Types::BIGINT, [ 'unsigned' => true, 'autoincrement' => true, 'notnull' => true, ]); - $table->addColumn('name', Type::STRING, [ + $table->addColumn('name', Types::STRING, [ 'length' => 255, 'notnull' => true, ]); @@ -47,11 +47,11 @@ class Version20160820191203 extends AbstractMigration private function createShortUrlsInTagsTable(Schema $schema): void { $table = $schema->createTable('short_urls_in_tags'); - $table->addColumn('short_url_id', Type::BIGINT, [ + $table->addColumn('short_url_id', Types::BIGINT, [ 'unsigned' => true, 'notnull' => true, ]); - $table->addColumn('tag_id', Type::BIGINT, [ + $table->addColumn('tag_id', Types::BIGINT, [ 'unsigned' => true, 'notnull' => true, ]); diff --git a/data/migrations/Version20171021093246.php b/data/migrations/Version20171021093246.php index 6e42d775..b66a2c3f 100644 --- a/data/migrations/Version20171021093246.php +++ b/data/migrations/Version20171021093246.php @@ -6,7 +6,7 @@ namespace ShlinkMigrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; /** @@ -24,10 +24,10 @@ class Version20171021093246 extends AbstractMigration return; } - $shortUrls->addColumn('valid_since', Type::DATETIME, [ + $shortUrls->addColumn('valid_since', Types::DATETIME, [ 'notnull' => false, ]); - $shortUrls->addColumn('valid_until', Type::DATETIME, [ + $shortUrls->addColumn('valid_until', Types::DATETIME, [ 'notnull' => false, ]); } diff --git a/data/migrations/Version20171022064541.php b/data/migrations/Version20171022064541.php index 36bfdc7b..7ff39666 100644 --- a/data/migrations/Version20171022064541.php +++ b/data/migrations/Version20171022064541.php @@ -6,7 +6,7 @@ namespace ShlinkMigrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; /** @@ -24,7 +24,7 @@ class Version20171022064541 extends AbstractMigration return; } - $shortUrls->addColumn('max_visits', Type::INTEGER, [ + $shortUrls->addColumn('max_visits', Types::INTEGER, [ 'unsigned' => true, 'notnull' => false, ]); diff --git a/data/migrations/Version20181020060559.php b/data/migrations/Version20181020060559.php index 86d46358..5b46b6df 100644 --- a/data/migrations/Version20181020060559.php +++ b/data/migrations/Version20181020060559.php @@ -8,7 +8,7 @@ use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; /** @@ -35,7 +35,7 @@ final class Version20181020060559 extends AbstractMigration { foreach ($columnNames as $name) { if (! $visitLocations->hasColumn($name)) { - $visitLocations->addColumn($name, Type::STRING, ['notnull' => false]); + $visitLocations->addColumn($name, Types::STRING, ['notnull' => false]); } } } diff --git a/data/migrations/Version20190930165521.php b/data/migrations/Version20190930165521.php index 120f1c16..2e4e8f50 100644 --- a/data/migrations/Version20190930165521.php +++ b/data/migrations/Version20190930165521.php @@ -6,7 +6,7 @@ namespace ShlinkMigrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; final class Version20190930165521 extends AbstractMigration @@ -22,19 +22,19 @@ final class Version20190930165521 extends AbstractMigration } $domains = $schema->createTable('domains'); - $domains->addColumn('id', Type::BIGINT, [ + $domains->addColumn('id', Types::BIGINT, [ 'unsigned' => true, 'autoincrement' => true, 'notnull' => true, ]); - $domains->addColumn('authority', Type::STRING, [ + $domains->addColumn('authority', Types::STRING, [ 'length' => 512, 'notnull' => true, ]); $domains->addUniqueIndex(['authority']); $domains->setPrimaryKey(['id']); - $shortUrls->addColumn('domain_id', Type::BIGINT, [ + $shortUrls->addColumn('domain_id', Types::BIGINT, [ 'unsigned' => true, 'notnull' => false, ]); diff --git a/data/migrations/Version20200105165647.php b/data/migrations/Version20200105165647.php new file mode 100644 index 00000000..24b9f984 --- /dev/null +++ b/data/migrations/Version20200105165647.php @@ -0,0 +1,71 @@ + 'latitude', 'lon' => 'longitude']; + + public function preUp(Schema $schema): void + { + foreach (self::COLUMNS as $columnName) { + $qb = $this->connection->createQueryBuilder(); + $qb->update('visit_locations') + ->set($columnName, '"0"') + ->where($columnName . '=""') + ->orWhere($columnName . ' IS NULL') + ->execute(); + } + } + + /** + * @throws DBALException + */ + public function up(Schema $schema): void + { + $visitLocations = $schema->getTable('visit_locations'); + + foreach (self::COLUMNS as $newName => $oldName) { + $visitLocations->addColumn($newName, Types::FLOAT); + } + } + + public function postUp(Schema $schema): void + { + foreach (self::COLUMNS as $newName => $oldName) { + $qb = $this->connection->createQueryBuilder(); + $qb->update('visit_locations') + ->set($newName, $oldName) + ->execute(); + } + } + + public function preDown(Schema $schema): void + { + foreach (self::COLUMNS as $newName => $oldName) { + $qb = $this->connection->createQueryBuilder(); + $qb->update('visit_locations') + ->set($oldName, $newName) + ->execute(); + } + } + + /** + * @throws DBALException + */ + public function down(Schema $schema): void + { + $visitLocations = $schema->getTable('visit_locations'); + + foreach (self::COLUMNS as $colName => $oldName) { + $visitLocations->dropColumn($colName); + } + } +} diff --git a/data/migrations/Version20200106215144.php b/data/migrations/Version20200106215144.php new file mode 100644 index 00000000..8969441b --- /dev/null +++ b/data/migrations/Version20200106215144.php @@ -0,0 +1,41 @@ +getTable('visit_locations'); + + foreach (self::COLUMNS as $colName) { + $visitLocations->dropColumn($colName); + } + } + + /** + * @throws DBALException + */ + public function down(Schema $schema): void + { + $visitLocations = $schema->getTable('visit_locations'); + + foreach (self::COLUMNS as $colName) { + $visitLocations->addColumn($colName, Types::STRING, [ + 'notnull' => false, + ]); + } + } +} diff --git a/docker/config/shlink_in_docker.local.php b/docker/config/shlink_in_docker.local.php index 0da6a9e5..7eba5560 100644 --- a/docker/config/shlink_in_docker.local.php +++ b/docker/config/shlink_in_docker.local.php @@ -62,6 +62,12 @@ $helper = new class { $webhooks = env('VISITS_WEBHOOKS'); return $webhooks === null ? [] : explode(',', $webhooks); } + + public function getRedisConfig(): ?array + { + $redisServers = env('REDIS_SERVERS'); + return $redisServers === null ? null : ['servers' => $redisServers]; + } }; return [ @@ -112,8 +118,8 @@ return [ ], ], - 'redis' => [ - 'servers' => env('REDIS_SERVERS'), + 'cache' => [ + 'redis' => $helper->getRedisConfig(), ], 'router' => [ diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Domain.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Domain.php index b3afe195..de7252ee 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Domain.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Domain.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine @@ -13,13 +13,13 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('domains'); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->columnName('id') ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); -$builder->createField('authority', Type::STRING) +$builder->createField('authority', Types::STRING) ->unique() ->build(); diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php index 76e5ae7b..0d24d555 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; @@ -15,19 +15,19 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('short_urls') ->setCustomRepositoryClass(Repository\ShortUrlRepository::class); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->columnName('id') ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); -$builder->createField('longUrl', Type::STRING) +$builder->createField('longUrl', Types::STRING) ->columnName('original_url') ->length(2048) ->build(); -$builder->createField('shortCode', Type::STRING) +$builder->createField('shortCode', Types::STRING) ->columnName('short_code') ->length(255) ->build(); @@ -46,7 +46,7 @@ $builder->createField('validUntil', ChronosDateTimeType::CHRONOS_DATETIME) ->nullable() ->build(); -$builder->createField('maxVisits', Type::INTEGER) +$builder->createField('maxVisits', Types::INTEGER) ->columnName('max_visits') ->nullable() ->build(); diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php index 8ecaa2c6..09a98151 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine @@ -14,13 +14,13 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('tags') ->setCustomRepositoryClass(Repository\TagRepository::class); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->columnName('id') ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); -$builder->createField('name', Type::STRING) +$builder->createField('name', Types::STRING) ->unique() ->build(); diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php index c30b83c9..6770f9d3 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; @@ -16,14 +16,14 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('visits') ->setCustomRepositoryClass(Repository\VisitRepository::class); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->columnName('id') ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); -$builder->createField('referer', Type::STRING) +$builder->createField('referer', Types::STRING) ->nullable() ->length(Visitor::REFERER_MAX_LENGTH) ->build(); @@ -32,13 +32,13 @@ $builder->createField('date', ChronosDateTimeType::CHRONOS_DATETIME) ->columnName('`date`') ->build(); -$builder->createField('remoteAddr', Type::STRING) +$builder->createField('remoteAddr', Types::STRING) ->columnName('remote_addr') ->length(Visitor::REMOTE_ADDRESS_MAX_LENGTH) ->nullable() ->build(); -$builder->createField('userAgent', Type::STRING) +$builder->createField('userAgent', Types::STRING) ->columnName('user_agent') ->length(Visitor::USER_AGENT_MAX_LENGTH) ->nullable() diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php index 073214d3..117c2acc 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine @@ -13,7 +13,7 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('visit_locations'); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->columnName('id') ->makePrimaryKey() ->generatedValue('IDENTITY') @@ -25,14 +25,22 @@ $columns = [ 'country_name' => 'countryName', 'region_name' => 'regionName', 'city_name' => 'cityName', - 'latitude' => 'latitude', - 'longitude' => 'longitude', 'timezone' => 'timezone', ]; foreach ($columns as $columnName => $fieldName) { - $builder->createField($fieldName, Type::STRING) - ->columnName($columnName) - ->nullable() - ->build(); + $builder->createField($fieldName, Types::STRING) + ->columnName($columnName) + ->nullable() + ->build(); } + +$builder->createField('latitude', Types::FLOAT) + ->columnName('lat') + ->nullable(false) + ->build(); + +$builder->createField('longitude', Types::FLOAT) + ->columnName('lon') + ->nullable(false) + ->build(); diff --git a/module/Core/src/Config/SimplifiedConfigParser.php b/module/Core/src/Config/SimplifiedConfigParser.php index 651066d4..fa7a4acb 100644 --- a/module/Core/src/Config/SimplifiedConfigParser.php +++ b/module/Core/src/Config/SimplifiedConfigParser.php @@ -27,7 +27,7 @@ class SimplifiedConfigParser 'base_url_redirect_to' => ['not_found_redirects', 'base_path'], 'db_config' => ['entity_manager', 'connection'], 'delete_short_url_threshold' => ['delete_short_urls', 'visits_threshold'], - 'redis_servers' => ['redis', 'servers'], + 'redis_servers' => ['cache', 'redis', 'servers'], 'base_path' => ['router', 'base_path'], 'web_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'worker_num'], 'task_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'task_worker_num'], diff --git a/module/Core/src/Entity/Visit.php b/module/Core/src/Entity/Visit.php index 38c17565..8ada8176 100644 --- a/module/Core/src/Entity/Visit.php +++ b/module/Core/src/Entity/Visit.php @@ -15,10 +15,10 @@ use Shlinkio\Shlink\Core\Visit\Model\VisitLocationInterface; class Visit extends AbstractEntity implements JsonSerializable { - private string $referer; + private string $referer = ''; private Chronos $date; - private ?string $remoteAddr; - private string $userAgent; + private ?string $remoteAddr = null; + private string $userAgent = ''; private ShortUrl $shortUrl; private ?VisitLocation $visitLocation = null; diff --git a/module/Core/test/Config/SimplifiedConfigParserTest.php b/module/Core/test/Config/SimplifiedConfigParserTest.php index d92399cf..1d4f3b8d 100644 --- a/module/Core/test/Config/SimplifiedConfigParserTest.php +++ b/module/Core/test/Config/SimplifiedConfigParserTest.php @@ -97,10 +97,12 @@ class SimplifiedConfigParserTest extends TestCase ], ], - 'redis' => [ - 'servers' => [ - 'tcp://1.1.1.1:1111', - 'tcp://1.2.2.2:2222', + 'cache' => [ + 'redis' => [ + 'servers' => [ + 'tcp://1.1.1.1:1111', + 'tcp://1.2.2.2:2222', + ], ], ], diff --git a/module/Rest/config/entities-mappings/Shlinkio.Shlink.Rest.Entity.ApiKey.php b/module/Rest/config/entities-mappings/Shlinkio.Shlink.Rest.Entity.ApiKey.php index 3b7c2e60..5bc5aec9 100644 --- a/module/Rest/config/entities-mappings/Shlinkio.Shlink.Rest.Entity.ApiKey.php +++ b/module/Rest/config/entities-mappings/Shlinkio.Shlink.Rest.Entity.ApiKey.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Rest; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; @@ -14,13 +14,13 @@ $builder = new ClassMetadataBuilder($metadata); $builder->setTable('api_keys'); -$builder->createField('id', Type::BIGINT) +$builder->createField('id', Types::BIGINT) ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); -$builder->createField('key', Type::STRING) +$builder->createField('key', Types::STRING) ->columnName('`key`') ->unique() ->build(); @@ -30,5 +30,5 @@ $builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME) ->nullable() ->build(); -$builder->createField('enabled', Type::BOOLEAN) +$builder->createField('enabled', Types::BOOLEAN) ->build();