Merge pull request #452 from acelaya/feature/deprecated-previews

Deprecated previews generation
This commit is contained in:
Alejandro Celaya 2019-08-09 18:23:53 +02:00 committed by GitHub
commit bfd2f5b7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 39 additions and 6 deletions

View file

@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
#### Added
* *Nothing*
#### Changed
* *Nothing*
#### Deprecated
* [#428](https://github.com/shlinkio/shlink/issues/428) Deprecated preview-generation feature. It will keep working but it will be removed in Shlink v2.0.0
#### Removed
* *Nothing*
#### Fixed
* *Nothing*
## 1.18.0 - 2019-08-08 ## 1.18.0 - 2019-08-08
#### Added #### Added
@ -55,7 +78,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* [#305](https://github.com/shlinkio/shlink/issues/305) Implemented changes which will allow Shlink to be truly clusterizable. * [#305](https://github.com/shlinkio/shlink/issues/305) Implemented changes which will allow Shlink to be truly clusterizable.
* [#262](https://github.com/shlinkio/shlink/issues/262) Increased mutation score to 75%. * [#262](https://github.com/shlinkio/shlink/issues/262) Increased mutation score to 75%.
### Deprecated #### Deprecated
* *Nothing* * *Nothing*
@ -86,7 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* [#56](https://github.com/shlinkio/shlink/issues/56) Simplified supported cache, requiring APCu always. * [#56](https://github.com/shlinkio/shlink/issues/56) Simplified supported cache, requiring APCu always.
### Deprecated #### Deprecated
* [#406](https://github.com/shlinkio/shlink/issues/406) Deprecated `PUT /short-urls/{shortCode}` REST endpoint in favor of `PATCH /short-urls/{shortCode}`. * [#406](https://github.com/shlinkio/shlink/issues/406) Deprecated `PUT /short-urls/{shortCode}` REST endpoint in favor of `PATCH /short-urls/{shortCode}`.

View file

@ -196,6 +196,8 @@ Those tasks can be performed using shlink's CLI, so it should be easy to schedul
Running this will improve the performance of the `doma.in/abc123/preview` URLs, which return a preview of the site. Running this will improve the performance of the `doma.in/abc123/preview` URLs, which return a preview of the site.
> **Important!** Generating previews is considered deprecated and the feature will be removed in Shlink v2.
* **For shlink older than v1.17.0**: Update IP geolocation database: `/path/to/shlink/bin/cli visit:update-db` * **For shlink older than v1.17.0**: Update IP geolocation database: `/path/to/shlink/bin/cli visit:update-db`
When shlink is installed it downloads a fresh [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) db file. Running this command will update this file. When shlink is installed it downloads a fresh [GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) db file. Running this command will update this file.
@ -276,7 +278,7 @@ Available commands:
short-url:generate [shortcode:generate|short-code:generate] Generates a short URL for provided long URL and returns it short-url:generate [shortcode:generate|short-code:generate] Generates a short URL for provided long URL and returns it
short-url:list [shortcode:list|short-code:list] List all short URLs short-url:list [shortcode:list|short-code:list] List all short URLs
short-url:parse [shortcode:parse|short-code:parse] Returns the long URL behind a short code short-url:parse [shortcode:parse|short-code:parse] Returns the long URL behind a short code
short-url:process-previews [shortcode:process-previews|short-code:process-previews] Processes and generates the previews for every URL, improving performance for later web requests. short-url:process-previews [shortcode:process-previews|short-code:process-previews] [DEPRECATED] Processes and generates the previews for every URL, improving performance for later web requests.
short-url:visits [shortcode:visits|short-code:visits] Returns the detailed visits information for provided short code short-url:visits [shortcode:visits|short-code:visits] Returns the detailed visits information for provided short code
tag tag
tag:create Creates one or more tags. tag:create Creates one or more tags.

View file

@ -1,6 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/** @deprecated */
return [ return [
'preview_generation' => [ 'preview_generation' => [

View file

@ -1,5 +1,6 @@
{ {
"get": { "get": {
"deprecated": true,
"operationId": "shortUrlPreview", "operationId": "shortUrlPreview",
"tags": [ "tags": [
"URL Shortener" "URL Shortener"

View file

@ -14,6 +14,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use function sprintf; use function sprintf;
/** @deprecated */
class GeneratePreviewCommand extends Command class GeneratePreviewCommand extends Command
{ {
public const NAME = 'short-url:process-previews'; public const NAME = 'short-url:process-previews';
@ -37,7 +38,8 @@ class GeneratePreviewCommand extends Command
->setName(self::NAME) ->setName(self::NAME)
->setAliases(self::ALIASES) ->setAliases(self::ALIASES)
->setDescription( ->setDescription(
'Processes and generates the previews for every URL, improving performance for later web requests.' '[DEPRECATED] Processes and generates the previews for every URL, improving performance for later web '
. 'requests.'
); );
} }

View file

@ -5,6 +5,7 @@ namespace Shlinkio\Shlink\Common\Exception;
use function sprintf; use function sprintf;
/** @deprecated */
class PreviewGenerationException extends RuntimeException class PreviewGenerationException extends RuntimeException
{ {
public static function fromImageError(string $error): self public static function fromImageError(string $error): self

View file

@ -11,6 +11,7 @@ use Symfony\Component\Filesystem\Filesystem;
use function sprintf; use function sprintf;
use function urlencode; use function urlencode;
/** @deprecated */
class PreviewGenerator implements PreviewGeneratorInterface class PreviewGenerator implements PreviewGeneratorInterface
{ {
/** @var string */ /** @var string */

View file

@ -5,6 +5,7 @@ namespace Shlinkio\Shlink\Common\Service;
use Shlinkio\Shlink\Common\Exception\PreviewGenerationException; use Shlinkio\Shlink\Common\Exception\PreviewGenerationException;
/** @deprecated */
interface PreviewGeneratorInterface interface PreviewGeneratorInterface
{ {
/** /**

View file

@ -36,14 +36,14 @@ return [
], ],
'allowed_methods' => [RequestMethod::METHOD_GET], 'allowed_methods' => [RequestMethod::METHOD_GET],
], ],
// Deprecated routes
[ [
'name' => 'short-url-preview', 'name' => 'short-url-preview',
'path' => '/{shortCode}/preview', 'path' => '/{shortCode}/preview',
'middleware' => Action\PreviewAction::class, 'middleware' => Action\PreviewAction::class,
'allowed_methods' => [RequestMethod::METHOD_GET], 'allowed_methods' => [RequestMethod::METHOD_GET],
], ],
// Old QR code route. Deprecated
[ [
'name' => 'short-url-qr-code-old', 'name' => 'short-url-qr-code-old',
'path' => '/qr/{shortCode}[/{size:[0-9]+}]', 'path' => '/qr/{shortCode}[/{size:[0-9]+}]',

View file

@ -17,6 +17,7 @@ use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException; use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface; use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
/** @deprecated */
class PreviewAction implements MiddlewareInterface class PreviewAction implements MiddlewareInterface
{ {
use ResponseUtilsTrait; use ResponseUtilsTrait;