Skip to content

Commit d07e2a8

Browse files
committed
ACP2E-2025: Refix ACP2E-1445 for multiple store views in the frontend.
- Refactor the code.
1 parent 367f4f1 commit d07e2a8

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

lib/internal/Magento/Framework/App/PageCache/IdentifierForSave.php renamed to app/code/Magento/PageCache/Model/App/Request/Http/IdentifierForSave.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Framework\App\PageCache;
6+
namespace Magento\PageCache\Model\App\Request\Http;
77

88
use Magento\Framework\App\Http\Context;
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\App\Request\Http;
1111
use Magento\Framework\Serialize\Serializer\Json;
12+
use Magento\Framework\App\PageCache\IdentifierInterface;
1213

1314
/**
1415
* Page unique identifier
@@ -50,7 +51,7 @@ public function __construct(
5051
*
5152
* @return string
5253
*/
53-
public function getValue(): string
54+
public function getValue()
5455
{
5556
$data = [
5657
$this->request->isSecure(),

app/code/Magento/PageCache/etc/frontend/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@
2626
<type name="Magento\Framework\App\Response\Http">
2727
<plugin name="response-http-page-cache" type="Magento\PageCache\Model\App\Response\HttpPlugin"/>
2828
</type>
29+
<type name="Magento\Framework\App\PageCache\Kernel">
30+
<arguments>
31+
<argument name="identifierForSave" xsi:type="object">Magento\PageCache\Model\App\Request\Http\IdentifierForSave</argument>
32+
</arguments>
33+
</type>
34+
<preference for="Magento\Framework\App\PageCache\IdentifierInterface" type="Magento\Framework\App\PageCache\Identifier"/>
2935
</config>

lib/internal/Magento/Framework/App/PageCache/Identifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
*
4949
* @return string
5050
*/
51-
public function getValue(): string
51+
public function getValue()
5252
{
5353
$data = [
5454
$this->request->isSecure(),

lib/internal/Magento/Framework/App/PageCache/IdentifierInterface.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
namespace Magento\Framework\App\PageCache;
99

1010
/**
11-
* @api
12-
* @since 100.0.2
11+
* Page unique identifier interface
1312
*/
1413
interface IdentifierInterface
1514
{
@@ -18,5 +17,5 @@ interface IdentifierInterface
1817
*
1918
* @return string
2019
*/
21-
public function getValue(): string;
20+
public function getValue();
2221
}

lib/internal/Magento/Framework/App/PageCache/Kernel.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Kernel
2424
protected $cache;
2525

2626
/**
27-
* @var Identifier
27+
* @var \Magento\Framework\App\PageCache\IdentifierInterface
2828
*/
2929
protected $identifier;
3030

@@ -64,33 +64,33 @@ class Kernel
6464
private $state;
6565

6666
/**
67-
* @var \Magento\Framework\App\PageCache\IdentifierForSave
67+
* @var \Magento\Framework\App\PageCache\IdentifierInterface
6868
*/
6969
private $identifierForSave;
7070

7171
/**
7272
* @param Cache $cache
73-
* @param Identifier $identifier
73+
* @param \Magento\Framework\App\PageCache\IdentifierInterface $identifier
7474
* @param \Magento\Framework\App\Request\Http $request
7575
* @param \Magento\Framework\App\Http\Context|null $context
7676
* @param \Magento\Framework\App\Http\ContextFactory|null $contextFactory
7777
* @param \Magento\Framework\App\Response\HttpFactory|null $httpFactory
7878
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
7979
* @param AppState|null $state
8080
* @param \Magento\PageCache\Model\Cache\Type|null $fullPageCache
81-
* @param \Magento\Framework\App\PageCache\IdentifierForSave $identifierForSave
81+
* @param \Magento\Framework\App\PageCache\IdentifierInterface $identifierForSave
8282
*/
8383
public function __construct(
8484
\Magento\Framework\App\PageCache\Cache $cache,
85-
\Magento\Framework\App\PageCache\Identifier $identifier,
85+
\Magento\Framework\App\PageCache\IdentifierInterface $identifier,
8686
\Magento\Framework\App\Request\Http $request,
8787
\Magento\Framework\App\Http\Context $context = null,
8888
\Magento\Framework\App\Http\ContextFactory $contextFactory = null,
8989
\Magento\Framework\App\Response\HttpFactory $httpFactory = null,
9090
\Magento\Framework\Serialize\SerializerInterface $serializer = null,
9191
AppState $state = null,
9292
\Magento\PageCache\Model\Cache\Type $fullPageCache = null,
93-
\Magento\Framework\App\PageCache\IdentifierForSave $identifierForSave = null,
93+
\Magento\Framework\App\PageCache\IdentifierInterface $identifierForSave = null,
9494
) {
9595
$this->cache = $cache;
9696
$this->identifier = $identifier;
@@ -110,7 +110,7 @@ public function __construct(
110110
\Magento\PageCache\Model\Cache\Type::class
111111
);
112112
$this->identifierForSave = $identifierForSave ?? ObjectManager::getInstance()->get(
113-
\Magento\Framework\App\PageCache\IdentifierForSave::class
113+
\Magento\Framework\App\PageCache\IdentifierInterface::class
114114
);
115115
}
116116

0 commit comments

Comments
 (0)