Skip to content

Commit 96f9f28

Browse files
committed
Merge pull request #5211 in SW/shopware from ntr/5.3/merge-52-into-53-201707 to 5.3
* commit '53042e1c83d2dc0310361a108121b19931c112e3': (34 commits) SW-18907 - Don't restrict shopping world image height in row mode SW-19195 - Update upgrade md SW-19195 - Make individual voucher codes searchable Fixes shopware/shopware#1133 SW-19144 - Fixed issue with PHP notice when no id for an option is defined Fixes: shopware/shopware#1162 SW-18142 - Fixed replaced name for JPG files in media model Fixes: shopware/shopware#1040 SW-19191 - Add smarty block around the table in confirm.tpl fixes shopware/shopware#1154 SW-19141 - Added new block to confirm_item.tpl SW-19141 - confirm_item.tpl now reuses cart_item.tpl details Revert "SW-19169 - Renamed Shopware.model.AttributeConfig to Shopware.apps.Base.model.AttributeConfig" SW-17566 - Add colon after shipping type on document * Unify payment and shipping style on document Fixes: shopware/shopware#860 SW-18242 - add parameters to exceptions in media resource SW-18242 - Remove media file only if it was uploaded fixes shopware/shopware#1047 SW-19150 - Only show link if inquiry link was generated SW-19150 - Fix inquiry form link on detail page fixes shopware/shopware#1170 SW-18241 - clean up code SW-18241 - Remove echo from readfile operation on opening PDFs from the backend fixes shopware/shopware#1048 SW-18937 - Added support for ftps in rest-api SW-19169 - Renamed Shopware.model.AttributeConfig to Shopware.apps.Base.model.AttributeConfig SW-19173 - Add new event Shopware_Plugins_HttpCache_ContextCookieValue in context cookie creation fixes shopware/shopware#1146 SW-19143 - Fixed pop state without state values Fixes: shopware/shopware#1161 ...
2 parents b3464cc + 53042e1 commit 96f9f28

File tree

31 files changed

+388
-263
lines changed

31 files changed

+388
-263
lines changed

UPGRADE-5.2.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22

33
This changelog references changes done in Shopware 5.2 patch versions.
44

