mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8888e33ccc | ||
|
|
250f9f2d89 | ||
|
|
9fd864df0b |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -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).
|
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
|
## [3.7.4] - 2024-03-09
|
||||||
|
### Added
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* [#2021](https://github.com/shlinkio/shlink/issues/2021) Fix infinite GeoLite2 downloads.
|
||||||
|
|
||||||
|
|
||||||
## [3.7.3] - 2024-01-04
|
## [3.7.3] - 2024-01-04
|
||||||
### Added
|
### Added
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"shlinkio/shlink-event-dispatcher": "^3.1",
|
"shlinkio/shlink-event-dispatcher": "^3.1",
|
||||||
"shlinkio/shlink-importer": "^5.2.1",
|
"shlinkio/shlink-importer": "^5.2.1",
|
||||||
"shlinkio/shlink-installer": "^8.7",
|
"shlinkio/shlink-installer": "^8.7",
|
||||||
"shlinkio/shlink-ip-geolocation": "^3.4",
|
"shlinkio/shlink-ip-geolocation": "^4.0",
|
||||||
"shlinkio/shlink-json": "^1.1",
|
"shlinkio/shlink-json": "^1.1",
|
||||||
"spiral/roadrunner": "^2023.2",
|
"spiral/roadrunner": "^2023.2",
|
||||||
"spiral/roadrunner-cli": "^2.5",
|
"spiral/roadrunner-cli": "^2.5",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI;
|
namespace Shlinkio\Shlink\CLI;
|
||||||
|
|
||||||
use GeoIp2\Database\Reader;
|
|
||||||
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
use Laminas\ServiceManager\Factory\InvokableFactory;
|
use Laminas\ServiceManager\Factory\InvokableFactory;
|
||||||
use Shlinkio\Shlink\Common\Doctrine\NoDbNameConnectionFactory;
|
use Shlinkio\Shlink\Common\Doctrine\NoDbNameConnectionFactory;
|
||||||
@@ -17,6 +16,7 @@ use Shlinkio\Shlink\Core\Tag\TagService;
|
|||||||
use Shlinkio\Shlink\Core\Visit;
|
use Shlinkio\Shlink\Core\Visit;
|
||||||
use Shlinkio\Shlink\Installer\Factory\ProcessHelperFactory;
|
use Shlinkio\Shlink\Installer\Factory\ProcessHelperFactory;
|
||||||
use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdater;
|
use Shlinkio\Shlink\IpGeolocation\GeoLite2\DbUpdater;
|
||||||
|
use Shlinkio\Shlink\IpGeolocation\GeoLite2\GeoLite2ReaderFactory;
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
||||||
use Symfony\Component\Console as SymfonyCli;
|
use Symfony\Component\Console as SymfonyCli;
|
||||||
use Symfony\Component\Lock\LockFactory;
|
use Symfony\Component\Lock\LockFactory;
|
||||||
@@ -72,7 +72,7 @@ return [
|
|||||||
ConfigAbstractFactory::class => [
|
ConfigAbstractFactory::class => [
|
||||||
GeoLite\GeolocationDbUpdater::class => [
|
GeoLite\GeolocationDbUpdater::class => [
|
||||||
DbUpdater::class,
|
DbUpdater::class,
|
||||||
Reader::class,
|
GeoLite2ReaderFactory::class,
|
||||||
LOCAL_LOCK_FACTORY,
|
LOCAL_LOCK_FACTORY,
|
||||||
TrackingOptions::class,
|
TrackingOptions::class,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Shlinkio\Shlink\CLI\GeoLite;
|
namespace Shlinkio\Shlink\CLI\GeoLite;
|
||||||
|
|
||||||
use Cake\Chronos\Chronos;
|
use Cake\Chronos\Chronos;
|
||||||
|
use Closure;
|
||||||
use GeoIp2\Database\Reader;
|
use GeoIp2\Database\Reader;
|
||||||
use MaxMind\Db\Reader\Metadata;
|
use MaxMind\Db\Reader\Metadata;
|
||||||
use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException;
|
use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException;
|
||||||
@@ -21,12 +22,19 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface
|
|||||||
{
|
{
|
||||||
private const LOCK_NAME = 'geolocation-db-update';
|
private const LOCK_NAME = 'geolocation-db-update';
|
||||||
|
|
||||||
|
/** @var Closure(): Reader */
|
||||||
|
private readonly Closure $geoLiteDbReaderFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param callable(): Reader $geoLiteDbReaderFactory
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly DbUpdaterInterface $dbUpdater,
|
private readonly DbUpdaterInterface $dbUpdater,
|
||||||
private readonly Reader $geoLiteDbReader,
|
callable $geoLiteDbReaderFactory,
|
||||||
private readonly LockFactory $locker,
|
private readonly LockFactory $locker,
|
||||||
private readonly TrackingOptions $trackingOptions,
|
private readonly TrackingOptions $trackingOptions,
|
||||||
) {
|
) {
|
||||||
|
$this->geoLiteDbReaderFactory = $geoLiteDbReaderFactory(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +65,7 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface
|
|||||||
return $this->downloadNewDb(false, $beforeDownload, $handleProgress);
|
return $this->downloadNewDb(false, $beforeDownload, $handleProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
$meta = $this->geoLiteDbReader->metadata();
|
$meta = ($this->geoLiteDbReaderFactory)()->metadata();
|
||||||
if ($this->buildIsTooOld($meta)) {
|
if ($this->buildIsTooOld($meta)) {
|
||||||
return $this->downloadNewDb(true, $beforeDownload, $handleProgress);
|
return $this->downloadNewDb(true, $beforeDownload, $handleProgress);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class GeolocationDbUpdaterTest extends TestCase
|
|||||||
|
|
||||||
return new GeolocationDbUpdater(
|
return new GeolocationDbUpdater(
|
||||||
$this->dbUpdater,
|
$this->dbUpdater,
|
||||||
$this->geoLiteDbReader,
|
fn () => $this->geoLiteDbReader,
|
||||||
$locker,
|
$locker,
|
||||||
$options ?? new TrackingOptions(),
|
$options ?? new TrackingOptions(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user