mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-29 21:12:36 +03:00
Updated logic to handle visits threshold env var so that it is disabled if not provided
This commit is contained in:
parent
558a4a2b30
commit
5c8be4b21f
5 changed files with 15 additions and 45 deletions
|
@ -20,6 +20,10 @@
|
||||||
* `tag:create`: Creating orphan tags makes no sense.
|
* `tag:create`: Creating orphan tags makes no sense.
|
||||||
* Params in camelCase format are no longer supported. They all have an equivalent kebab-case replacement. (for example, from `--startDate` to `--start-date`).
|
* Params in camelCase format are no longer supported. They all have an equivalent kebab-case replacement. (for example, from `--startDate` to `--start-date`).
|
||||||
* The `short-url:create` command no longer accepts the `--no-validate-url` flag. Now URLs are never validated, unless `--validate-url` is passed.
|
* The `short-url:create` command no longer accepts the `--no-validate-url` flag. Now URLs are never validated, unless `--validate-url` is passed.
|
||||||
|
* The CLI installer tool entry-points have changed.
|
||||||
|
* `bin/install`: replaced by `vendor/bin/shlink-installer install`
|
||||||
|
* `bin/update`: replaced by `vendor/bin/shlink-installer update`
|
||||||
|
* `bin/set-option`: replaced by `vendor/bin/shlink-installer set-option`
|
||||||
|
|
||||||
### Changes in config
|
### Changes in config
|
||||||
|
|
||||||
|
@ -31,6 +35,8 @@
|
||||||
* `SHORT_DOMAIN_SCHEMA`: Replaced by `IS_HTTPS_ENABLED`.
|
* `SHORT_DOMAIN_SCHEMA`: Replaced by `IS_HTTPS_ENABLED`.
|
||||||
* `USE_HTTPS`: Replaced by `IS_HTTPS_ENABLED`.
|
* `USE_HTTPS`: Replaced by `IS_HTTPS_ENABLED`.
|
||||||
* `VALIDATE_URLS`: There's no replacement. URLs are not validated, unless explicitly requested during creation or edition.
|
* `VALIDATE_URLS`: There's no replacement. URLs are not validated, unless explicitly requested during creation or edition.
|
||||||
|
* The next env vars behavior has changed:
|
||||||
|
* `DELETE_SHORT_URL_THRESHOLD`: Now, if this env var is not provided, the "visits threshold" won't be checked at all when deleting short URLs. Make sure you explicitly provide a value if you want to enable this feature.
|
||||||
|
|
||||||
### Other changes
|
### Other changes
|
||||||
|
|
||||||
|
|
12
bin/install
12
bin/install
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Shlinkio\Shlink;
|
|
||||||
|
|
||||||
use function chdir;
|
|
||||||
use function dirname;
|
|
||||||
|
|
||||||
chdir(dirname(__DIR__));
|
|
||||||
[$install] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php';
|
|
||||||
$install();
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Shlinkio\Shlink;
|
|
||||||
|
|
||||||
use Shlinkio\Shlink\Installer\Command\SetOptionCommand;
|
|
||||||
|
|
||||||
use function chdir;
|
|
||||||
use function dirname;
|
|
||||||
|
|
||||||
chdir(dirname(__DIR__));
|
|
||||||
[,, $installer] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php';
|
|
||||||
$installer(SetOptionCommand::NAME);
|
|
12
bin/update
12
bin/update
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Shlinkio\Shlink;
|
|
||||||
|
|
||||||
use function chdir;
|
|
||||||
use function dirname;
|
|
||||||
|
|
||||||
chdir(dirname(__DIR__));
|
|
||||||
[, $update] = require __DIR__ . '/../vendor/shlinkio/shlink-installer/bin/run.php';
|
|
||||||
$update();
|
|
|
@ -6,13 +6,15 @@ namespace Shlinkio\Shlink;
|
||||||
|
|
||||||
use function Shlinkio\Shlink\Common\env;
|
use function Shlinkio\Shlink\Common\env;
|
||||||
|
|
||||||
use const Shlinkio\Shlink\DEFAULT_DELETE_SHORT_URL_THRESHOLD;
|
return (static function (): array {
|
||||||
|
$threshold = env('DELETE_SHORT_URL_THRESHOLD');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'delete_short_urls' => [
|
'delete_short_urls' => [
|
||||||
'check_visits_threshold' => true,
|
'check_visits_threshold' => $threshold !== null,
|
||||||
'visits_threshold' => (int) env('DELETE_SHORT_URL_THRESHOLD', DEFAULT_DELETE_SHORT_URL_THRESHOLD),
|
'visits_threshold' => (int) ($threshold ?? DEFAULT_DELETE_SHORT_URL_THRESHOLD),
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
})();
|
||||||
|
|
Loading…
Add table
Reference in a new issue