5+
# 5.2.27
6+
7+
[View all changes from v5.2.26...v5.2.27](https://github.com/shopware/shopware/compare/v5.2.26...v5.2.27)
8+
9+
* Added config check to disable the `Tell a friend` page if it is disabled via config.
10+
* Fixed id collision in `themes/Backend/ExtJs/backend/base/component/Shopware.ModuleManager.js`
11+
* Added guetzli media optimizer
12+
* Added new event `Shopware_Plugins_HttpCache_ContextCookieValue` to modify HttpCache Context-Cookie.
13+
* Added support for uploading media with ftps in Rest-API
14+
* Added `{$smarty.block.parent}` to `themes/Frontend/Bare/frontend/checkout/confirm_item.tpl`.
15+
* Added new block `frontend_checkout_cart_item_details_essential_features` to `themes/Frontend/Bare/frontend/checkout/confirm_item.tpl`.
16+
* Added new block `frontend_checkout_confirm_product_table_content` around table in `themes/Frontend/Bare/frontend/checkout/confirm.tpl`.
17+
* Individual voucher codes are now searchable in voucher overview
18+
19+
# 5.2.26
20+
21+
[View all changes from v5.2.25...v5.2.26](https://github.com/shopware/shopware/compare/v5.2.25...v5.2.26)
22+
523
## 5.2.25
624

725
[View all changes from v5.2.24...v5.2.25](https://github.com/shopware/shopware/compare/v5.2.24...v5.2.25)
826

9-
1027
* Added notify event `Shopware_Modules_Basket_AddArticle_Added` in `engine/Shopware/Core/sBasket.php`
1128
* The event `Shopware_Modules_Export_ExportResult_Filter_Fixed` was added and now filters the processed export result. Previously with `Shopware_Modules_Export_ExportResult_Filter`, an instance of `Zend_Db_Statement_Pdo` was supplied, which could not be used to filter the actual result.
29+
* Removed duplicate block and added more precise ones in `themes/Frontend/Bare/frontend/checkout/ajax_cart.tpl`
1230

1331
# 5.2.24
1432

@@ -21,7 +39,6 @@ This changelog references changes done in Shopware 5.2 patch versions.
2139

2240
[View all changes from v5.2.22...v5.2.23](https://github.com/shopware/shopware/compare/v5.2.22...v5.2.23)
2341

24-
2542
* Added conditional statement in `themes/Frontend/Responsive/frontend/_public/src/js/jquery.product-slider.js` to prevent the jquery plugin from sending ajax requests indefinitely
2643
* Added `limit` parameter to `createQuery` and `createOptionQuery` in `engine/Shopware/Bundle/ESIndexingBundle/Property/PropertyQueryFactory`
2744
* Added default `limit` of 100 in `engine/Shopware/Bundle/ESIndexingBundle/Property/PropertyIndexer::populate`
@@ -31,7 +48,6 @@ This changelog references changes done in Shopware 5.2 patch versions.
3148

3249
[View all changes from v5.2.21...v5.2.22](https://github.com/shopware/shopware/compare/v5.2.21...v5.2.22)
3350

34-
3551
* Fixed the picture implementation of the `box-emotion.tpl` to load the correct image sizes
3652
* Added new event `plugin/swAutoSubmit/onChangeSelection` in `themes/Frontend/Responsive/frontend/_public/src/js/jquery.auto-submit.js`
3753
* Added ExtJS override `engine/Library/ExtJs/overrides/Ext.view.Table.js` to fix display of row selection in grid panel when updating the row after row editing
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Shopware 5
4+
* Copyright (c) shopware AG
5+
*
6+
* According to our dual licensing model, this program can be used either
7+
* under the terms of the GNU Affero General Public License, version 3,
8+
* or under a proprietary license.
9+
*
10+
* The texts of the GNU Affero General Public License with an additional
11+
* permission and of our proprietary license can be found at and
12+
* in the LICENSE file you have received along with this program.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Affero General Public License for more details.
18+
*
19+
* "Shopware" is a registered trademark of shopware AG.
20+
* The licensing of the program under the AGPLv3 does not imply a
21+
* trademark license. Therefore any rights, title and interest in
22+
* our trademarks remain entirely with us.
23+
*/
24+
25+
namespace Shopware\Bundle\MediaBundle\Optimizer;
26+
27+
class GuetzliOptimizer extends BinaryOptimizer
28+
{
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
public function getCommand()
33+
{
34+
return 'guetzli';
35+
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function getSupportedMimeTypes()
41+
{
42+
return ['image/jpeg', 'image/jpg'];
43+
}
44+
45+
/**
46+
* {@inheritdoc}
47+
*/
48+
public function getCommandArguments($filepath)
49+
{
50+
return [$filepath];
51+
}
52+
}

engine/Shopware/Bundle/MediaBundle/services.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
<tag name="shopware_media.optimizer" priority="80" />
8484
</service>
8585

86+
<service id="shopware_media.optimizer.guetzli" class="Shopware\Bundle\MediaBundle\Optimizer\GuetzliOptimizer">
87+
<tag name="shopware_media.optimizer" priority="50" />
88+
</service>
89+
8690
<!-- Media Adapters -->
8791
<service id="shopware_media.adapter.local" class="Shopware\Bundle\MediaBundle\Adapters\LocalAdapterFactory">
8892
<tag name="shopware_media.adapter" />

engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/MediaHydrator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
namespace Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\Hydrator;
2626

2727
use Doctrine\DBAL\Connection;
28-
use Shopware\Bundle\MediaBundle\MediaService;
28+
use Shopware\Bundle\MediaBundle\MediaServiceInterface;
2929
use Shopware\Bundle\StoreFrontBundle\Struct;
3030
use Shopware\Components\Thumbnail\Manager;
3131

@@ -47,7 +47,7 @@ class MediaHydrator extends Hydrator
4747
private $thumbnailManager;
4848

4949
/**
50-
* @var MediaService
50+
* @var MediaServiceInterface
5151
*/
5252
private $mediaService;
5353

@@ -59,10 +59,10 @@ class MediaHydrator extends Hydrator
5959
/**
6060
* @param AttributeHydrator $attributeHydrator
6161
* @param \Shopware\Components\Thumbnail\Manager $thumbnailManager
62-
* @param MediaService $mediaService
62+
* @param MediaServiceInterface $mediaService
6363
* @param Connection $database
6464
*/
65-
public function __construct(AttributeHydrator $attributeHydrator, Manager $thumbnailManager, MediaService $mediaService, Connection $database)
65+
public function __construct(AttributeHydrator $attributeHydrator, Manager $thumbnailManager, MediaServiceInterface $mediaService, Connection $database)
6666
{
6767
$this->attributeHydrator = $attributeHydrator;
6868
$this->thumbnailManager = $thumbnailManager;

engine/Shopware/Components/Api/Resource/Article.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ protected function createImageMappings(Image $image, ArticleModel $article, arra
18431843
foreach ($mappingData as $option) {
18441844
$conditions = [];
18451845

1846-
if ($option['id']) {
1846+
if (isset($option['id']) && $option['id']) {
18471847
$conditions['id'] = $option['id'];
18481848
}
18491849

engine/Shopware/Components/Api/Resource/Media.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class Media extends Resource
4343
const FILENAME_LENGTH = 200;
4444

4545
/**
46-
* @return \Shopware\Models\Category\Repository
46+
* @return \Shopware\Models\Media\Repository
4747
*/
4848
public function getRepository()
4949
{
50-
return $this->getManager()->getRepository('Shopware\Models\Media\Media');
50+
return $this->getManager()->getRepository(MediaModel::class);
5151
}
5252

5353
/**
@@ -56,7 +56,7 @@ public function getRepository()
5656
* @throws \Shopware\Components\Api\Exception\ParameterMissingException
5757
* @throws \Shopware\Components\Api\Exception\NotFoundException
5858
*
59-
* @return array|\Shopware\Models\Media\Media
59+
* @return array|MediaModel
6060
*/
6161
public function getOne($id)
6262
{
@@ -69,7 +69,7 @@ public function getOne($id)
6969
$filters = [['property' => 'media.id', 'expression' => '=', 'value' => $id]];
7070
$query = $this->getRepository()->getMediaListQuery($filters, [], 1);
7171

72-
/** @var $media \Shopware\Models\Media\Media */
72+
/** @var $media MediaModel */
7373
$media = $query->getOneOrNullResult($this->getResultMode());
7474

7575
if (!$media) {
@@ -119,15 +119,15 @@ public function getList($offset = 0, $limit = 25, array $criteria = [], array $o
119119
* @throws \Shopware\Components\Api\Exception\ValidationException
120120
* @throws \Exception
121121
*
122-
* @return \Shopware\Models\Media\Media
122+
* @return MediaModel
123123
*/
124124
public function create(array $params)
125125
{
126126
$this->checkPrivilege('create');
127127

128128
$params = $this->prepareMediaData($params);
129129

130-
$media = new \Shopware\Models\Media\Media();
130+
$media = new MediaModel();
131131
$media->fromArray($params);
132132

133133
$path = $this->prepareFilePath($media->getPath(), $media->getFileName());
@@ -160,17 +160,17 @@ public function create(array $params)
160160
* @throws \Shopware\Components\Api\Exception\ParameterMissingException
161161
* @throws \Shopware\Components\Api\Exception\CustomValidationException
162162
*
163-
* @return \Shopware\Models\Media\Media
163+
* @return MediaModel
164164
*/
165165
public function update($id, array $params)
166166
{
167167
$this->checkPrivilege('update');
168168

169169
if (empty($id)) {
170-
throw new ApiException\ParameterMissingException();
170+
throw new ApiException\ParameterMissingException('id');
171171
}
172172

173-
/** @var $media \Shopware\Models\Media\Media */
173+
/** @var $media MediaModel */
174174
$media = $this->getRepository()->find($id);
175175

176176
if (!$media) {
@@ -199,17 +199,17 @@ public function update($id, array $params)
199199
* @throws \Shopware\Components\Api\Exception\ParameterMissingException
200200
* @throws \Shopware\Components\Api\Exception\NotFoundException
201201
*
202-
* @return \Shopware\Models\Media\Media
202+
* @return MediaModel
203203
*/
204204
public function delete($id)
205205
{
206206
$this->checkPrivilege('delete');
207207

208208
if (empty($id)) {
209-
throw new ApiException\ParameterMissingException();
209+
throw new ApiException\ParameterMissingException('id');
210210
}
211211

212-
/** @var $media \Shopware\Models\Media\Media */
212+
/** @var $media MediaModel */
213213
$media = $this->getRepository()->find($id);
214214

215215
if (!$media) {
@@ -252,7 +252,7 @@ public function internalCreateMediaByFileLink($link, $albumId = -1)
252252
$media->setUserId(0);
253253

254254
/** @var $album Album */
255-
$album = $this->getManager()->find('Shopware\Models\Media\Album', $albumId);
255+
$album = $this->getManager()->find(Album::class, $albumId);
256256
if (!$album) {
257257
throw new ApiException\CustomValidationException(
258258
sprintf('Album by id %s not found', $albumId)
@@ -320,6 +320,7 @@ public function load($url, $baseFilename = null)
320320
$urlArray['path'] = explode('/', $urlArray['path']);
321321
switch ($urlArray['scheme']) {
322322
case 'ftp':
323+
case 'ftps':
323324
case 'http':
324325
case 'https':
325326
case 'file':
@@ -425,8 +426,8 @@ protected function uploadBase64File($url, $destinationPath, $baseFilename)
425426
}
426427

427428
/**
428-
* @param array $params
429-
* @param \Shopware\Models\Media\Media $media
429+
* @param array $params
430+
* @param MediaModel $media
430431
*
431432
* @throws \Shopware\Components\Api\Exception\CustomValidationException
432433
* @throws \Shopware\Components\Api\Exception\ParameterMissingException
@@ -438,15 +439,15 @@ private function prepareMediaData($params, $media = null)
438439
{
439440
// in create mode, album is a required param
440441
if (!$media && (!isset($params['album']) || empty($params['album']))) {
441-
throw new ApiException\ParameterMissingException();
442+
throw new ApiException\ParameterMissingException('album');
442443
}
443444

444445
if (!$media && (!isset($params['file']) || empty($params['file']))) {
445-
throw new ApiException\ParameterMissingException();
446+
throw new ApiException\ParameterMissingException('file');
446447
}
447448

448449
if (!$media && (!isset($params['description']) || empty($params['description']))) {
449-
throw new ApiException\ParameterMissingException();
450+
throw new ApiException\ParameterMissingException('description');
450451
}
451452

452453
if (!$media && (!isset($params['userId']) || empty($params['userId']))) {
@@ -459,14 +460,14 @@ private function prepareMediaData($params, $media = null)
459460

460461
// Check / set album
461462
if (isset($params['album'])) {
462-
$album = Shopware()->Models()->find('\Shopware\Models\Media\Album', $params['album']);
463+
$album = Shopware()->Models()->find(Album::class, $params['album']);
463464
if (!$album) {
464465
throw new ApiException\CustomValidationException(sprintf('Album by id %s not found', $params['album']));
465466
}
466467
$params['album'] = $album;
467468
}
468469

469-
if (isset($params['file']) && !($params['file'] instanceof \Symfony\Component\HttpFoundation\File\File)) {
470+
if (isset($params['file']) && !($params['file'] instanceof File)) {
470471
if (!isset($params['name'])) {
471472
$params['name'] = pathinfo($params['file'], PATHINFO_FILENAME);
472473
}
@@ -481,7 +482,7 @@ private function prepareMediaData($params, $media = null)
481482
} else {
482483
$path = $params['file'];
483484
}
484-
$params['file'] = new \Symfony\Component\HttpFoundation\File\File($path);
485+
$params['file'] = new File($path);
485486
}
486487

487488
return $params;

engine/Shopware/Components/Plugin/XmlCronjobReader.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ private function parseEntry(\DOMElement $entry)
7979

8080
$cronjobEntry['name'] = $this->getFirstChild($entry, 'name');
8181
$cronjobEntry['action'] = $this->getFirstChild($entry, 'action');
82-
$cronjobEntry['active'] = $this->toBool($this->getFirstChild($entry, 'active'));
82+
$cronjobEntry['active'] = XmlUtils::phpize($this->getFirstChild($entry, 'active'));
8383
$cronjobEntry['interval'] = $this->getFirstChild($entry, 'interval');
84-
$cronjobEntry['disable_on_error'] = $this->toBool($this->getFirstChild($entry, 'disableOnError'));
84+
$cronjobEntry['disable_on_error'] = XmlUtils::phpize($this->getFirstChild($entry, 'disableOnError'));
8585

8686
return $cronjobEntry;
8787
}
@@ -120,14 +120,4 @@ private function getChildren(\DOMNode $node, $name)
120120

121121
return $children;
122122
}
123-
124-
/**
125-
* @param string $string
126-
*
127-
* @return bool
128-
*/
129-
private function toBool($string)
130-
{
131-
return $string == 'true' ? true : false;
132-
}
133123
}

engine/Shopware/Components/Theme/Compiler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
use Doctrine\Common\Collections\ArrayCollection;
2828
use Doctrine\ORM\AbstractQuery;
29+
use Shopware\Components\Theme\Compressor\CompressorInterface;
2930
use Shopware\Components\Theme\Compressor\Js;
3031
use Shopware\Models\Shop;
3132

@@ -97,7 +98,7 @@ class Compiler
9798
* @param PathResolver $pathResolver
9899
* @param Inheritance $inheritance
99100
* @param Service $service
100-
* @param Js $jsCompressor
101+
* @param CompressorInterface $jsCompressor
101102
* @param \Enlight_Event_EventManager $eventManager
102103
* @param TimestampPersistor $timestampPersistor
103104
*/
@@ -107,7 +108,7 @@ public function __construct(
107108
PathResolver $pathResolver,
108109
Inheritance $inheritance,
109110
Service $service,
110-
Js $jsCompressor,
111+
CompressorInterface $jsCompressor,
111112
\Enlight_Event_EventManager $eventManager,
112113
TimestampPersistor $timestampPersistor
113114
) {

0 commit comments

Comments
 (0)