Cache image service results
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace EP\EpProducts\Traits;
|
namespace EP\EpProducts\Service;
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
*
|
*
|
||||||
@@ -32,9 +32,10 @@ use TYPO3\CMS\Core\Imaging\ImageManipulation\Area;
|
|||||||
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
|
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
|
||||||
use TYPO3\CMS\Core\Resource\FileReference;
|
use TYPO3\CMS\Core\Resource\FileReference;
|
||||||
use TYPO3\CMS\Core\Resource\FileRepository;
|
use TYPO3\CMS\Core\Resource\FileRepository;
|
||||||
|
use TYPO3\CMS\Core\SingletonInterface;
|
||||||
use TYPO3\CMS\Extbase\Service\ImageService;
|
use TYPO3\CMS\Extbase\Service\ImageService;
|
||||||
|
|
||||||
trait ImageServiceTrait
|
abstract class AbstractImageService implements SingletonInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var FileRepository
|
* @var FileRepository
|
||||||
@@ -60,7 +61,7 @@ trait ImageServiceTrait
|
|||||||
|
|
||||||
public function getImages($uid): array
|
public function getImages($uid): array
|
||||||
{
|
{
|
||||||
$key = $this->table.$uid;
|
$key = sprintf('images-%s-%d', $this->table, $uid);
|
||||||
if (false === ($value = $this->cache->get($key))) {
|
if (false === ($value = $this->cache->get($key))) {
|
||||||
$original = $this->fileRepository->findByRelation(
|
$original = $this->fileRepository->findByRelation(
|
||||||
$this->table,
|
$this->table,
|
||||||
|
|||||||
@@ -45,26 +45,14 @@ class HotelDataService implements SingletonInterface
|
|||||||
*/
|
*/
|
||||||
protected $hotelImageService;
|
protected $hotelImageService;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var FlagIconService
|
|
||||||
*/
|
|
||||||
protected $flagIconService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param HotelRepository $hotelRepository
|
* @param HotelRepository $hotelRepository
|
||||||
* @param HotelImageService $hotelImageService
|
* @param HotelImageService $hotelImageService
|
||||||
* @param FlagIconService $flagIconService
|
|
||||||
*/
|
*/
|
||||||
public function __construct
|
public function __construct(HotelRepository $hotelRepository, HotelImageService $hotelImageService)
|
||||||
(
|
|
||||||
HotelRepository $hotelRepository,
|
|
||||||
HotelImageService $hotelImageService,
|
|
||||||
FlagIconService $flagIconService
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$this->hotelRepository = $hotelRepository;
|
$this->hotelRepository = $hotelRepository;
|
||||||
$this->hotelImageService = $hotelImageService;
|
$this->hotelImageService = $hotelImageService;
|
||||||
$this->flagIconService = $flagIconService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +99,6 @@ class HotelDataService implements SingletonInterface
|
|||||||
'country' => [
|
'country' => [
|
||||||
'name' => $hotelData['country'],
|
'name' => $hotelData['country'],
|
||||||
'code' => $hotelData['countryCode'],
|
'code' => $hotelData['countryCode'],
|
||||||
'flag' => $this->flagIconService->getImage($hotelData['countryCode']),
|
|
||||||
],
|
],
|
||||||
'region' => [
|
'region' => [
|
||||||
'name' => $hotelData['regionName'],
|
'name' => $hotelData['regionName'],
|
||||||
@@ -171,7 +158,6 @@ class HotelDataService implements SingletonInterface
|
|||||||
'country' => [
|
'country' => [
|
||||||
'name' => $row['country'],
|
'name' => $row['country'],
|
||||||
'code' => $row['countryCode'],
|
'code' => $row['countryCode'],
|
||||||
'flag' => $this->flagIconService->getImage($row['countryCode']),
|
|
||||||
],
|
],
|
||||||
'region' => [
|
'region' => [
|
||||||
'name' => $row['regionName'],
|
'name' => $row['regionName'],
|
||||||
@@ -228,7 +214,6 @@ class HotelDataService implements SingletonInterface
|
|||||||
'country' => [
|
'country' => [
|
||||||
'name' => $row['country'],
|
'name' => $row['country'],
|
||||||
'code' => $row['countryCode'],
|
'code' => $row['countryCode'],
|
||||||
'flag' => $this->flagIconService->getImage($row['countryCode']),
|
|
||||||
],
|
],
|
||||||
'available' => 0,
|
'available' => 0,
|
||||||
'board' => $row['board'],
|
'board' => $row['board'],
|
||||||
|
|||||||
@@ -26,13 +26,8 @@ namespace EP\EpProducts\Service;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* This copyright notice MUST APPEAR in all copies of the script!
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use EP\EpProducts\Traits\ImageServiceTrait;
|
class HotelImageService extends AbstractImageService
|
||||||
use TYPO3\CMS\Core\SingletonInterface;
|
|
||||||
|
|
||||||
class HotelImageService implements SingletonInterface
|
|
||||||
{
|
{
|
||||||
use ImageServiceTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,31 +54,23 @@ class ProductDataService implements SingletonInterface
|
|||||||
*/
|
*/
|
||||||
protected $hotelImageService;
|
protected $hotelImageService;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var FlagIconService
|
|
||||||
*/
|
|
||||||
protected $flagIconService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ProductRepository $productRepository
|
* @param ProductRepository $productRepository
|
||||||
* @param HotelRepository $hotelRepository
|
* @param HotelRepository $hotelRepository
|
||||||
* @param HotelImageService $hotelImageService
|
* @param HotelImageService $hotelImageService
|
||||||
* @param ProductImageService $productImageService
|
* @param ProductImageService $productImageService
|
||||||
* @param FlagIconService $flagIconService
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ProductRepository $productRepository,
|
ProductRepository $productRepository,
|
||||||
HotelRepository $hotelRepository,
|
HotelRepository $hotelRepository,
|
||||||
HotelImageService $hotelImageService,
|
HotelImageService $hotelImageService,
|
||||||
ProductImageService $productImageService,
|
ProductImageService $productImageService
|
||||||
FlagIconService $flagIconService
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
$this->hotelRepository = $hotelRepository;
|
$this->hotelRepository = $hotelRepository;
|
||||||
$this->productImageService = $productImageService;
|
$this->productImageService = $productImageService;
|
||||||
$this->hotelImageService = $hotelImageService;
|
$this->hotelImageService = $hotelImageService;
|
||||||
$this->flagIconService = $flagIconService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -221,7 +213,6 @@ class ProductDataService implements SingletonInterface
|
|||||||
'country' => [
|
'country' => [
|
||||||
'name' => $teaserData['countryName'],
|
'name' => $teaserData['countryName'],
|
||||||
'code' => $teaserData['countryCode'],
|
'code' => $teaserData['countryCode'],
|
||||||
'flag' => $this->flagIconService->getImage($teaserData['countryCode']),
|
|
||||||
],
|
],
|
||||||
'region' => [
|
'region' => [
|
||||||
'name' => $teaserData['regionName'],
|
'name' => $teaserData['regionName'],
|
||||||
|
|||||||
@@ -26,13 +26,8 @@ namespace EP\EpProducts\Service;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* This copyright notice MUST APPEAR in all copies of the script!
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use EP\EpProducts\Traits\ImageServiceTrait;
|
class ProductImageService extends AbstractImageService
|
||||||
use TYPO3\CMS\Core\SingletonInterface;
|
|
||||||
|
|
||||||
class ProductImageService implements SingletonInterface
|
|
||||||
{
|
{
|
||||||
use ImageServiceTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,33 @@
|
|||||||
services:
|
services:
|
||||||
|
_defaults:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
public: false
|
||||||
|
|
||||||
|
EP\EpProducts\:
|
||||||
|
resource: '../Classes/*'
|
||||||
|
exclude: '../Classes/Domain/Model/*'
|
||||||
|
|
||||||
EP\EpProducts\EventListener\SystemInformationToolbarListener:
|
EP\EpProducts\EventListener\SystemInformationToolbarListener:
|
||||||
tags:
|
tags:
|
||||||
- name: event.listener
|
- name: event.listener
|
||||||
identifier: 'epToolbarListener'
|
identifier: 'epToolbarListener'
|
||||||
event: TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent
|
event: TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent
|
||||||
|
|
||||||
|
cache.ep_cache:
|
||||||
|
class: TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
|
||||||
|
public: true
|
||||||
|
factory: ['@TYPO3\CMS\Core\Cache\CacheManager', 'getCache']
|
||||||
|
arguments: ['ep_products_cache']
|
||||||
|
|
||||||
|
EP\EpProducts\Service\HotelImageService:
|
||||||
|
arguments:
|
||||||
|
$fileRepository: '@TYPO3\CMS\Core\Resource\FileRepository'
|
||||||
|
$imageService: '@TYPO3\CMS\Extbase\Service\ImageService'
|
||||||
|
$cache: '@cache.ep_cache'
|
||||||
|
|
||||||
|
EP\EpProducts\Service\ProductImageService:
|
||||||
|
arguments:
|
||||||
|
$fileRepository: '@TYPO3\CMS\Core\Resource\FileRepository'
|
||||||
|
$imageService: '@TYPO3\CMS\Extbase\Service\ImageService'
|
||||||
|
$cache: '@cache.ep_cache'
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
defined('TYPO3_MODE') or die('Access denied.');
|
||||||
|
|
||||||
if (!defined('TYPO3_MODE')) {
|
$boot = function () {
|
||||||
die('Access denied.');
|
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['ep_products_cache'])) {
|
||||||
|
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['ep_products_cache'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['ep_products'] =
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['ep_products'] =
|
||||||
\EP\EpProducts\Hook\Tcemain::class;
|
\EP\EpProducts\Hooks\Tcemain::class;
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\Task\ImportDatesTask::class] = [
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\Task\ImportDatesTask::class] = [
|
||||||
'extension' => 'ep_products',
|
'extension' => 'ep_products',
|
||||||
@@ -43,9 +45,6 @@ $iconRegistry->registerIcon(
|
|||||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
'EP.ep_products',
|
'EP.ep_products',
|
||||||
'searchbar',
|
'searchbar',
|
||||||
[
|
|
||||||
'Searchbar' => 'index',
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'Searchbar' => 'index',
|
'Searchbar' => 'index',
|
||||||
]
|
]
|
||||||
@@ -172,9 +171,6 @@ $iconRegistry->registerIcon(
|
|||||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
'EP.ep_products',
|
'EP.ep_products',
|
||||||
'hotel_groups_price',
|
'hotel_groups_price',
|
||||||
[
|
|
||||||
'GroupsPrice' => 'index',
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'GroupsPrice' => 'index',
|
'GroupsPrice' => 'index',
|
||||||
]
|
]
|
||||||
@@ -231,9 +227,6 @@ $iconRegistry->registerIcon(
|
|||||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||||
'EP.ep_products',
|
'EP.ep_products',
|
||||||
'newsletter',
|
'newsletter',
|
||||||
[
|
|
||||||
'Newsletter' => 'index',
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'Newsletter' => 'index',
|
'Newsletter' => 'index',
|
||||||
]
|
]
|
||||||
@@ -319,7 +312,7 @@ $iconRegistry->registerIcon(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['ep_products'] =
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['ep_products'] =
|
||||||
\EP\EpProducts\Hook\PageLayoutView::class;
|
\EP\EpProducts\Hooks\PageLayoutView::class;
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'gclid';
|
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'gclid';
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'ref';
|
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'ref';
|
||||||
@@ -341,3 +334,7 @@ $GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpProducts']['Controller']['writerConf
|
|||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['teamSlug'] =
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['teamSlug'] =
|
||||||
\EP\EpProducts\Updates\TeamSlugUpdater::class;
|
\EP\EpProducts\Updates\TeamSlugUpdater::class;
|
||||||
|
};
|
||||||
|
|
||||||
|
$boot();
|
||||||
|
unset($boot);
|
||||||
|
|||||||
+4
-5
@@ -1,17 +1,16 @@
|
|||||||
<html data-namespace-typo3-fluid="true" lang="en"
|
<html data-namespace-typo3-fluid="true" lang="en"
|
||||||
xmlns="http://www.w3.org/1999/xhtml"
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
|
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
|
||||||
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
|
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
|
||||||
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
|
|
||||||
|
|
||||||
<f:layout name="Bare"/>
|
<f:layout name="Bare"/>
|
||||||
|
|
||||||
<f:section name="Main">
|
<f:section name="Main">
|
||||||
<f:link.typolink class="teaserbox teaserbox--country" parameter="{country.detailPage}" title="{country.name}">
|
<f:link.typolink class="teaserbox teaserbox--country" parameter="{country.detailPage}" title="{country.name}">
|
||||||
<div class="teaserbox__image">
|
<div class="teaserbox__image">
|
||||||
<img class="teaserbox__flag"
|
<svg class="teaserbox__flag">
|
||||||
src="{f:uri.image(src: '{ep:flagiconSource(country: country)}')}"
|
<use href="#icon-flag-{country.code -> f:format.case(mode: 'lower')}"/>
|
||||||
alt="{country.name}"/>
|
</svg>
|
||||||
<f:render partial="TeaserImage" arguments="{image: country.teaserImages.0}"/>
|
<f:render partial="TeaserImage" arguments="{image: country.teaserImages.0}"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="teaserbox__main">
|
<div class="teaserbox__main">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
defined('TYPO3_MODE') or die();
|
defined('TYPO3_MODE') or die();
|
||||||
|
|
||||||
|
$boot = function () {
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::NOTICE] = [];
|
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::NOTICE] = [];
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpTheme']['Service']['BookingApiService']['writerConfiguration'] = [
|
$GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpTheme']['Service']['BookingApiService']['writerConfiguration'] = [
|
||||||
@@ -13,7 +13,7 @@ $GLOBALS['TYPO3_CONF_VARS']['LOG']['EP']['EpTheme']['Service']['BookingApiServic
|
|||||||
];
|
];
|
||||||
|
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['ep_theme'] =
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['ep_theme'] =
|
||||||
\EP\EpTheme\Hook\Tcemain::class;
|
\EP\EpTheme\Hooks\Tcemain::class;
|
||||||
|
|
||||||
$layout = 'cms/layout/class.tx_cms_layout.php';
|
$layout = 'cms/layout/class.tx_cms_layout.php';
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$layout]['tt_content_drawItem']['teaser_country'] =
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$layout]['tt_content_drawItem']['teaser_country'] =
|
||||||
@@ -53,4 +53,8 @@ $metaTagManagerRegistry->registerManager(
|
|||||||
'ep_opengraph',
|
'ep_opengraph',
|
||||||
\EP\EpTheme\MetaTag\OpenGraphMetaTagManager::class
|
\EP\EpTheme\MetaTag\OpenGraphMetaTagManager::class
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
$boot();
|
||||||
|
unset($boot);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user