-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8999 from magento-gl/spartans_pr_12062024
Spartans pr 12062024
- Loading branch information
Showing
16 changed files
with
365 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
app/code/Magento/PageCache/Model/App/Request/Http/IdentifierStoreReader.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\PageCache\Model\App\Request\Http; | ||
|
||
use Magento\Store\Model\StoreManager; | ||
|
||
class IdentifierStoreReader | ||
{ | ||
/** | ||
* @var \Magento\Framework\View\DesignExceptions | ||
*/ | ||
private $designExceptions; | ||
|
||
/** | ||
* @var \Magento\Framework\App\RequestInterface | ||
*/ | ||
private $request; | ||
|
||
/** | ||
* @var \Magento\PageCache\Model\Config | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param \Magento\Framework\View\DesignExceptions $designExceptions | ||
* @param \Magento\Framework\App\RequestInterface $request | ||
* @param \Magento\PageCache\Model\Config $config | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\View\DesignExceptions $designExceptions, | ||
\Magento\Framework\App\RequestInterface $request, | ||
\Magento\PageCache\Model\Config $config | ||
) { | ||
$this->designExceptions = $designExceptions; | ||
$this->request = $request; | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* Adds a theme key to identifier for a built-in cache if user-agent theme rule is actual | ||
* | ||
* @param array $data | ||
* @return array|null | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function getPageTagsWithStoreCacheTags(array $data): ?array | ||
{ | ||
if ($this->config->getType() === \Magento\PageCache\Model\Config::BUILT_IN && $this->config->isEnabled()) { | ||
$ruleDesignException = $this->designExceptions->getThemeByRequest($this->request); | ||
if ($ruleDesignException !== false) { | ||
$data['DESIGN'] = $ruleDesignException; | ||
} | ||
|
||
if ($runType = $this->request->getServerValue(StoreManager::PARAM_RUN_TYPE)) { | ||
$data[StoreManager::PARAM_RUN_TYPE] = $runType; | ||
} | ||
|
||
if ($runCode = $this->request->getServerValue(StoreManager::PARAM_RUN_CODE)) { | ||
$data[StoreManager::PARAM_RUN_CODE] = $runCode; | ||
} | ||
} | ||
|
||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.