mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-28 20:41:41 +03:00
commit
d945c28a75
9 changed files with 104 additions and 11 deletions
20
CHANGELOG.md
20
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).
|
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
|
## [2.4.2] - 2020-11-22
|
||||||
|
### Added
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* [#904](https://github.com/shlinkio/shlink/issues/904) Explicitly added missing "Domains" and "Integrations" tags to swagger docs.
|
||||||
|
* [#901](https://github.com/shlinkio/shlink/issues/901) Ensured domains which are not in use on any short URL are not returned on the list of domains.
|
||||||
|
* [#899](https://github.com/shlinkio/shlink/issues/899) Avoided filesystem errors produced while downloading geolite DB files on several shlink instances that share the same filesystem.
|
||||||
|
* [#827](https://github.com/shlinkio/shlink/issues/827) Fixed swoole config getting loaded in config cache if a console command is run before any web execution, when swoole extension is enabled, making subsequent non-swoole web requests fail.
|
||||||
|
|
||||||
|
|
||||||
## [2.4.1] - 2020-11-10
|
## [2.4.1] - 2020-11-10
|
||||||
### Added
|
### Added
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"laminas/laminas-paginator": "^2.8",
|
"laminas/laminas-paginator": "^2.8",
|
||||||
"laminas/laminas-servicemanager": "^3.4",
|
"laminas/laminas-servicemanager": "^3.4",
|
||||||
"laminas/laminas-stdlib": "^3.2",
|
"laminas/laminas-stdlib": "^3.2",
|
||||||
"lcobucci/jwt": "^4.0@alpha",
|
"lcobucci/jwt": "^4.0@alpha <4.0@beta",
|
||||||
"league/uri": "^6.2",
|
"league/uri": "^6.2",
|
||||||
"lstrojny/functional-php": "^1.9",
|
"lstrojny/functional-php": "^1.9",
|
||||||
"mezzio/mezzio": "^3.2",
|
"mezzio/mezzio": "^3.2",
|
||||||
|
|
|
@ -7,6 +7,9 @@ use Laminas\ConfigAggregator\ConfigAggregator;
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
ConfigAggregator::ENABLE_CACHE => true,
|
|
||||||
|
// Disabling config cache for cli, ensures it's never used for swoole and also that console commands don't generate
|
||||||
|
// a cache file that's then used by non-swoole web executions
|
||||||
|
ConfigAggregator::ENABLE_CACHE => PHP_SAPI !== 'cli',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -6,8 +6,8 @@ return [
|
||||||
|
|
||||||
'geolite2' => [
|
'geolite2' => [
|
||||||
'db_location' => __DIR__ . '/../../data/GeoLite2-City.mmdb',
|
'db_location' => __DIR__ . '/../../data/GeoLite2-City.mmdb',
|
||||||
'temp_dir' => sys_get_temp_dir(),
|
'temp_dir' => __DIR__ . '/../../data',
|
||||||
'license_key' => 'G4Lm0C60yJsnkdPi',
|
'license_key' => 'G4Lm0C60yJsnkdPi', // Deprecated. Remove hardcoded license on v3
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -99,8 +99,6 @@ $helper = new class {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'config_cache_enabled' => false,
|
|
||||||
|
|
||||||
'app_options' => [
|
'app_options' => [
|
||||||
'disable_track_param' => env('DISABLE_TRACK_PARAM'),
|
'disable_track_param' => env('DISABLE_TRACK_PARAM'),
|
||||||
],
|
],
|
||||||
|
|
|
@ -50,6 +50,14 @@
|
||||||
"name": "Visits",
|
"name": "Visits",
|
||||||
"description": "Operations to manage visits on short URLs"
|
"description": "Operations to manage visits on short URLs"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Domains",
|
||||||
|
"description": "Operations to manage domains used on short URLs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Integrations",
|
||||||
|
"description": "Handle services with which shlink is integrated"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Monitoring",
|
"name": "Monitoring",
|
||||||
"description": "Public endpoints designed to monitor the service"
|
"description": "Public endpoints designed to monitor the service"
|
||||||
|
|
|
@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||||
namespace Shlinkio\Shlink\Core\Domain\Repository;
|
namespace Shlinkio\Shlink\Core\Domain\Repository;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Shlinkio\Shlink\Core\Entity\Domain;
|
use Shlinkio\Shlink\Core\Entity\Domain;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
|
||||||
class DomainRepository extends EntityRepository implements DomainRepositoryInterface
|
class DomainRepository extends EntityRepository implements DomainRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -14,7 +16,9 @@ class DomainRepository extends EntityRepository implements DomainRepositoryInter
|
||||||
*/
|
*/
|
||||||
public function findDomainsWithout(?string $excludedAuthority = null): array
|
public function findDomainsWithout(?string $excludedAuthority = null): array
|
||||||
{
|
{
|
||||||
$qb = $this->createQueryBuilder('d')->orderBy('d.authority', 'ASC');
|
$qb = $this->createQueryBuilder('d');
|
||||||
|
$qb->join(ShortUrl::class, 's', Join::WITH, 's.domain = d')
|
||||||
|
->orderBy('d.authority', 'ASC');
|
||||||
|
|
||||||
if ($excludedAuthority !== null) {
|
if ($excludedAuthority !== null) {
|
||||||
$qb->where($qb->expr()->neq('d.authority', ':excludedAuthority'))
|
$qb->where($qb->expr()->neq('d.authority', ':excludedAuthority'))
|
||||||
|
|
|
@ -6,11 +6,15 @@ namespace ShlinkioTest\Shlink\Core\Domain\Repository;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Domain\Repository\DomainRepository;
|
use Shlinkio\Shlink\Core\Domain\Repository\DomainRepository;
|
||||||
use Shlinkio\Shlink\Core\Entity\Domain;
|
use Shlinkio\Shlink\Core\Entity\Domain;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||||
|
use Shlinkio\Shlink\Core\ShortUrl\Resolver\ShortUrlRelationResolverInterface;
|
||||||
|
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||||
use Shlinkio\Shlink\TestUtils\DbTest\DatabaseTestCase;
|
use Shlinkio\Shlink\TestUtils\DbTest\DatabaseTestCase;
|
||||||
|
|
||||||
class DomainRepositoryTest extends DatabaseTestCase
|
class DomainRepositoryTest extends DatabaseTestCase
|
||||||
{
|
{
|
||||||
protected const ENTITIES_TO_EMPTY = [Domain::class];
|
protected const ENTITIES_TO_EMPTY = [ShortUrl::class, Domain::class];
|
||||||
|
|
||||||
private DomainRepository $repo;
|
private DomainRepository $repo;
|
||||||
|
|
||||||
|
@ -23,12 +27,23 @@ class DomainRepositoryTest extends DatabaseTestCase
|
||||||
public function findDomainsReturnsExpectedResult(): void
|
public function findDomainsReturnsExpectedResult(): void
|
||||||
{
|
{
|
||||||
$fooDomain = new Domain('foo.com');
|
$fooDomain = new Domain('foo.com');
|
||||||
$barDomain = new Domain('bar.com');
|
|
||||||
$bazDomain = new Domain('baz.com');
|
|
||||||
|
|
||||||
$this->getEntityManager()->persist($fooDomain);
|
$this->getEntityManager()->persist($fooDomain);
|
||||||
|
$fooShortUrl = $this->createShortUrl($fooDomain);
|
||||||
|
$this->getEntityManager()->persist($fooShortUrl);
|
||||||
|
|
||||||
|
$barDomain = new Domain('bar.com');
|
||||||
$this->getEntityManager()->persist($barDomain);
|
$this->getEntityManager()->persist($barDomain);
|
||||||
|
$barShortUrl = $this->createShortUrl($barDomain);
|
||||||
|
$this->getEntityManager()->persist($barShortUrl);
|
||||||
|
|
||||||
|
$bazDomain = new Domain('baz.com');
|
||||||
$this->getEntityManager()->persist($bazDomain);
|
$this->getEntityManager()->persist($bazDomain);
|
||||||
|
$bazShortUrl = $this->createShortUrl($bazDomain);
|
||||||
|
$this->getEntityManager()->persist($bazShortUrl);
|
||||||
|
|
||||||
|
$detachedDomain = new Domain('detached.com');
|
||||||
|
$this->getEntityManager()->persist($detachedDomain);
|
||||||
|
|
||||||
$this->getEntityManager()->flush();
|
$this->getEntityManager()->flush();
|
||||||
|
|
||||||
self::assertEquals([$barDomain, $bazDomain, $fooDomain], $this->repo->findDomainsWithout());
|
self::assertEquals([$barDomain, $bazDomain, $fooDomain], $this->repo->findDomainsWithout());
|
||||||
|
@ -36,4 +51,30 @@ class DomainRepositoryTest extends DatabaseTestCase
|
||||||
self::assertEquals([$bazDomain, $fooDomain], $this->repo->findDomainsWithout('bar.com'));
|
self::assertEquals([$bazDomain, $fooDomain], $this->repo->findDomainsWithout('bar.com'));
|
||||||
self::assertEquals([$barDomain, $fooDomain], $this->repo->findDomainsWithout('baz.com'));
|
self::assertEquals([$barDomain, $fooDomain], $this->repo->findDomainsWithout('baz.com'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createShortUrl(Domain $domain): ShortUrl
|
||||||
|
{
|
||||||
|
return new ShortUrl(
|
||||||
|
'foo',
|
||||||
|
ShortUrlMeta::fromRawData(['domain' => $domain->getAuthority()]),
|
||||||
|
new class ($domain) implements ShortUrlRelationResolverInterface {
|
||||||
|
private Domain $domain;
|
||||||
|
|
||||||
|
public function __construct(Domain $domain)
|
||||||
|
{
|
||||||
|
$this->domain = $domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveDomain(?string $domain): ?Domain
|
||||||
|
{
|
||||||
|
return $this->domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveApiKey(?string $key): ?ApiKey
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
19
module/Rest/test-api/Fixtures/DomainFixture.php
Normal file
19
module/Rest/test-api/Fixtures/DomainFixture.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ShlinkioApiTest\Shlink\Rest\Fixtures;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\Domain;
|
||||||
|
|
||||||
|
class DomainFixture extends AbstractFixture
|
||||||
|
{
|
||||||
|
public function load(ObjectManager $manager): void
|
||||||
|
{
|
||||||
|
$orphanDomain = new Domain('this_domain_is_detached.com');
|
||||||
|
$manager->persist($orphanDomain);
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue