mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-19 05:33:52 -06:00
Merge pull request #1420 from acelaya-forks/feature/timezone
Feature/timezone
This commit is contained in:
commit
f8208b7288
@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
|||||||
### Added
|
### Added
|
||||||
* [#1294](https://github.com/shlinkio/shlink/issues/1294) Allowed to specify a specific domain when importing URLs from YOURLS.
|
* [#1294](https://github.com/shlinkio/shlink/issues/1294) Allowed to specify a specific domain when importing URLs from YOURLS.
|
||||||
* [#1416](https://github.com/shlinkio/shlink/issues/1416) Added support to import URLs from Kutt.it.
|
* [#1416](https://github.com/shlinkio/shlink/issues/1416) Added support to import URLs from Kutt.it.
|
||||||
|
* [#1418](https://github.com/shlinkio/shlink/issues/1418) Added support to customize the timezone used by Shlink, falling back to the default one set in PHP config.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* [#1359](https://github.com/shlinkio/shlink/issues/1359) Hidden database commands.
|
* [#1359](https://github.com/shlinkio/shlink/issues/1359) Hidden database commands.
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
"shlinkio/shlink-config": "^1.6",
|
"shlinkio/shlink-config": "^1.6",
|
||||||
"shlinkio/shlink-event-dispatcher": "^2.3",
|
"shlinkio/shlink-event-dispatcher": "^2.3",
|
||||||
"shlinkio/shlink-importer": "dev-main#af0e05e as 3.0",
|
"shlinkio/shlink-importer": "dev-main#af0e05e as 3.0",
|
||||||
"shlinkio/shlink-installer": "dev-develop#d02f256 as 7.1",
|
"shlinkio/shlink-installer": "dev-develop#fbbc8f5 as 7.1",
|
||||||
"shlinkio/shlink-ip-geolocation": "^2.2",
|
"shlinkio/shlink-ip-geolocation": "^2.2",
|
||||||
"symfony/console": "^6.0",
|
"symfony/console": "^6.0",
|
||||||
"symfony/filesystem": "^6.0",
|
"symfony/filesystem": "^6.0",
|
||||||
|
@ -27,6 +27,7 @@ return [
|
|||||||
Option\Redirect\Regular404RedirectConfigOption::class,
|
Option\Redirect\Regular404RedirectConfigOption::class,
|
||||||
Option\Visit\VisitsThresholdConfigOption::class,
|
Option\Visit\VisitsThresholdConfigOption::class,
|
||||||
Option\BasePathConfigOption::class,
|
Option\BasePathConfigOption::class,
|
||||||
|
Option\TimezoneConfigOption::class,
|
||||||
Option\Worker\TaskWorkerNumConfigOption::class,
|
Option\Worker\TaskWorkerNumConfigOption::class,
|
||||||
Option\Worker\WebWorkerNumConfigOption::class,
|
Option\Worker\WebWorkerNumConfigOption::class,
|
||||||
Option\Redis\RedisServersConfigOption::class,
|
Option\Redis\RedisServersConfigOption::class,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Laminas\ServiceManager\ServiceManager;
|
use Laminas\ServiceManager\ServiceManager;
|
||||||
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||||
use Symfony\Component\Lock;
|
use Symfony\Component\Lock;
|
||||||
|
|
||||||
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
||||||
@ -11,6 +12,9 @@ chdir(dirname(__DIR__));
|
|||||||
|
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
// This is one of the first files loaded. Configure the timezone here
|
||||||
|
date_default_timezone_set(EnvVars::TIMEZONE()->loadFromEnv(date_default_timezone_get()));
|
||||||
|
|
||||||
// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
|
// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
|
||||||
// It needs to be placed here as individual config files will not be loaded once config is cached
|
// It needs to be placed here as individual config files will not be loaded once config is cached
|
||||||
if (! class_exists(LOCAL_LOCK_FACTORY)) {
|
if (! class_exists(LOCAL_LOCK_FACTORY)) {
|
||||||
@ -18,7 +22,7 @@ if (! class_exists(LOCAL_LOCK_FACTORY)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build container
|
// Build container
|
||||||
return (function () {
|
return (static function () {
|
||||||
$config = require __DIR__ . '/config.php';
|
$config = require __DIR__ . '/config.php';
|
||||||
$container = new ServiceManager($config['dependencies']);
|
$container = new ServiceManager($config['dependencies']);
|
||||||
$container->setService('config', $config);
|
$container->setService('config', $config);
|
||||||
|
@ -12,7 +12,7 @@ use function array_values;
|
|||||||
use function Functional\contains;
|
use function Functional\contains;
|
||||||
use function Shlinkio\Shlink\Config\env;
|
use function Shlinkio\Shlink\Config\env;
|
||||||
|
|
||||||
// TODO Convert to enum
|
// TODO Convert to enum after dropping PHP 8.0 support
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method static EnvVars DELETE_SHORT_URL_THRESHOLD()
|
* @method static EnvVars DELETE_SHORT_URL_THRESHOLD()
|
||||||
@ -62,6 +62,7 @@ use function Shlinkio\Shlink\Config\env;
|
|||||||
* @method static EnvVars DEFAULT_DOMAIN()
|
* @method static EnvVars DEFAULT_DOMAIN()
|
||||||
* @method static EnvVars AUTO_RESOLVE_TITLES()
|
* @method static EnvVars AUTO_RESOLVE_TITLES()
|
||||||
* @method static EnvVars REDIRECT_APPEND_EXTRA_PATH()
|
* @method static EnvVars REDIRECT_APPEND_EXTRA_PATH()
|
||||||
|
* @method static EnvVars TIMEZONE()
|
||||||
* @method static EnvVars VISITS_WEBHOOKS()
|
* @method static EnvVars VISITS_WEBHOOKS()
|
||||||
* @method static EnvVars NOTIFY_ORPHAN_VISITS_TO_WEBHOOKS()
|
* @method static EnvVars NOTIFY_ORPHAN_VISITS_TO_WEBHOOKS()
|
||||||
*/
|
*/
|
||||||
@ -114,6 +115,7 @@ final class EnvVars
|
|||||||
public const DEFAULT_DOMAIN = 'DEFAULT_DOMAIN';
|
public const DEFAULT_DOMAIN = 'DEFAULT_DOMAIN';
|
||||||
public const AUTO_RESOLVE_TITLES = 'AUTO_RESOLVE_TITLES';
|
public const AUTO_RESOLVE_TITLES = 'AUTO_RESOLVE_TITLES';
|
||||||
public const REDIRECT_APPEND_EXTRA_PATH = 'REDIRECT_APPEND_EXTRA_PATH';
|
public const REDIRECT_APPEND_EXTRA_PATH = 'REDIRECT_APPEND_EXTRA_PATH';
|
||||||
|
public const TIMEZONE = 'TIMEZONE';
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
public const VISITS_WEBHOOKS = 'VISITS_WEBHOOKS';
|
public const VISITS_WEBHOOKS = 'VISITS_WEBHOOKS';
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
@ -77,6 +77,7 @@ class EnvVarsTest extends TestCase
|
|||||||
EnvVars::DEFAULT_DOMAIN,
|
EnvVars::DEFAULT_DOMAIN,
|
||||||
EnvVars::AUTO_RESOLVE_TITLES,
|
EnvVars::AUTO_RESOLVE_TITLES,
|
||||||
EnvVars::REDIRECT_APPEND_EXTRA_PATH,
|
EnvVars::REDIRECT_APPEND_EXTRA_PATH,
|
||||||
|
EnvVars::TIMEZONE,
|
||||||
EnvVars::VISITS_WEBHOOKS,
|
EnvVars::VISITS_WEBHOOKS,
|
||||||
EnvVars::NOTIFY_ORPHAN_VISITS_TO_WEBHOOKS,
|
EnvVars::NOTIFY_ORPHAN_VISITS_TO_WEBHOOKS,
|
||||||
], $list);
|
], $list);
|
||||||
|
Loading…
Reference in New Issue
Block a user