mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-23 05:13:13 +03:00
Fixed config file being deleted by mistake by build script
This commit is contained in:
parent
05695e8cd6
commit
d289c62532
8 changed files with 13 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
||||||
namespace PHPSTORM_META;
|
namespace PHPSTORM_META;
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceLocatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhpStorm Container Interop code completion
|
* PhpStorm Container Interop code completion
|
||||||
|
@ -17,7 +17,7 @@ $STATIC_METHOD_TYPES = [
|
||||||
ContainerInterface::get('') => [
|
ContainerInterface::get('') => [
|
||||||
'' == '@',
|
'' == '@',
|
||||||
],
|
],
|
||||||
ServiceManager::build('') => [
|
ServiceLocatorInterface::build('') => [
|
||||||
'' == '@',
|
'' == '@',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -105,7 +105,8 @@
|
||||||
|
|
||||||
"test": [
|
"test": [
|
||||||
"@test:unit",
|
"@test:unit",
|
||||||
"@test:db"
|
"@test:db",
|
||||||
|
"@test:api"
|
||||||
],
|
],
|
||||||
"test:ci": [
|
"test:ci": [
|
||||||
"@test:unit:ci",
|
"@test:unit:ci",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
|
||||||
use function Shlinkio\Shlink\Common\env;
|
use function Shlinkio\Shlink\Common\env;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -11,7 +11,7 @@ return [
|
||||||
'schema' => env('SHORTENED_URL_SCHEMA', 'http'),
|
'schema' => env('SHORTENED_URL_SCHEMA', 'http'),
|
||||||
'hostname' => env('SHORTENED_URL_HOSTNAME'),
|
'hostname' => env('SHORTENED_URL_HOSTNAME'),
|
||||||
],
|
],
|
||||||
'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortener::DEFAULT_CHARS),
|
'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortenerOptions::DEFAULT_CHARS),
|
||||||
'validate_url' => true,
|
'validate_url' => true,
|
||||||
'not_found_short_url' => [
|
'not_found_short_url' => [
|
||||||
'enable_redirection' => false,
|
'enable_redirection' => false,
|
||||||
|
|
|
@ -3,9 +3,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'phpwkhtmltopdf' => [
|
'wkhtmltopdf' => [
|
||||||
'images' => [
|
'images' => [
|
||||||
'binary' => 'bin/wkhtmltoimage',
|
'binary' => __DIR__ . '/../../bin/wkhtmltoimage',
|
||||||
'type' => 'jpg',
|
'type' => 'jpg',
|
||||||
],
|
],
|
||||||
],
|
],
|
|
@ -7,7 +7,7 @@ use function sprintf;
|
||||||
|
|
||||||
class PreviewGenerationException extends RuntimeException
|
class PreviewGenerationException extends RuntimeException
|
||||||
{
|
{
|
||||||
public static function fromImageError($error)
|
public static function fromImageError(string $error): self
|
||||||
{
|
{
|
||||||
return new self(sprintf('Error generating a preview image with error: %s', $error));
|
return new self(sprintf('Error generating a preview image with error: %s', $error));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ImageFactory implements FactoryInterface
|
||||||
*/
|
*/
|
||||||
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
|
||||||
{
|
{
|
||||||
$config = $container->get('config')['phpwkhtmltopdf'];
|
$config = $container->get('config')['wkhtmltopdf'];
|
||||||
$image = new Image($config['images'] ?? null);
|
$image = new Image($config['images'] ?? null);
|
||||||
|
|
||||||
if ($options['url'] ?? null) {
|
if ($options['url'] ?? null) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PreviewGenerator implements PreviewGeneratorInterface
|
||||||
/** @var Filesystem */
|
/** @var Filesystem */
|
||||||
private $filesystem;
|
private $filesystem;
|
||||||
|
|
||||||
public function __construct(ImageBuilderInterface $imageBuilder, Filesystem $filesystem, $location)
|
public function __construct(ImageBuilderInterface $imageBuilder, Filesystem $filesystem, string $location)
|
||||||
{
|
{
|
||||||
$this->location = $location;
|
$this->location = $location;
|
||||||
$this->imageBuilder = $imageBuilder;
|
$this->imageBuilder = $imageBuilder;
|
||||||
|
@ -33,7 +33,6 @@ class PreviewGenerator implements PreviewGeneratorInterface
|
||||||
*/
|
*/
|
||||||
public function generatePreview(string $url): string
|
public function generatePreview(string $url): string
|
||||||
{
|
{
|
||||||
/** @var Image $image */
|
|
||||||
$image = $this->imageBuilder->build(Image::class, ['url' => $url]);
|
$image = $this->imageBuilder->build(Image::class, ['url' => $url]);
|
||||||
|
|
||||||
// If the file already exists, return its path
|
// If the file already exists, return its path
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ImageFactoryTest extends TestCase
|
||||||
{
|
{
|
||||||
/** @var Image $image */
|
/** @var Image $image */
|
||||||
$image = $this->factory->__invoke(new ServiceManager(['services' => [
|
$image = $this->factory->__invoke(new ServiceManager(['services' => [
|
||||||
'config' => ['phpwkhtmltopdf' => []],
|
'config' => ['wkhtmltopdf' => []],
|
||||||
]]), '');
|
]]), '');
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class ImageFactoryTest extends TestCase
|
||||||
|
|
||||||
/** @var Image $image */
|
/** @var Image $image */
|
||||||
$image = $this->factory->__invoke(new ServiceManager(['services' => [
|
$image = $this->factory->__invoke(new ServiceManager(['services' => [
|
||||||
'config' => ['phpwkhtmltopdf' => []],
|
'config' => ['wkhtmltopdf' => []],
|
||||||
]]), '', ['url' => $expectedPage]);
|
]]), '', ['url' => $expectedPage]);
|
||||||
$this->assertInstanceOf(Image::class, $image);
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue