mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 09:43:13 +08:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aca90ef907 | ||
|
|
ddfccea901 | ||
|
|
6c6cfb4fc3 | ||
|
|
482b792adf | ||
|
|
d3a86f4fae | ||
|
|
6de1d1057b | ||
|
|
d7e68d29de | ||
|
|
b8f24c3584 | ||
|
|
26c455616b | ||
|
|
909ecc2387 | ||
|
|
a9dff56a92 | ||
|
|
ef0dd416f9 | ||
|
|
781ca39938 | ||
|
|
ccb9d5e83a | ||
|
|
91f08c9ead | ||
|
|
433a5a923d | ||
|
|
501a933d2e | ||
|
|
633f3b728f | ||
|
|
be34600494 | ||
|
|
9577a4da4b | ||
|
|
a24688b92a | ||
|
|
91442a3379 | ||
|
|
0bd9f1e19f | ||
|
|
c233e807c2 | ||
|
|
a002c60183 | ||
|
|
c522879c64 | ||
|
|
d04abd1f75 | ||
|
|
c2feffa50c | ||
|
|
e282521040 | ||
|
|
d7b7db670f | ||
|
|
5a500a00d7 | ||
|
|
9fb07f4039 | ||
|
|
cb23d38b38 | ||
|
|
af7c11665c | ||
|
|
7f4678261e | ||
|
|
a1c8c51f70 | ||
|
|
6bbe66e8f1 | ||
|
|
5f0d281255 | ||
|
|
fd468cd4e9 | ||
|
|
1f7a94794d | ||
|
|
0232f68b91 | ||
|
|
070055a8b9 | ||
|
|
a3bbd06fe3 | ||
|
|
68b4cfbae0 | ||
|
|
97a54aef06 | ||
|
|
297c88c334 | ||
|
|
fef5390a62 | ||
|
|
08d18b1dc1 | ||
|
|
16a2349d86 | ||
|
|
18d9815e88 | ||
|
|
c8346bc5f8 | ||
|
|
2d85a207d1 | ||
|
|
0df8f17e7b | ||
|
|
29645e77cf | ||
|
|
ea76092681 | ||
|
|
c12e13dfd7 | ||
|
|
566940349f | ||
|
|
391ef5c323 | ||
|
|
70264be8e7 | ||
|
|
6208f6f0d5 | ||
|
|
c422a14c5c | ||
|
|
fbeb959317 | ||
|
|
e53ffc8d43 | ||
|
|
453ca1728e | ||
|
|
d10583c7c5 | ||
|
|
a9d213990e | ||
|
|
6321cc0f2d | ||
|
|
3e5f0b2451 | ||
|
|
4ad167eb30 | ||
|
|
01a4f9f867 | ||
|
|
b93d65ddc1 | ||
|
|
9ef9da0870 | ||
|
|
ba2053bd3a | ||
|
|
1260da85a7 | ||
|
|
960c7a0835 | ||
|
|
574f407a90 | ||
|
|
abf802093c | ||
|
|
7ca22f8629 | ||
|
|
6300982b07 | ||
|
|
54cb40f6ed | ||
|
|
8256f0c757 |
24
.gitattributes
vendored
Normal file
24
.gitattributes
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/data/infra export-ignore
|
||||||
|
/docs export-ignore
|
||||||
|
/module/CLI/test export-ignore
|
||||||
|
/module/CLI/test-resources export-ignore
|
||||||
|
/module/Common/test export-ignore
|
||||||
|
/module/Common/test-func export-ignore
|
||||||
|
/module/Core/test export-ignore
|
||||||
|
/module/Core/test-func export-ignore
|
||||||
|
/module/Rest/test export-ignore
|
||||||
|
.env.dist export-ignore
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.gitignore export-ignore
|
||||||
|
.phpstorm.meta.php export-ignore
|
||||||
|
.scrutinizer.yml export-ignore
|
||||||
|
.travis.yml export-ignore
|
||||||
|
build.sh export-ignore
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
docker-compose.override.yml.dist export-ignore
|
||||||
|
docker-compose.yml export-ignore
|
||||||
|
func_tests_bootstrap.php export-ignore
|
||||||
|
indocker export-ignore
|
||||||
|
phpcs.xml export-ignore
|
||||||
|
phpunit.xml.dist export-ignore
|
||||||
|
phpunit-func.xml export-ignore
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ vendor/
|
|||||||
.env
|
.env
|
||||||
data/database.sqlite
|
data/database.sqlite
|
||||||
docs/swagger-ui
|
docs/swagger-ui
|
||||||
|
docker-compose.override.yml
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
extension="memcached.so"
|
|
||||||
@@ -6,11 +6,13 @@ branches:
|
|||||||
- develop
|
- develop
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.6
|
|
||||||
- 7
|
- 7
|
||||||
- 7.1
|
- 7.1
|
||||||
|
- 7.2
|
||||||
|
|
||||||
before_install: phpenv config-add .travis-php.ini
|
before_install:
|
||||||
|
- phpenv config-add data/infra/travis-php/memcached.ini
|
||||||
|
- phpenv config-add data/infra/travis-php/apcu.ini
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update
|
- composer self-update
|
||||||
@@ -21,6 +23,7 @@ script:
|
|||||||
- composer check
|
- composer check
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
|
- vendor/bin/phpcov merge build --clover build/clover.xml
|
||||||
- wget https://scrutinizer-ci.com/ocular.phar
|
- wget https://scrutinizer-ci.com/ocular.phar
|
||||||
- php ocular.phar code-coverage:upload --format=php-clover build/clover.xml
|
- php ocular.phar code-coverage:upload --format=php-clover build/clover.xml
|
||||||
|
|
||||||
|
|||||||
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,5 +1,43 @@
|
|||||||
## CHANGELOG
|
## CHANGELOG
|
||||||
|
|
||||||
|
### 1.6.2
|
||||||
|
|
||||||
|
**Bugs**
|
||||||
|
|
||||||
|
* [109: Fix installation error due to typo in latest migration](https://github.com/shlinkio/shlink/issues/109)
|
||||||
|
|
||||||
|
### 1.6.1
|
||||||
|
|
||||||
|
**Tasks**
|
||||||
|
|
||||||
|
* [110: Create gitattributes file to define files to be excluded from distributable package](https://github.com/shlinkio/shlink/issues/110)
|
||||||
|
|
||||||
|
### 1.6.0
|
||||||
|
|
||||||
|
**Features**
|
||||||
|
|
||||||
|
* [44: Consider allowing to set custom slugs instead of generating a short code](https://github.com/shlinkio/shlink/issues/44)
|
||||||
|
* [47: Allow to limit short codes availability by date range](https://github.com/shlinkio/shlink/issues/47)
|
||||||
|
* [48: Allow to limit the number of visits to a short code](https://github.com/shlinkio/shlink/issues/48)
|
||||||
|
* [105: Added option to enable/disable URL validation by response status code.](https://github.com/shlinkio/shlink/pull/105)
|
||||||
|
|
||||||
|
**Enhancements:**
|
||||||
|
|
||||||
|
* [27: Add repository functional tests with dbunit](https://github.com/shlinkio/shlink/issues/27)
|
||||||
|
* [86: Drop support for PHP 5](https://github.com/shlinkio/shlink/issues/86)
|
||||||
|
* [101: Make actions just capture very specific exceptions, and let the ErrorHandler catch any other exception](https://github.com/shlinkio/shlink/issues/101)
|
||||||
|
* [104: Use different templates for requested-short-code-does-not-exist and route-could-not-be-match](https://github.com/shlinkio/shlink/issues/104)
|
||||||
|
|
||||||
|
**Tasks**
|
||||||
|
|
||||||
|
* [99: Replace AnnotatedFactory by ConfigAbstractFactory](https://github.com/shlinkio/shlink/issues/99)
|
||||||
|
* [100: Replace twig by plates](https://github.com/shlinkio/shlink/issues/100)
|
||||||
|
* [102: Improve coding standards strictness](https://github.com/shlinkio/shlink/issues/102)
|
||||||
|
|
||||||
|
**Bugs**
|
||||||
|
|
||||||
|
* [103: Make NotFoundDelegate return proper content types based on accepted content](https://github.com/shlinkio/shlink/issues/103)
|
||||||
|
|
||||||
### 1.5.0
|
### 1.5.0
|
||||||
|
|
||||||
**Enhancements:**
|
**Enhancements:**
|
||||||
|
|||||||
21
bin/install
21
bin/install
@@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
||||||
|
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizerPlugin;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
use Zend\ServiceManager\Factory\InvokableFactory;
|
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
|
|
||||||
@@ -11,9 +13,18 @@ chdir(dirname(__DIR__));
|
|||||||
|
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
$container = new ServiceManager(['factories' => [
|
$container = new ServiceManager([
|
||||||
Application::class => InstallApplicationFactory::class,
|
'factories' => [
|
||||||
Filesystem::class => InvokableFactory::class,
|
Application::class => InstallApplicationFactory::class,
|
||||||
QuestionHelper::class => InvokableFactory::class,
|
Filesystem::class => InvokableFactory::class,
|
||||||
]]);
|
QuestionHelper::class => InvokableFactory::class,
|
||||||
|
],
|
||||||
|
'services' => [
|
||||||
|
'config' => [
|
||||||
|
ConfigAbstractFactory::class => [
|
||||||
|
DatabaseConfigCustomizerPlugin::class => [QuestionHelper::class, Filesystem::class]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
$container->build(Application::class)->run();
|
$container->build(Application::class)->run();
|
||||||
|
|||||||
21
bin/update
21
bin/update
@@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
use Shlinkio\Shlink\CLI\Factory\InstallApplicationFactory;
|
||||||
|
use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizerPlugin;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
use Zend\ServiceManager\Factory\InvokableFactory;
|
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
|
|
||||||
@@ -11,9 +13,18 @@ chdir(dirname(__DIR__));
|
|||||||
|
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
$container = new ServiceManager(['factories' => [
|
$container = new ServiceManager([
|
||||||
Application::class => InstallApplicationFactory::class,
|
'factories' => [
|
||||||
Filesystem::class => InvokableFactory::class,
|
Application::class => InstallApplicationFactory::class,
|
||||||
QuestionHelper::class => InvokableFactory::class,
|
Filesystem::class => InvokableFactory::class,
|
||||||
]]);
|
QuestionHelper::class => InvokableFactory::class,
|
||||||
|
],
|
||||||
|
'services' => [
|
||||||
|
'config' => [
|
||||||
|
ConfigAbstractFactory::class => [
|
||||||
|
DatabaseConfigCustomizerPlugin::class => [QuestionHelper::class, Filesystem::class]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
$container->build(Application::class, ['isUpdate' => true])->run();
|
$container->build(Application::class, ['isUpdate' => true])->run();
|
||||||
|
|||||||
8
build.sh
8
build.sh
@@ -20,8 +20,8 @@ cp -R "${projectdir}"/* "${builtcontent}"
|
|||||||
cd "${builtcontent}"
|
cd "${builtcontent}"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
rm -r vendor
|
rm -rf vendor
|
||||||
rm composer.lock
|
rm -f composer.lock
|
||||||
composer self-update
|
composer self-update
|
||||||
composer install --no-dev --optimize-autoloader --no-progress --no-interaction
|
composer install --no-dev --optimize-autoloader --no-progress --no-interaction
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ rm indocker
|
|||||||
rm docker-compose.yml
|
rm docker-compose.yml
|
||||||
rm php*
|
rm php*
|
||||||
rm README.md
|
rm README.md
|
||||||
rm -r build
|
rm -rf build
|
||||||
rm -f data/database.sqlite
|
rm -ff data/database.sqlite
|
||||||
rm -rf data/infra
|
rm -rf data/infra
|
||||||
rm -rf data/{cache,log,proxies}/{*,.gitignore}
|
rm -rf data/{cache,log,proxies}/{*,.gitignore}
|
||||||
rm -rf config/params/{*,.gitignore}
|
rm -rf config/params/{*,.gitignore}
|
||||||
|
|||||||
@@ -12,35 +12,45 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^5.6 || ^7.0",
|
"php": "^7.0",
|
||||||
|
"acelaya/ze-content-based-error-handler": "^2.0",
|
||||||
|
"cocur/slugify": "^3.0",
|
||||||
|
"doctrine/annotations": "^1.4 <1.5",
|
||||||
|
"doctrine/cache": "^1.6 <1.7",
|
||||||
|
"doctrine/collections": "^1.4 <1.5",
|
||||||
|
"doctrine/common": "^2.7 <2.8",
|
||||||
|
"doctrine/dbal": "^2.5 <2.6",
|
||||||
|
"doctrine/migrations": "^1.4",
|
||||||
|
"doctrine/orm": "^2.5 <2.6",
|
||||||
|
"endroid/qrcode": "^1.7",
|
||||||
|
"firebase/php-jwt": "^4.0",
|
||||||
|
"guzzlehttp/guzzle": "^6.2",
|
||||||
|
"http-interop/http-middleware": "^0.4.1",
|
||||||
|
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||||
|
"monolog/monolog": "^1.21",
|
||||||
|
"roave/security-advisories": "dev-master",
|
||||||
|
"symfony/console": "^3.0",
|
||||||
|
"symfony/filesystem": "^3.0",
|
||||||
|
"symfony/process": "^3.0",
|
||||||
|
"theorchard/monolog-cascade": "^0.4",
|
||||||
|
"zendframework/zend-config": "^3.0",
|
||||||
|
"zendframework/zend-config-aggregator": "^1.0",
|
||||||
"zendframework/zend-expressive": "^2.0",
|
"zendframework/zend-expressive": "^2.0",
|
||||||
"zendframework/zend-expressive-fastroute": "^2.0",
|
"zendframework/zend-expressive-fastroute": "^2.0",
|
||||||
"zendframework/zend-expressive-twigrenderer": "^1.4",
|
"zendframework/zend-expressive-helpers": "^4.2",
|
||||||
"zendframework/zend-stdlib": "^3.0",
|
"zendframework/zend-expressive-platesrenderer": "^1.3",
|
||||||
"zendframework/zend-servicemanager": "^3.0",
|
|
||||||
"zendframework/zend-paginator": "^2.6",
|
|
||||||
"zendframework/zend-config": "^3.0",
|
|
||||||
"zendframework/zend-i18n": "^2.7",
|
"zendframework/zend-i18n": "^2.7",
|
||||||
"zendframework/zend-config-aggregator": "^0.1",
|
"zendframework/zend-paginator": "^2.6",
|
||||||
"acelaya/zsm-annotated-services": "^1.0",
|
"zendframework/zend-servicemanager": "^3.0",
|
||||||
"acelaya/ze-content-based-error-handler": "^2.0",
|
"zendframework/zend-stdlib": "^3.0"
|
||||||
"doctrine/orm": "^2.5",
|
|
||||||
"guzzlehttp/guzzle": "^6.2",
|
|
||||||
"symfony/console": "^3.0",
|
|
||||||
"symfony/process": "^3.0",
|
|
||||||
"symfony/filesystem": "^3.0",
|
|
||||||
"firebase/php-jwt": "^4.0",
|
|
||||||
"monolog/monolog": "^1.21",
|
|
||||||
"theorchard/monolog-cascade": "^0.4",
|
|
||||||
"endroid/qrcode": "^1.7",
|
|
||||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
|
||||||
"doctrine/migrations": "^1.4"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^5.7 || ^6.0",
|
|
||||||
"squizlabs/php_codesniffer": "^2.3",
|
|
||||||
"roave/security-advisories": "dev-master",
|
|
||||||
"filp/whoops": "^2.0",
|
"filp/whoops": "^2.0",
|
||||||
|
"phpunit/dbunit": "^3.0",
|
||||||
|
"phpunit/phpcov": "^4.0",
|
||||||
|
"phpunit/phpunit": "^6.0",
|
||||||
|
"slevomat/coding-standard": "^4.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.1",
|
||||||
"symfony/var-dumper": "^3.0",
|
"symfony/var-dumper": "^3.0",
|
||||||
"vlucas/phpdotenv": "^2.2",
|
"vlucas/phpdotenv": "^2.2",
|
||||||
"zendframework/zend-expressive-tooling": "^0.4"
|
"zendframework/zend-expressive-tooling": "^0.4"
|
||||||
@@ -60,22 +70,39 @@
|
|||||||
"psr-4": {
|
"psr-4": {
|
||||||
"ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test",
|
"ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test",
|
||||||
"ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test",
|
"ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test",
|
||||||
"ShlinkioTest\\Shlink\\Core\\": "module/Core/test",
|
"ShlinkioTest\\Shlink\\Core\\": [
|
||||||
"ShlinkioTest\\Shlink\\Common\\": "module/Common/test"
|
"module/Core/test",
|
||||||
|
"module/Core/test-func"
|
||||||
|
],
|
||||||
|
"ShlinkioTest\\Shlink\\Common\\": [
|
||||||
|
"module/Common/test",
|
||||||
|
"module/Common/test-func"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check": [
|
"check": [
|
||||||
"@cs",
|
"@cs",
|
||||||
"@test"
|
"@test",
|
||||||
|
"@func-test"
|
||||||
],
|
],
|
||||||
"cs": "phpcs",
|
"cs": "phpcs",
|
||||||
"cs-fix": "phpcbf",
|
"cs-fix": "phpcbf",
|
||||||
"serve": "php -S 0.0.0.0:8000 -t public/",
|
"serve": "php -S 0.0.0.0:8000 -t public/",
|
||||||
"test": "phpunit --coverage-clover build/clover.xml",
|
"test": "phpunit --coverage-php build/coverage-unit.cov",
|
||||||
"pretty-test": "phpunit --coverage-html build/coverage"
|
"pretty-test": "phpunit --coverage-html build/coverage",
|
||||||
|
"func-test": "phpunit -c phpunit-func.xml --coverage-php build/coverage-func.cov",
|
||||||
|
"complete-pretty-test": [
|
||||||
|
"@test",
|
||||||
|
"@func-test",
|
||||||
|
"phpcov merge build --html build/html"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"process-timeout": 0
|
"process-timeout": 0,
|
||||||
|
"sort-packages": true,
|
||||||
|
"platform": {
|
||||||
|
"php": "7.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common\Factory\EmptyResponseImplicitOptionsMiddlewareFactory;
|
use Shlinkio\Shlink\Common\Factory\EmptyResponseImplicitOptionsMiddlewareFactory;
|
||||||
use Zend\Expressive;
|
use Zend\Expressive;
|
||||||
use Zend\Expressive\Container;
|
use Zend\Expressive\Container;
|
||||||
|
use Zend\Expressive\Helper;
|
||||||
use Zend\Expressive\Middleware;
|
use Zend\Expressive\Middleware;
|
||||||
|
use Zend\Expressive\Plates;
|
||||||
use Zend\Expressive\Router;
|
use Zend\Expressive\Router;
|
||||||
use Zend\Expressive\Template;
|
use Zend\Expressive\Template;
|
||||||
use Zend\Expressive\Twig;
|
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||||
use Zend\Stratigility\Middleware\ErrorHandler;
|
use Zend\Stratigility\Middleware\ErrorHandler;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -13,11 +17,13 @@ return [
|
|||||||
'dependencies' => [
|
'dependencies' => [
|
||||||
'factories' => [
|
'factories' => [
|
||||||
Expressive\Application::class => Container\ApplicationFactory::class,
|
Expressive\Application::class => Container\ApplicationFactory::class,
|
||||||
Template\TemplateRendererInterface::class => Twig\TwigRendererFactory::class,
|
Template\TemplateRendererInterface::class => Plates\PlatesRendererFactory::class,
|
||||||
\Twig_Environment::class => Twig\TwigEnvironmentFactory::class,
|
|
||||||
Router\RouterInterface::class => Router\FastRouteRouterFactory::class,
|
Router\RouterInterface::class => Router\FastRouteRouterFactory::class,
|
||||||
ErrorHandler::class => Container\ErrorHandlerFactory::class,
|
ErrorHandler::class => Container\ErrorHandlerFactory::class,
|
||||||
Middleware\ImplicitOptionsMiddleware::class => EmptyResponseImplicitOptionsMiddlewareFactory::class,
|
Middleware\ImplicitOptionsMiddleware::class => EmptyResponseImplicitOptionsMiddlewareFactory::class,
|
||||||
|
|
||||||
|
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
||||||
|
Helper\ServerUrlHelper::class => InvokableFactory::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Monolog\Handler\RotatingFileHandler;
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware;
|
use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware;
|
||||||
use Shlinkio\Shlink\Rest\Middleware\BodyParserMiddleware;
|
use Shlinkio\Shlink\Rest\Middleware\BodyParserMiddleware;
|
||||||
use Shlinkio\Shlink\Rest\Middleware\CheckAuthenticationMiddleware;
|
use Shlinkio\Shlink\Rest\Middleware\CheckAuthenticationMiddleware;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'phpwkhtmltopdf' => [
|
'phpwkhtmltopdf' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'preview_generation' => [
|
'preview_generation' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Zend\Expressive\Router\FastRouteRouter;
|
use Zend\Expressive\Router\FastRouteRouter;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'twig' => [
|
'templates' => [
|
||||||
'cache_dir' => 'data/cache/twig',
|
'extension' => 'phtml',
|
||||||
|
],
|
||||||
|
|
||||||
|
'plates' => [
|
||||||
'extensions' => [
|
'extensions' => [
|
||||||
// extension service names or instances
|
// extension service names or instances
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\Common;
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use function Shlinkio\Shlink\Common\env;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'url_shortener' => [
|
'url_shortener' => [
|
||||||
'domain' => [
|
'domain' => [
|
||||||
'schema' => Common\env('SHORTENED_URL_SCHEMA', 'http'),
|
'schema' => env('SHORTENED_URL_SCHEMA', 'http'),
|
||||||
'hostname' => Common\env('SHORTENED_URL_HOSTNAME'),
|
'hostname' => env('SHORTENED_URL_HOSTNAME'),
|
||||||
],
|
],
|
||||||
'shortcode_chars' => Common\env('SHORTCODE_CHARS', UrlShortener::DEFAULT_CHARS),
|
'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortener::DEFAULT_CHARS),
|
||||||
|
'validate_url' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
|
use Zend\ServiceManager\ServiceManager;
|
||||||
|
|
||||||
/** @var ContainerInterface $container */
|
$isTest = false;
|
||||||
|
foreach ($_SERVER['argv'] as $i => $arg) {
|
||||||
|
if ($arg === '--test') {
|
||||||
|
unset($_SERVER['argv'][$i]);
|
||||||
|
$isTest = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var ContainerInterface|ServiceManager $container */
|
||||||
$container = include __DIR__ . '/container.php';
|
$container = include __DIR__ . '/container.php';
|
||||||
|
|
||||||
|
// If in testing env, override DB connection to use an in-memory sqlite database
|
||||||
|
if ($isTest) {
|
||||||
|
$container->setAllowOverride(true);
|
||||||
|
$config = $container->get('config');
|
||||||
|
$config['entity_manager']['connection'] = [
|
||||||
|
'driver' => 'pdo_sqlite',
|
||||||
|
'path' => realpath(sys_get_temp_dir()) . '/shlink-tests.db',
|
||||||
|
];
|
||||||
|
$container->setService('config', $config);
|
||||||
|
}
|
||||||
|
|
||||||
/** @var EntityManager $em */
|
/** @var EntityManager $em */
|
||||||
$em = $container->get(EntityManager::class);
|
$em = $container->get(EntityManager::class);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Acelaya\ExpressiveErrorHandler;
|
use Acelaya\ExpressiveErrorHandler;
|
||||||
use Shlinkio\Shlink\CLI;
|
use Shlinkio\Shlink\CLI;
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dotenv\Dotenv;
|
use Dotenv\Dotenv;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
|
|
||||||
@@ -9,7 +11,7 @@ require 'vendor/autoload.php';
|
|||||||
// If the Dotenv class exists, load env vars and enable errors
|
// If the Dotenv class exists, load env vars and enable errors
|
||||||
if (class_exists(Dotenv::class)) {
|
if (class_exists(Dotenv::class)) {
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', '1');
|
||||||
$dotenv = new Dotenv(__DIR__ . '/..');
|
$dotenv = new Dotenv(__DIR__ . '/..');
|
||||||
$dotenv->load();
|
$dotenv->load();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ RUN apk add --no-cache --virtual libpng-dev
|
|||||||
RUN docker-php-ext-install gd
|
RUN docker-php-ext-install gd
|
||||||
|
|
||||||
# Install redis extension
|
# Install redis extension
|
||||||
ADD https://github.com/phpredis/phpredis/archive/php7.tar.gz /tmp/phpredis.tar.gz
|
ADD https://github.com/phpredis/phpredis/archive/3.1.4.tar.gz /tmp/phpredis.tar.gz
|
||||||
RUN mkdir -p /usr/src/php/ext/redis\
|
RUN mkdir -p /usr/src/php/ext/redis\
|
||||||
&& tar xf /tmp/phpredis.tar.gz -C /usr/src/php/ext/redis --strip-components=1
|
&& tar xf /tmp/phpredis.tar.gz -C /usr/src/php/ext/redis --strip-components=1
|
||||||
# configure and install
|
# configure and install
|
||||||
@@ -85,3 +85,6 @@ RUN rm /tmp/xdebug.tar.gz
|
|||||||
RUN php -r "readfile('https://getcomposer.org/installer');" | php
|
RUN php -r "readfile('https://getcomposer.org/installer');" | php
|
||||||
RUN chmod +x composer.phar
|
RUN chmod +x composer.phar
|
||||||
RUN mv composer.phar /usr/local/bin/composer
|
RUN mv composer.phar /usr/local/bin/composer
|
||||||
|
|
||||||
|
# Make home directory writable by anyone
|
||||||
|
RUN chmod 777 /home
|
||||||
|
|||||||
1
data/infra/travis-php/apcu.ini
Normal file
1
data/infra/travis-php/apcu.ini
Normal file
@@ -0,0 +1 @@
|
|||||||
|
extension="apcu.so"
|
||||||
1
data/infra/travis-php/memcached.ini
Normal file
1
data/infra/travis-php/memcached.ini
Normal file
@@ -0,0 +1 @@
|
|||||||
|
extension="memcached.so"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkMigrations;
|
namespace ShlinkMigrations;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkMigrations;
|
namespace ShlinkMigrations;
|
||||||
|
|
||||||
|
|||||||
49
data/migrations/Version20171021093246.php
Normal file
49
data/migrations/Version20171021093246.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ShlinkMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\DBAL\Schema\SchemaException;
|
||||||
|
use Doctrine\DBAL\Types\Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
class Version20171021093246 extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
* @throws SchemaException
|
||||||
|
*/
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
$shortUrls = $schema->getTable('short_urls');
|
||||||
|
if ($shortUrls->hasColumn('valid_since')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shortUrls->addColumn('valid_since', Type::DATETIME, [
|
||||||
|
'notnull' => false,
|
||||||
|
]);
|
||||||
|
$shortUrls->addColumn('valid_until', Type::DATETIME, [
|
||||||
|
'notnull' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
* @throws SchemaException
|
||||||
|
*/
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
$shortUrls = $schema->getTable('short_urls');
|
||||||
|
if (! $shortUrls->hasColumn('valid_since')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shortUrls->dropColumn('valid_since');
|
||||||
|
$shortUrls->dropColumn('valid_until');
|
||||||
|
}
|
||||||
|
}
|
||||||
46
data/migrations/Version20171022064541.php
Normal file
46
data/migrations/Version20171022064541.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ShlinkMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\DBAL\Schema\SchemaException;
|
||||||
|
use Doctrine\DBAL\Types\Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
class Version20171022064541 extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
* @throws SchemaException
|
||||||
|
*/
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
$shortUrls = $schema->getTable('short_urls');
|
||||||
|
if ($shortUrls->hasColumn('max_visits')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shortUrls->addColumn('max_visits', Type::INTEGER, [
|
||||||
|
'unsigned' => true,
|
||||||
|
'notnull' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
* @throws SchemaException
|
||||||
|
*/
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
$shortUrls = $schema->getTable('short_urls');
|
||||||
|
if (! $shortUrls->hasColumn('max_visits')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$shortUrls->dropColumn('max_visits');
|
||||||
|
}
|
||||||
|
}
|
||||||
8
docker-compose.override.yml.dist
Normal file
8
docker-compose.override.yml.dist
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
shlink_php:
|
||||||
|
user: 1000:1000
|
||||||
|
volumes:
|
||||||
|
- /etc/passwd:/etc/passwd:ro
|
||||||
|
- /etc/group:/etc/group:ro
|
||||||
33
func_tests_bootstrap.php
Normal file
33
func_tests_bootstrap.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use ShlinkioTest\Shlink\Common\DbUnit\DatabaseTestCase;
|
||||||
|
use Symfony\Component\Process\Process;
|
||||||
|
use Zend\ServiceManager\ServiceManager;
|
||||||
|
|
||||||
|
// Create an empty .env file
|
||||||
|
if (! file_exists('.env')) {
|
||||||
|
touch('.env');
|
||||||
|
}
|
||||||
|
|
||||||
|
$shlinkDbPath = realpath(sys_get_temp_dir()) . '/shlink-tests.db';
|
||||||
|
if (file_exists($shlinkDbPath)) {
|
||||||
|
unlink($shlinkDbPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var ServiceManager $sm */
|
||||||
|
$sm = require __DIR__ . '/config/container.php';
|
||||||
|
$sm->setAllowOverride(true);
|
||||||
|
$config = $sm->get('config');
|
||||||
|
$config['entity_manager']['connection'] = [
|
||||||
|
'driver' => 'pdo_sqlite',
|
||||||
|
'path' => $shlinkDbPath,
|
||||||
|
];
|
||||||
|
$sm->setService('config', $config);
|
||||||
|
|
||||||
|
// Create database
|
||||||
|
$process = new Process('vendor/bin/doctrine orm:schema-tool:create --no-interaction -q --test', __DIR__);
|
||||||
|
$process->inheritEnvironmentVariables()
|
||||||
|
->mustRun();
|
||||||
|
|
||||||
|
DatabaseTestCase::$em = $sm->get('em');
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Command;
|
use Shlinkio\Shlink\CLI\Command;
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ return [
|
|||||||
Command\Tag\CreateTagCommand::class,
|
Command\Tag\CreateTagCommand::class,
|
||||||
Command\Tag\RenameTagCommand::class,
|
Command\Tag\RenameTagCommand::class,
|
||||||
Command\Tag\DeleteTagsCommand::class,
|
Command\Tag\DeleteTagsCommand::class,
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Command;
|
use Shlinkio\Shlink\CLI\Command;
|
||||||
use Shlinkio\Shlink\CLI\Factory\ApplicationFactory;
|
use Shlinkio\Shlink\CLI\Factory\ApplicationFactory;
|
||||||
|
use Shlinkio\Shlink\Common\Service\IpLocationResolver;
|
||||||
|
use Shlinkio\Shlink\Common\Service\PreviewGenerator;
|
||||||
|
use Shlinkio\Shlink\Core\Service;
|
||||||
|
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
use Zend\I18n\Translator\Translator;
|
||||||
|
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@@ -10,22 +17,52 @@ return [
|
|||||||
'factories' => [
|
'factories' => [
|
||||||
Application::class => ApplicationFactory::class,
|
Application::class => ApplicationFactory::class,
|
||||||
|
|
||||||
Command\Shortcode\GenerateShortcodeCommand::class => AnnotatedFactory::class,
|
Command\Shortcode\GenerateShortcodeCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\ResolveUrlCommand::class => AnnotatedFactory::class,
|
Command\Shortcode\ResolveUrlCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\ListShortcodesCommand::class => AnnotatedFactory::class,
|
Command\Shortcode\ListShortcodesCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\GetVisitsCommand::class => AnnotatedFactory::class,
|
Command\Shortcode\GetVisitsCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Shortcode\GeneratePreviewCommand::class => AnnotatedFactory::class,
|
Command\Shortcode\GeneratePreviewCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Visit\ProcessVisitsCommand::class => AnnotatedFactory::class,
|
Command\Visit\ProcessVisitsCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Config\GenerateCharsetCommand::class => AnnotatedFactory::class,
|
Command\Config\GenerateCharsetCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Config\GenerateSecretCommand::class => AnnotatedFactory::class,
|
Command\Config\GenerateSecretCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Api\GenerateKeyCommand::class => AnnotatedFactory::class,
|
Command\Api\GenerateKeyCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Api\DisableKeyCommand::class => AnnotatedFactory::class,
|
Command\Api\DisableKeyCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Api\ListKeysCommand::class => AnnotatedFactory::class,
|
Command\Api\ListKeysCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Tag\ListTagsCommand::class => AnnotatedFactory::class,
|
Command\Tag\ListTagsCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Tag\CreateTagCommand::class => AnnotatedFactory::class,
|
Command\Tag\CreateTagCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Tag\RenameTagCommand::class => AnnotatedFactory::class,
|
Command\Tag\RenameTagCommand::class => ConfigAbstractFactory::class,
|
||||||
Command\Tag\DeleteTagsCommand::class => AnnotatedFactory::class,
|
Command\Tag\DeleteTagsCommand::class => ConfigAbstractFactory::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
ConfigAbstractFactory::class => [
|
||||||
|
Command\Shortcode\GenerateShortcodeCommand::class => [
|
||||||
|
Service\UrlShortener::class,
|
||||||
|
'translator',
|
||||||
|
'config.url_shortener.domain',
|
||||||
|
],
|
||||||
|
Command\Shortcode\ResolveUrlCommand::class => [Service\UrlShortener::class, 'translator'],
|
||||||
|
Command\Shortcode\ListShortcodesCommand::class => [Service\ShortUrlService::class, 'translator'],
|
||||||
|
Command\Shortcode\GetVisitsCommand::class => [Service\VisitsTracker::class, 'translator'],
|
||||||
|
Command\Shortcode\GeneratePreviewCommand::class => [
|
||||||
|
Service\ShortUrlService::class,
|
||||||
|
PreviewGenerator::class,
|
||||||
|
'translator',
|
||||||
|
],
|
||||||
|
Command\Visit\ProcessVisitsCommand::class => [
|
||||||
|
Service\VisitService::class,
|
||||||
|
IpLocationResolver::class,
|
||||||
|
'translator',
|
||||||
|
],
|
||||||
|
Command\Config\GenerateCharsetCommand::class => ['translator'],
|
||||||
|
Command\Config\GenerateSecretCommand::class => ['translator'],
|
||||||
|
Command\Api\GenerateKeyCommand::class => [ApiKeyService::class, 'translator'],
|
||||||
|
Command\Api\DisableKeyCommand::class => [ApiKeyService::class, 'translator'],
|
||||||
|
Command\Api\ListKeysCommand::class => [ApiKeyService::class, 'translator'],
|
||||||
|
Command\Tag\ListTagsCommand::class => [Service\Tag\TagService::class, Translator::class],
|
||||||
|
Command\Tag\CreateTagCommand::class => [Service\Tag\TagService::class, Translator::class],
|
||||||
|
Command\Tag\RenameTagCommand::class => [Service\Tag\TagService::class, Translator::class],
|
||||||
|
Command\Tag\DeleteTagsCommand::class => [Service\Tag\TagService::class, Translator::class],
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'translator' => [
|
'translator' => [
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Shlink 1.0\n"
|
"Project-Id-Version: Shlink 1.0\n"
|
||||||
"POT-Creation-Date: 2017-07-16 09:35+0200\n"
|
"POT-Creation-Date: 2017-10-21 20:17+0200\n"
|
||||||
"PO-Revision-Date: 2017-07-16 09:39+0200\n"
|
"PO-Revision-Date: 2017-10-21 20:19+0200\n"
|
||||||
"Last-Translator: Alejandro Celaya <alejandro@alejandrocelaya.com>\n"
|
"Last-Translator: Alejandro Celaya <alejandro@alejandrocelaya.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: es_ES\n"
|
"Language: es_ES\n"
|
||||||
@@ -92,7 +92,7 @@ msgid "Processing URL %s..."
|
|||||||
msgstr "Procesando URL %s..."
|
msgstr "Procesando URL %s..."
|
||||||
|
|
||||||
msgid " <info>Success!</info>"
|
msgid " <info>Success!</info>"
|
||||||
msgstr "<info>¡Correcto!</info>"
|
msgstr " <info>¡Correcto!</info>"
|
||||||
|
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Error"
|
msgstr "Error"
|
||||||
@@ -107,6 +107,24 @@ msgstr "La URL larga a procesar"
|
|||||||
msgid "Tags to apply to the new short URL"
|
msgid "Tags to apply to the new short URL"
|
||||||
msgstr "Etiquetas a aplicar a la nueva URL acortada"
|
msgstr "Etiquetas a aplicar a la nueva URL acortada"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"The date from which this short URL will be valid. If someone tries to access "
|
||||||
|
"it before this date, it will not be found."
|
||||||
|
msgstr ""
|
||||||
|
"La fecha desde la cual será válida esta URL acortada. Si alguien intenta "
|
||||||
|
"acceder a ella antes de esta fecha, no será encontrada."
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"The date until which this short URL will be valid. If someone tries to "
|
||||||
|
"access it after this date, it will not be found."
|
||||||
|
msgstr ""
|
||||||
|
"La fecha hasta la cual será válida está URL acortada. Si alguien intenta "
|
||||||
|
"acceder a ella después de esta fecha, no será encontrada."
|
||||||
|
|
||||||
|
msgid "If provided, this slug will be used instead of generating a short code"
|
||||||
|
msgstr ""
|
||||||
|
"Si se proporciona, este slug será usado en vez de generar un código corto"
|
||||||
|
|
||||||
msgid "A long URL was not provided. Which URL do you want to shorten?:"
|
msgid "A long URL was not provided. Which URL do you want to shorten?:"
|
||||||
msgstr "No se ha proporcionado una URL larga. ¿Qué URL deseas acortar?"
|
msgstr "No se ha proporcionado una URL larga. ¿Qué URL deseas acortar?"
|
||||||
|
|
||||||
@@ -123,6 +141,14 @@ msgstr "URL generada:"
|
|||||||
msgid "Provided URL \"%s\" is invalid. Try with a different one."
|
msgid "Provided URL \"%s\" is invalid. Try with a different one."
|
||||||
msgstr "La URL proporcionada \"%s\" e inválida. Prueba con una diferente."
|
msgstr "La URL proporcionada \"%s\" e inválida. Prueba con una diferente."
|
||||||
|
|
||||||
|
#, php-format
|
||||||
|
msgid ""
|
||||||
|
"Provided slug \"%s\" is already in use by another URL. Try with a different "
|
||||||
|
"one."
|
||||||
|
msgstr ""
|
||||||
|
"El slug proporcionado \"%s\" ya está siendo usado para otra URL. Prueba con "
|
||||||
|
"uno diferente."
|
||||||
|
|
||||||
msgid "Returns the detailed visits information for provided short code"
|
msgid "Returns the detailed visits information for provided short code"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Devuelve la información detallada de visitas para el código corto "
|
"Devuelve la información detallada de visitas para el código corto "
|
||||||
@@ -141,7 +167,7 @@ msgstr ""
|
|||||||
"Permite filtrar las visitas, devolviendo sólo aquellas más nuevas que endDate"
|
"Permite filtrar las visitas, devolviendo sólo aquellas más nuevas que endDate"
|
||||||
|
|
||||||
msgid "A short code was not provided. Which short code do you want to use?:"
|
msgid "A short code was not provided. Which short code do you want to use?:"
|
||||||
msgstr "No se prporcionó un código corto. ¿Qué código corto deseas usar?"
|
msgstr "No se prporcionó un código corto. ¿Qué código corto deseas usar?:"
|
||||||
|
|
||||||
msgid "Referer"
|
msgid "Referer"
|
||||||
msgstr "Origen"
|
msgstr "Origen"
|
||||||
@@ -210,7 +236,7 @@ msgstr "El código corto a convertir"
|
|||||||
|
|
||||||
msgid "A short code was not provided. Which short code do you want to parse?:"
|
msgid "A short code was not provided. Which short code do you want to parse?:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"No se proporcionó un código corto. ¿Qué código corto quieres convertir?"
|
"No se proporcionó un código corto. ¿Qué código corto quieres convertir?:"
|
||||||
|
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "No URL found for short code \"%s\""
|
msgid "No URL found for short code \"%s\""
|
||||||
@@ -223,6 +249,10 @@ msgstr "URL larga:"
|
|||||||
msgid "Provided short code \"%s\" has an invalid format."
|
msgid "Provided short code \"%s\" has an invalid format."
|
||||||
msgstr "El código corto proporcionado \"%s\" tiene un formato inválido."
|
msgstr "El código corto proporcionado \"%s\" tiene un formato inválido."
|
||||||
|
|
||||||
|
#, php-format
|
||||||
|
msgid "Provided short code \"%s\" could not be found."
|
||||||
|
msgstr "El código corto proporcionado \"%s\" no ha podido ser encontrado."
|
||||||
|
|
||||||
msgid "Creates one or more tags."
|
msgid "Creates one or more tags."
|
||||||
msgstr "Crea una o más etiquetas."
|
msgstr "Crea una o más etiquetas."
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Api;
|
namespace Shlinkio\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
@@ -21,13 +21,6 @@ class DisableKeyCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* DisableKeyCommand constructor.
|
|
||||||
* @param ApiKeyServiceInterface|ApiKeyService $apiKeyService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({ApiKeyService::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->apiKeyService = $apiKeyService;
|
$this->apiKeyService = $apiKeyService;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Api;
|
namespace Shlinkio\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -21,18 +21,11 @@ class GenerateKeyCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* GenerateKeyCommand constructor.
|
|
||||||
* @param ApiKeyServiceInterface|ApiKeyService $apiKeyService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({ApiKeyService::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->apiKeyService = $apiKeyService;
|
$this->apiKeyService = $apiKeyService;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
parent::__construct(null);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure()
|
public function configure()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Api;
|
namespace Shlinkio\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyService;
|
|
||||||
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
@@ -23,18 +23,11 @@ class ListKeysCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ListKeysCommand constructor.
|
|
||||||
* @param ApiKeyServiceInterface|ApiKeyService $apiKeyService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({ApiKeyService::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->apiKeyService = $apiKeyService;
|
$this->apiKeyService = $apiKeyService;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
parent::__construct(null);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure()
|
public function configure()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Config;
|
namespace Shlinkio\Shlink\CLI\Command\Config;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -15,16 +16,10 @@ class GenerateCharsetCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* GenerateCharsetCommand constructor.
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({"translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
public function __construct(TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
parent::__construct(null);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure()
|
public function configure()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Config;
|
namespace Shlinkio\Shlink\CLI\Command\Config;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -17,16 +18,10 @@ class GenerateSecretCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* GenerateCharsetCommand constructor.
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({"translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
public function __construct(TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
parent::__construct(null);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure()
|
public function configure()
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Install;
|
namespace Shlinkio\Shlink\CLI\Command\Install;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManagerInterface;
|
use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManagerInterface;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
|
||||||
use Shlinkio\Shlink\Common\Service\PreviewGenerator;
|
|
||||||
use Shlinkio\Shlink\Common\Service\PreviewGeneratorInterface;
|
use Shlinkio\Shlink\Common\Service\PreviewGeneratorInterface;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -27,14 +26,6 @@ class GeneratePreviewCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $shortUrlService;
|
private $shortUrlService;
|
||||||
|
|
||||||
/**
|
|
||||||
* GeneratePreviewCommand constructor.
|
|
||||||
* @param ShortUrlServiceInterface $shortUrlService
|
|
||||||
* @param PreviewGeneratorInterface $previewGenerator
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({ShortUrlService::class, PreviewGenerator::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ShortUrlServiceInterface $shortUrlService,
|
ShortUrlServiceInterface $shortUrlService,
|
||||||
PreviewGeneratorInterface $previewGenerator,
|
PreviewGeneratorInterface $previewGenerator,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
@@ -30,14 +31,6 @@ class GenerateShortcodeCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* GenerateShortcodeCommand constructor.
|
|
||||||
* @param UrlShortenerInterface $urlShortener
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
* @param array $domainConfig
|
|
||||||
*
|
|
||||||
* @Inject({UrlShortener::class, "translator", "config.url_shortener.domain"})
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
UrlShortenerInterface $urlShortener,
|
UrlShortenerInterface $urlShortener,
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
@@ -59,9 +52,23 @@ class GenerateShortcodeCommand extends Command
|
|||||||
->addOption(
|
->addOption(
|
||||||
'tags',
|
'tags',
|
||||||
't',
|
't',
|
||||||
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
|
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
|
||||||
$this->translator->translate('Tags to apply to the new short URL')
|
$this->translator->translate('Tags to apply to the new short URL')
|
||||||
);
|
)
|
||||||
|
->addOption('validSince', 's', InputOption::VALUE_REQUIRED, $this->translator->translate(
|
||||||
|
'The date from which this short URL will be valid. '
|
||||||
|
. 'If someone tries to access it before this date, it will not be found.'
|
||||||
|
))
|
||||||
|
->addOption('validUntil', 'u', InputOption::VALUE_REQUIRED, $this->translator->translate(
|
||||||
|
'The date until which this short URL will be valid. '
|
||||||
|
. 'If someone tries to access it after this date, it will not be found.'
|
||||||
|
))
|
||||||
|
->addOption('customSlug', 'c', InputOption::VALUE_REQUIRED, $this->translator->translate(
|
||||||
|
'If provided, this slug will be used instead of generating a short code'
|
||||||
|
))
|
||||||
|
->addOption('maxVisits', 'm', InputOption::VALUE_REQUIRED, $this->translator->translate(
|
||||||
|
'This will limit the number of visits for this short URL.'
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function interact(InputInterface $input, OutputInterface $output)
|
public function interact(InputInterface $input, OutputInterface $output)
|
||||||
@@ -94,6 +101,8 @@ class GenerateShortcodeCommand extends Command
|
|||||||
$processedTags = array_merge($processedTags, $explodedTags);
|
$processedTags = array_merge($processedTags, $explodedTags);
|
||||||
}
|
}
|
||||||
$tags = $processedTags;
|
$tags = $processedTags;
|
||||||
|
$customSlug = $input->getOption('customSlug');
|
||||||
|
$maxVisits = $input->getOption('maxVisits');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (! isset($longUrl)) {
|
if (! isset($longUrl)) {
|
||||||
@@ -101,7 +110,14 @@ class GenerateShortcodeCommand extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$shortCode = $this->urlShortener->urlToShortCode(new Uri($longUrl), $tags);
|
$shortCode = $this->urlShortener->urlToShortCode(
|
||||||
|
new Uri($longUrl),
|
||||||
|
$tags,
|
||||||
|
$this->getOptionalDate($input, 'validSince'),
|
||||||
|
$this->getOptionalDate($input, 'validUntil'),
|
||||||
|
$customSlug,
|
||||||
|
$maxVisits !== null ? (int) $maxVisits : null
|
||||||
|
);
|
||||||
$shortUrl = (new Uri())->withPath($shortCode)
|
$shortUrl = (new Uri())->withPath($shortCode)
|
||||||
->withScheme($this->domainConfig['schema'])
|
->withScheme($this->domainConfig['schema'])
|
||||||
->withHost($this->domainConfig['hostname']);
|
->withHost($this->domainConfig['hostname']);
|
||||||
@@ -117,6 +133,19 @@ class GenerateShortcodeCommand extends Command
|
|||||||
) . '</error>',
|
) . '</error>',
|
||||||
$longUrl
|
$longUrl
|
||||||
));
|
));
|
||||||
|
} catch (NonUniqueSlugException $e) {
|
||||||
|
$output->writeln(sprintf(
|
||||||
|
'<error>' . $this->translator->translate(
|
||||||
|
'Provided slug "%s" is already in use by another URL. Try with a different one.'
|
||||||
|
) . '</error>',
|
||||||
|
$customSlug
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getOptionalDate(InputInterface $input, string $fieldName)
|
||||||
|
{
|
||||||
|
$since = $input->getOption($fieldName);
|
||||||
|
return $since !== null ? new \DateTime($since) : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||||
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
|
||||||
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
@@ -26,13 +26,6 @@ class GetVisitsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* GetVisitsCommand constructor.
|
|
||||||
* @param VisitsTrackerInterface $visitsTracker
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({VisitsTracker::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(VisitsTrackerInterface $visitsTracker, TranslatorInterface $translator)
|
public function __construct(VisitsTrackerInterface $visitsTracker, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->visitsTracker = $visitsTracker;
|
$this->visitsTracker = $visitsTracker;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
@@ -28,13 +28,6 @@ class ListShortcodesCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ListShortcodesCommand constructor.
|
|
||||||
* @param ShortUrlServiceInterface $shortUrlService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({ShortUrlService::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(ShortUrlServiceInterface $shortUrlService, TranslatorInterface $translator)
|
public function __construct(ShortUrlServiceInterface $shortUrlService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->shortUrlService = $shortUrlService;
|
$this->shortUrlService = $shortUrlService;
|
||||||
@@ -88,12 +81,11 @@ class ListShortcodesCommand extends Command
|
|||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$page = intval($input->getOption('page'));
|
$page = (int) $input->getOption('page');
|
||||||
$searchTerm = $input->getOption('searchTerm');
|
$searchTerm = $input->getOption('searchTerm');
|
||||||
$tags = $input->getOption('tags');
|
$tags = $input->getOption('tags');
|
||||||
$tags = ! empty($tags) ? explode(',', $tags) : [];
|
$tags = ! empty($tags) ? explode(',', $tags) : [];
|
||||||
$showTags = $input->getOption('showTags');
|
$showTags = $input->getOption('showTags');
|
||||||
$orderBy = $input->getOption('orderBy');
|
|
||||||
|
|
||||||
/** @var QuestionHelper $helper */
|
/** @var QuestionHelper $helper */
|
||||||
$helper = $this->getHelper('question');
|
$helper = $this->getHelper('question');
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
namespace Shlinkio\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
@@ -24,13 +25,6 @@ class ResolveUrlCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ResolveUrlCommand constructor.
|
|
||||||
* @param UrlShortenerInterface $urlShortener
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({UrlShortener::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(UrlShortenerInterface $urlShortener, TranslatorInterface $translator)
|
public function __construct(UrlShortenerInterface $urlShortener, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->urlShortener = $urlShortener;
|
$this->urlShortener = $urlShortener;
|
||||||
@@ -88,6 +82,10 @@ class ResolveUrlCommand extends Command
|
|||||||
$output->writeln(sprintf('<error>' . $this->translator->translate(
|
$output->writeln(sprintf('<error>' . $this->translator->translate(
|
||||||
'Provided short code "%s" has an invalid format.'
|
'Provided short code "%s" has an invalid format.'
|
||||||
) . '</error>', $shortCode));
|
) . '</error>', $shortCode));
|
||||||
|
} catch (EntityDoesNotExistException $e) {
|
||||||
|
$output->writeln(sprintf('<error>' . $this->translator->translate(
|
||||||
|
'Provided short code "%s" could not be found.'
|
||||||
|
) . '</error>', $shortCode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Zend\I18n\Translator\Translator;
|
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class CreateTagCommand extends Command
|
class CreateTagCommand extends Command
|
||||||
@@ -22,13 +21,6 @@ class CreateTagCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* CreateTagCommand constructor.
|
|
||||||
* @param TagServiceInterface $tagService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @DI\Inject({TagService::class, Translator::class})
|
|
||||||
*/
|
|
||||||
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->tagService = $tagService;
|
$this->tagService = $tagService;
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Zend\I18n\Translator\Translator;
|
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class DeleteTagsCommand extends Command
|
class DeleteTagsCommand extends Command
|
||||||
@@ -22,13 +21,6 @@ class DeleteTagsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ListTagsCommand constructor.
|
|
||||||
* @param TagServiceInterface $tagService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @DI\Inject({TagService::class, Translator::class})
|
|
||||||
*/
|
|
||||||
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->tagService = $tagService;
|
$this->tagService = $tagService;
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
|
||||||
use Shlinkio\Shlink\Core\Entity\Tag;
|
use Shlinkio\Shlink\Core\Entity\Tag;
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Zend\I18n\Translator\Translator;
|
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class ListTagsCommand extends Command
|
class ListTagsCommand extends Command
|
||||||
@@ -23,13 +22,6 @@ class ListTagsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ListTagsCommand constructor.
|
|
||||||
* @param TagServiceInterface $tagService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @DI\Inject({TagService::class, Translator::class})
|
|
||||||
*/
|
|
||||||
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->tagService = $tagService;
|
$this->tagService = $tagService;
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
namespace Shlinkio\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
|
||||||
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Zend\I18n\Translator\Translator;
|
|
||||||
use Zend\I18n\Translator\TranslatorInterface;
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class RenameTagCommand extends Command
|
class RenameTagCommand extends Command
|
||||||
@@ -23,13 +22,6 @@ class RenameTagCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* RenameTagCommand constructor.
|
|
||||||
* @param TagServiceInterface $tagService
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @DI\Inject({TagService::class, Translator::class})
|
|
||||||
*/
|
|
||||||
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->tagService = $tagService;
|
$this->tagService = $tagService;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Visit;
|
namespace Shlinkio\Shlink\CLI\Command\Visit;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
|
||||||
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
use Shlinkio\Shlink\Common\Exception\WrongIpException;
|
||||||
use Shlinkio\Shlink\Common\Service\IpLocationResolver;
|
|
||||||
use Shlinkio\Shlink\Common\Service\IpLocationResolverInterface;
|
use Shlinkio\Shlink\Common\Service\IpLocationResolverInterface;
|
||||||
use Shlinkio\Shlink\Core\Entity\VisitLocation;
|
use Shlinkio\Shlink\Core\Entity\VisitLocation;
|
||||||
use Shlinkio\Shlink\Core\Service\VisitService;
|
|
||||||
use Shlinkio\Shlink\Core\Service\VisitServiceInterface;
|
use Shlinkio\Shlink\Core\Service\VisitServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
@@ -30,14 +29,6 @@ class ProcessVisitsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
private $translator;
|
private $translator;
|
||||||
|
|
||||||
/**
|
|
||||||
* ProcessVisitsCommand constructor.
|
|
||||||
* @param VisitServiceInterface $visitService
|
|
||||||
* @param IpLocationResolverInterface $ipLocationResolver
|
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*
|
|
||||||
* @Inject({VisitService::class, IpLocationResolver::class, "translator"})
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
VisitServiceInterface $visitService,
|
VisitServiceInterface $visitService,
|
||||||
IpLocationResolverInterface $ipLocationResolver,
|
IpLocationResolverInterface $ipLocationResolver,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI;
|
namespace Shlinkio\Shlink\CLI;
|
||||||
|
|
||||||
use Zend\Config\Factory;
|
use Zend\Config\Factory;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Factory;
|
namespace Shlinkio\Shlink\CLI\Factory;
|
||||||
|
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Factory;
|
namespace Shlinkio\Shlink\CLI\Factory;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
use Interop\Container\Exception\ContainerException;
|
use Interop\Container\Exception\ContainerException;
|
||||||
use Shlinkio\Shlink\CLI\Command\Install\InstallCommand;
|
use Shlinkio\Shlink\CLI\Command\Install\InstallCommand;
|
||||||
@@ -12,6 +13,7 @@ use Symfony\Component\Console\Application;
|
|||||||
use Symfony\Component\Console\Exception\LogicException;
|
use Symfony\Component\Console\Exception\LogicException;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Zend\Config\Writer\PhpArray;
|
use Zend\Config\Writer\PhpArray;
|
||||||
|
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
|
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
|
||||||
use Zend\ServiceManager\Exception\ServiceNotFoundException;
|
use Zend\ServiceManager\Exception\ServiceNotFoundException;
|
||||||
use Zend\ServiceManager\Factory\FactoryInterface;
|
use Zend\ServiceManager\Factory\FactoryInterface;
|
||||||
@@ -40,7 +42,7 @@ class InstallApplicationFactory implements FactoryInterface
|
|||||||
new PhpArray(),
|
new PhpArray(),
|
||||||
$container->get(Filesystem::class),
|
$container->get(Filesystem::class),
|
||||||
new ConfigCustomizerPluginManager($container, ['factories' => [
|
new ConfigCustomizerPluginManager($container, ['factories' => [
|
||||||
Plugin\DatabaseConfigCustomizerPlugin::class => AnnotatedFactory::class,
|
Plugin\DatabaseConfigCustomizerPlugin::class => ConfigAbstractFactory::class,
|
||||||
Plugin\UrlShortenerConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
Plugin\UrlShortenerConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
||||||
Plugin\LanguageConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
Plugin\LanguageConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
||||||
Plugin\ApplicationConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
Plugin\ApplicationConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install;
|
namespace Shlinkio\Shlink\CLI\Install;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Install\Plugin\ConfigCustomizerPluginInterface;
|
use Shlinkio\Shlink\CLI\Install\Plugin\ConfigCustomizerPluginInterface;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install;
|
namespace Shlinkio\Shlink\CLI\Install;
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Symfony\Component\Console\Exception\RuntimeException;
|
use Symfony\Component\Console\Exception\RuntimeException;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
use Acelaya\ZsmAnnotatedServices\Annotation as DI;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin\Factory;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin\Factory;
|
||||||
|
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
||||||
@@ -42,7 +44,14 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
|
|||||||
'Character set for generated short codes (leave empty to autogenerate one)',
|
'Character set for generated short codes (leave empty to autogenerate one)',
|
||||||
null,
|
null,
|
||||||
true
|
true
|
||||||
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS)
|
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS),
|
||||||
|
'VALIDATE_URL' => $this->questionHelper->ask(
|
||||||
|
$input,
|
||||||
|
$output,
|
||||||
|
new ConfirmationQuestion(
|
||||||
|
'<question>Do you want to validate long urls by 200 HTTP status code on response (Y/n):</question>'
|
||||||
|
)
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Model;
|
namespace Shlinkio\Shlink\CLI\Model;
|
||||||
|
|
||||||
use Zend\Stdlib\ArraySerializableInterface;
|
use Zend\Stdlib\ArraySerializableInterface;
|
||||||
@@ -189,6 +191,7 @@ final class CustomizableAppConfig implements ArraySerializableInterface
|
|||||||
'SCHEMA' => $urlShortener['domain']['schema'],
|
'SCHEMA' => $urlShortener['domain']['schema'],
|
||||||
'HOSTNAME' => $urlShortener['domain']['hostname'],
|
'HOSTNAME' => $urlShortener['domain']['hostname'],
|
||||||
'CHARS' => $urlShortener['shortcode_chars'],
|
'CHARS' => $urlShortener['shortcode_chars'],
|
||||||
|
'VALIDATE_URL' => $urlShortener['validate_url'] ?? true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,6 +243,7 @@ final class CustomizableAppConfig implements ArraySerializableInterface
|
|||||||
'hostname' => $this->urlShortener['HOSTNAME'],
|
'hostname' => $this->urlShortener['HOSTNAME'],
|
||||||
],
|
],
|
||||||
'shortcode_chars' => $this->urlShortener['CHARS'],
|
'shortcode_chars' => $this->urlShortener['CHARS'],
|
||||||
|
'validate_url' => $this->urlShortener['VALIDATE_URL'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
namespace ShlinkioTest\Shlink\CLI\Command\Api;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Config;
|
namespace ShlinkioTest\Shlink\CLI\Command\Config;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Install;
|
namespace ShlinkioTest\Shlink\CLI\Command\Install;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@@ -63,7 +65,7 @@ class GeneratePreviewCommandTest extends TestCase
|
|||||||
$this->previewGenerator->generatePreview('http://baz.com/something')->shouldBeCalledTimes(1);
|
$this->previewGenerator->generatePreview('http://baz.com/something')->shouldBeCalledTimes(1);
|
||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'shortcode:process-previews'
|
'command' => 'shortcode:process-previews',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +85,7 @@ class GeneratePreviewCommandTest extends TestCase
|
|||||||
->shouldBeCalledTimes(count($items));
|
->shouldBeCalledTimes(count($items));
|
||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'shortcode:process-previews'
|
'command' => 'shortcode:process-previews',
|
||||||
]);
|
]);
|
||||||
$output = $this->commandTester->getDisplay();
|
$output = $this->commandTester->getDisplay();
|
||||||
$this->assertEquals(count($items), substr_count($output, 'Error'));
|
$this->assertEquals(count($items), substr_count($output, 'Error'));
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@@ -27,7 +29,7 @@ class GenerateShortcodeCommandTest extends TestCase
|
|||||||
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
$this->urlShortener = $this->prophesize(UrlShortener::class);
|
||||||
$command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), [
|
$command = new GenerateShortcodeCommand($this->urlShortener->reveal(), Translator::factory([]), [
|
||||||
'schema' => 'http',
|
'schema' => 'http',
|
||||||
'hostname' => 'foo.com'
|
'hostname' => 'foo.com',
|
||||||
]);
|
]);
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$app->add($command);
|
$app->add($command);
|
||||||
@@ -44,7 +46,7 @@ class GenerateShortcodeCommandTest extends TestCase
|
|||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'shortcode:generate',
|
'command' => 'shortcode:generate',
|
||||||
'longUrl' => 'http://domain.com/foo/bar'
|
'longUrl' => 'http://domain.com/foo/bar',
|
||||||
]);
|
]);
|
||||||
$output = $this->commandTester->getDisplay();
|
$output = $this->commandTester->getDisplay();
|
||||||
$this->assertTrue(strpos($output, 'http://foo.com/abc123') > 0);
|
$this->assertTrue(strpos($output, 'http://foo.com/abc123') > 0);
|
||||||
@@ -60,7 +62,7 @@ class GenerateShortcodeCommandTest extends TestCase
|
|||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
'command' => 'shortcode:generate',
|
'command' => 'shortcode:generate',
|
||||||
'longUrl' => 'http://domain.com/invalid'
|
'longUrl' => 'http://domain.com/invalid',
|
||||||
]);
|
]);
|
||||||
$output = $this->commandTester->getDisplay();
|
$output = $this->commandTester->getDisplay();
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
namespace ShlinkioTest\Shlink\CLI\Command\Shortcode;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Shortcode\ResolveUrlCommand;
|
use Shlinkio\Shlink\CLI\Command\Shortcode\ResolveUrlCommand;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
@@ -55,7 +58,7 @@ class ResolveUrlCommandTest extends TestCase
|
|||||||
public function incorrectShortCodeOutputsErrorMessage()
|
public function incorrectShortCodeOutputsErrorMessage()
|
||||||
{
|
{
|
||||||
$shortCode = 'abc123';
|
$shortCode = 'abc123';
|
||||||
$this->urlShortener->shortCodeToUrl($shortCode)->willReturn(null)
|
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(EntityDoesNotExistException::class)
|
||||||
->shouldBeCalledTimes(1);
|
->shouldBeCalledTimes(1);
|
||||||
|
|
||||||
$this->commandTester->execute([
|
$this->commandTester->execute([
|
||||||
@@ -63,7 +66,7 @@ class ResolveUrlCommandTest extends TestCase
|
|||||||
'shortCode' => $shortCode,
|
'shortCode' => $shortCode,
|
||||||
]);
|
]);
|
||||||
$output = $this->commandTester->getDisplay();
|
$output = $this->commandTester->getDisplay();
|
||||||
$this->assertEquals('No URL found for short code "' . $shortCode . '"' . PHP_EOL, $output);
|
$this->assertEquals('Provided short code "' . $shortCode . '" could not be found.' . PHP_EOL, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Prophecy\MethodProphecy;
|
use Prophecy\Prophecy\MethodProphecy;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand;
|
use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand;
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Shlinkio\Shlink\Core\Entity\Tag;
|
use Shlinkio\Shlink\Core\Entity\Tag;
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
namespace ShlinkioTest\Shlink\CLI\Command\Tag;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Command\Visit;
|
namespace ShlinkioTest\Shlink\CLI\Command\Visit;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI;
|
namespace ShlinkioTest\Shlink\CLI;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Factory;
|
namespace ShlinkioTest\Shlink\CLI\Factory;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Factory;
|
namespace ShlinkioTest\Shlink\CLI\Factory;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Install\Plugin\Factory;
|
namespace ShlinkioTest\Shlink\CLI\Install\Plugin\Factory;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
namespace ShlinkioTest\Shlink\CLI\Install\Plugin;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@@ -45,8 +47,9 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
|
|||||||
'SCHEMA' => 'something',
|
'SCHEMA' => 'something',
|
||||||
'HOSTNAME' => 'something',
|
'HOSTNAME' => 'something',
|
||||||
'CHARS' => 'something',
|
'CHARS' => 'something',
|
||||||
|
'VALIDATE_URL' => 'something',
|
||||||
], $config->getUrlShortener());
|
], $config->getUrlShortener());
|
||||||
$askSecret->shouldHaveBeenCalledTimes(3);
|
$askSecret->shouldHaveBeenCalledTimes(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,6 +67,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
|
|||||||
'SCHEMA' => 'bar',
|
'SCHEMA' => 'bar',
|
||||||
'HOSTNAME' => 'bar',
|
'HOSTNAME' => 'bar',
|
||||||
'CHARS' => 'bar',
|
'CHARS' => 'bar',
|
||||||
|
'VALIDATE_URL' => 'bar',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
|
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
|
||||||
@@ -72,8 +76,9 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
|
|||||||
'SCHEMA' => 'foo',
|
'SCHEMA' => 'foo',
|
||||||
'HOSTNAME' => 'foo',
|
'HOSTNAME' => 'foo',
|
||||||
'CHARS' => 'foo',
|
'CHARS' => 'foo',
|
||||||
|
'VALIDATE_URL' => false,
|
||||||
], $config->getUrlShortener());
|
], $config->getUrlShortener());
|
||||||
$ask->shouldHaveBeenCalledTimes(4);
|
$ask->shouldHaveBeenCalledTimes(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,6 +94,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
|
|||||||
'SCHEMA' => 'foo',
|
'SCHEMA' => 'foo',
|
||||||
'HOSTNAME' => 'foo',
|
'HOSTNAME' => 'foo',
|
||||||
'CHARS' => 'foo',
|
'CHARS' => 'foo',
|
||||||
|
'VALIDATE_URL' => 'foo',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
|
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
|
||||||
@@ -97,6 +103,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
|
|||||||
'SCHEMA' => 'foo',
|
'SCHEMA' => 'foo',
|
||||||
'HOSTNAME' => 'foo',
|
'HOSTNAME' => 'foo',
|
||||||
'CHARS' => 'foo',
|
'CHARS' => 'foo',
|
||||||
|
'VALIDATE_URL' => 'foo',
|
||||||
], $config->getUrlShortener());
|
], $config->getUrlShortener());
|
||||||
$ask->shouldHaveBeenCalledTimes(1);
|
$ask->shouldHaveBeenCalledTimes(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +1,62 @@
|
|||||||
<?php
|
<?php
|
||||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Doctrine\Common\Cache\Cache;
|
use Doctrine\Common\Cache\Cache;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Shlinkio\Shlink\Common\Factory;
|
use Shlinkio\Shlink\Common\Factory;
|
||||||
use Shlinkio\Shlink\Common\Image;
|
use Shlinkio\Shlink\Common\Image;
|
||||||
|
use Shlinkio\Shlink\Common\Image\ImageBuilder;
|
||||||
use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware;
|
use Shlinkio\Shlink\Common\Middleware\LocaleMiddleware;
|
||||||
use Shlinkio\Shlink\Common\Service;
|
use Shlinkio\Shlink\Common\Service;
|
||||||
use Shlinkio\Shlink\Common\Twig\Extension\TranslatorExtension;
|
use Shlinkio\Shlink\Common\Template\Extension\TranslatorExtension;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Zend\I18n\Translator\Translator;
|
use Zend\I18n\Translator\Translator;
|
||||||
|
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||||
use Zend\ServiceManager\Factory\InvokableFactory;
|
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'dependencies' => [
|
'dependencies' => [
|
||||||
'invokables' => [
|
|
||||||
Filesystem::class => Filesystem::class,
|
|
||||||
],
|
|
||||||
'factories' => [
|
'factories' => [
|
||||||
EntityManager::class => Factory\EntityManagerFactory::class,
|
EntityManager::class => Factory\EntityManagerFactory::class,
|
||||||
GuzzleHttp\Client::class => InvokableFactory::class,
|
GuzzleHttp\Client::class => InvokableFactory::class,
|
||||||
Cache::class => Factory\CacheFactory::class,
|
Cache::class => Factory\CacheFactory::class,
|
||||||
'Logger_Shlink' => Factory\LoggerFactory::class,
|
'Logger_Shlink' => Factory\LoggerFactory::class,
|
||||||
|
Filesystem::class => InvokableFactory::class,
|
||||||
|
|
||||||
Translator::class => Factory\TranslatorFactory::class,
|
Translator::class => Factory\TranslatorFactory::class,
|
||||||
TranslatorExtension::class => AnnotatedFactory::class,
|
TranslatorExtension::class => ConfigAbstractFactory::class,
|
||||||
LocaleMiddleware::class => AnnotatedFactory::class,
|
LocaleMiddleware::class => ConfigAbstractFactory::class,
|
||||||
|
|
||||||
Image\ImageBuilder::class => Image\ImageBuilderFactory::class,
|
Image\ImageBuilder::class => Image\ImageBuilderFactory::class,
|
||||||
|
|
||||||
Service\IpLocationResolver::class => AnnotatedFactory::class,
|
Service\IpLocationResolver::class => ConfigAbstractFactory::class,
|
||||||
Service\PreviewGenerator::class => AnnotatedFactory::class,
|
Service\PreviewGenerator::class => ConfigAbstractFactory::class,
|
||||||
],
|
],
|
||||||
'aliases' => [
|
'aliases' => [
|
||||||
'em' => EntityManager::class,
|
'em' => EntityManager::class,
|
||||||
'httpClient' => GuzzleHttp\Client::class,
|
'httpClient' => GuzzleHttp\Client::class,
|
||||||
'translator' => Translator::class,
|
'translator' => Translator::class,
|
||||||
'logger' => LoggerInterface::class,
|
'logger' => LoggerInterface::class,
|
||||||
AnnotatedFactory::CACHE_SERVICE => Cache::class,
|
|
||||||
Logger::class => 'Logger_Shlink',
|
Logger::class => 'Logger_Shlink',
|
||||||
LoggerInterface::class => 'Logger_Shlink',
|
LoggerInterface::class => 'Logger_Shlink',
|
||||||
],
|
],
|
||||||
|
'abstract_factories' => [
|
||||||
|
Factory\DottedAccessConfigAbstractFactory::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
ConfigAbstractFactory::class => [
|
||||||
|
TranslatorExtension::class => ['translator'],
|
||||||
|
LocaleMiddleware::class => ['translator'],
|
||||||
|
Service\IpLocationResolver::class => ['httpClient'],
|
||||||
|
Service\PreviewGenerator::class => [
|
||||||
|
ImageBuilder::class,
|
||||||
|
Filesystem::class,
|
||||||
|
'config.preview_generation.files_location',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\Common\Twig\Extension\TranslatorExtension;
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Shlinkio\Shlink\Common\Template\Extension\TranslatorExtension;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'twig' => [
|
'plates' => [
|
||||||
'extensions' => [
|
'extensions' => [
|
||||||
TranslatorExtension::class,
|
TranslatorExtension::class,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common;
|
namespace Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common;
|
namespace Shlinkio\Shlink\Common;
|
||||||
|
|
||||||
use Zend\Config\Factory;
|
use Zend\Config\Factory;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Entity;
|
namespace Shlinkio\Shlink\Common\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Exception;
|
namespace Shlinkio\Shlink\Common\Exception;
|
||||||
|
|
||||||
interface ExceptionInterface
|
interface ExceptionInterface
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Exception;
|
namespace Shlinkio\Shlink\Common\Exception;
|
||||||
|
|
||||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Exception;
|
namespace Shlinkio\Shlink\Common\Exception;
|
||||||
|
|
||||||
class PreviewGenerationException extends RuntimeException
|
class PreviewGenerationException extends RuntimeException
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Exception;
|
namespace Shlinkio\Shlink\Common\Exception;
|
||||||
|
|
||||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shlinkio\Shlink\Common\Exception;
|
namespace Shlinkio\Shlink\Common\Exception;
|
||||||
|
|
||||||
class WrongIpException extends RuntimeException
|
class WrongIpException extends RuntimeException
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user