diff --git a/composer.lock b/composer.lock index 8726d27d..b26af9da 100644 --- a/composer.lock +++ b/composer.lock @@ -1173,9 +1173,9 @@ "authors": [ { "name": "Helmut Hummel", + "role": "Developer", "email": "info@helhum.io", - "homepage": "http://helhum.io", - "role": "Developer" + "homepage": "http://helhum.io" } ], "description": "A reliable and powerful command line interface for TYPO3 CMS", @@ -1294,9 +1294,9 @@ "authors": [ { "name": "Ignace Nyamagana Butera", + "role": "Developer", "email": "nyamsprod@gmail.com", - "homepage": "https://github.com/nyamsprod/", - "role": "Developer" + "homepage": "https://github.com/nyamsprod/" } ], "description": "Csv data manipulation made easy in PHP", @@ -3222,8 +3222,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "The TYPO3 admin panel provides a panel with additional functionality in the frontend (Debugging, Caching, Preview...)", @@ -3287,8 +3287,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Classes for the TYPO3 backend.", @@ -3391,8 +3391,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Backend user administration and overview. Allows you to compare the settings of users and verify their permissions and see who is online.", @@ -3606,8 +3606,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "The core library of TYPO3.", @@ -3722,8 +3722,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "TYPO3 Extension Manager", @@ -3828,8 +3828,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Listing of files in the directory", @@ -3933,8 +3933,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Fluid is a next-generation templating engine which makes the life of extension authors a lot easier!", @@ -4102,8 +4102,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Classes for the frontend of TYPO3.", @@ -4161,8 +4161,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Shows various infos", @@ -4219,8 +4219,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "The Install Tool mounted as the module Tools>Install in TYPO3.", @@ -4276,8 +4276,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Enables the 'Config' and 'DB Check' modules for technical analysis of the system. This includes raw database search, checking relations, counting pages and records etc.", @@ -4335,8 +4335,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "List of database-records", @@ -4387,8 +4387,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "The recycler offers the possibility to restore deleted records or remove them from the database permanently. These actions can be applied to a single record, multiple records, and recursively to child records (ex. restoring a page can restore all content elements on that page). Filtering by page and by table provides a quick overview of deleted records before taking action on them.", @@ -4441,8 +4441,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Custom redirects in TYPO3.", @@ -4556,8 +4556,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Integration of CKEditor as Rich Text Editor.", @@ -4605,8 +4605,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "The TYPO3 Scheduler let's you register tasks to happen at a specific time", @@ -4659,8 +4659,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "SEO features for TYPO3.", @@ -4768,8 +4768,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "JavaScript-driven editor with syntax highlighting and codecompletion. Based on CodeMirror.", @@ -4869,8 +4869,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Framework for management of TypoScript template records for the CMS frontend.", @@ -4921,8 +4921,8 @@ "authors": [ { "name": "TYPO3 Core Team", - "email": "typo3cms@typo3.org", - "role": "Developer" + "role": "Developer", + "email": "typo3cms@typo3.org" } ], "description": "Shows the frontend webpage inside the backend frameset.", @@ -4981,16 +4981,16 @@ }, { "name": "typo3fluid/fluid", - "version": "2.6.1", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/TYPO3/Fluid.git", - "reference": "9ef6a8ffff2e812025fc0701b4ce72eea6911a3d" + "reference": "f85a5a7fff02e43f688e31b34d284efb41caf44f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/Fluid/zipball/9ef6a8ffff2e812025fc0701b4ce72eea6911a3d", - "reference": "9ef6a8ffff2e812025fc0701b4ce72eea6911a3d", + "url": "https://api.github.com/repos/TYPO3/Fluid/zipball/f85a5a7fff02e43f688e31b34d284efb41caf44f", + "reference": "f85a5a7fff02e43f688e31b34d284efb41caf44f", "shasum": "" }, "require": { @@ -4999,7 +4999,7 @@ "require-dev": { "mikey179/vfsstream": "^1.6", "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^4.8", + "phpunit/phpunit": "^8.1", "squizlabs/php_codesniffer": "^2.7" }, "bin": [ @@ -5016,7 +5016,7 @@ "LGPL-3.0-or-later" ], "description": "The TYPO3 Fluid template rendering engine", - "time": "2019-05-07T07:07:18+00:00" + "time": "2019-09-08T13:26:27+00:00" }, { "name": "wazum/pagetree-resizable", diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php b/public/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php index f9da37ae..ca83c0f6 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php @@ -35,6 +35,8 @@ use EP\EpProducts\Service\ResellerDataService; use Symfony\Component\Serializer\Encoder\XmlEncoder; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Serializer; +use TYPO3\CMS\Core\Cache\CacheManager; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException; @@ -61,13 +63,23 @@ class ResellerController extends ActionController */ protected $resellerDataService; + /** + * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface + */ + protected $cache; + /** * @param ResellerDataService $resellerDataService + * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ public function __construct(ResellerDataService $resellerDataService) { parent::__construct(); + $this->resellerDataService = $resellerDataService; + /** @var CacheManager $cacheManager */ + $cacheManager = GeneralUtility::makeInstance(CacheManager::class); + $this->cache = $cacheManager->getCache('ep_products_reseller'); } /** @@ -103,7 +115,11 @@ class ResellerController extends ActionController ); } - $productData = $this->resellerDataService->preprocessSingle($product, $reseller); + $cacheKey = sprintf('reseller_export_cp_%d_%d', $product->getUid(), $reseller->getUid()); + if (($productData = $this->cache->get($cacheKey)) === false) { + $productData = $this->resellerDataService->preprocessSingle($product, $reseller); + $this->cache->set($cacheKey, $productData, [], 3600); + } $this->view->assign('reseller', $reseller); $this->view->assign('productData', $productData); @@ -111,16 +127,25 @@ class ResellerController extends ActionController /** * @param Reseller $reseller - * @return bool + * @return void + * @throws \Doctrine\DBAL\DBALException */ public function xmlAction(Reseller $reseller) { - $data = $this->resellerDataService->preprocessAll($reseller); + $cacheKey = sprintf('reseller_export_xml_full_%d', $reseller->getUid()); - $encoders = [new XmlEncoder('products')]; - $normalizers = [new ObjectNormalizer()]; - - $serializer = new Serializer($normalizers, $encoders); + if (($xml = $this->cache->get($cacheKey)) === false) { + $data = $this->resellerDataService->preprocessAll($reseller); + $encoders = [new XmlEncoder('products')]; + $normalizers = [new ObjectNormalizer()]; + $serializer = new Serializer($normalizers, $encoders); + $xml = $serializer->serialize( + $data, + 'xml', + [ 'xml_encoding' => 'utf-8', 'xml_format_output' => true ] + ); + $this->cache->set($cacheKey, $xml, [], 3600); + } $filename = sprintf('export_%s_%s.xml', $reseller->getCode(), date('Y-m-d')); @@ -131,11 +156,7 @@ class ResellerController extends ActionController header('Expires: 0'); header('Pragma: public'); - echo $serializer->serialize( - $data, - 'xml', - [ 'xml_encoding' => 'utf-8', 'xml_format_output' => true ] - ); + echo $xml; exit(); } @@ -152,11 +173,21 @@ class ResellerController extends ActionController throw new InvalidArgumentValueException(); } - $data = $this->resellerDataService->preprocessAll( - $reseller, - static::$imageDimensions[$type], - $type - ); + $cacheKey = sprintf('reseller_export_csv_full_%d', $reseller->getUid()); + + if (($csv = $this->cache->get($cacheKey)) === false) { + $data = $this->resellerDataService->preprocessAll( + $reseller, + static::$imageDimensions[$type], + $type + ); + if ($type === 'google') { + $csv = GoogleBusinessFeedCsvFormatter::format($data); + } else { + $csv = FacebookCatalogCsvFormatter::format($data); + } + $this->cache->set($cacheKey, $csv, [], 3600); + } $filename = sprintf('export_%s_%s.csv', $reseller->getCode(), date('Y-m-d')); @@ -169,12 +200,6 @@ class ResellerController extends ActionController $fileHandle = fopen('php://output', 'wb'); - if ($type === 'google') { - $csv = GoogleBusinessFeedCsvFormatter::format($data); - } else { - $csv = FacebookCatalogCsvFormatter::format($data); - } - foreach ($csv as $row) { fputcsv($fileHandle, $row); } diff --git a/public/typo3conf/ext/ep_products/ext_localconf.php b/public/typo3conf/ext/ep_products/ext_localconf.php index 8c2fc6e0..305b561e 100644 --- a/public/typo3conf/ext/ep_products/ext_localconf.php +++ b/public/typo3conf/ext/ep_products/ext_localconf.php @@ -1,4 +1,5 @@