Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-page-cache
Model
Controller
Result
BuiltinPlugin.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\PageCache\Model\Controller\Result
;
7
8
use
Magento\PageCache\Model\Config
;
9
use
Magento\Framework\App\PageCache\Kernel
;
10
use
Magento\Framework\App\State
as
AppState
;
11
use
Magento\Framework\Registry
;
12
use
Magento\Framework\Controller\ResultInterface
;
13
use
Magento\Framework\App\Response\Http
as
ResponseHttp
;
14
use Zend\Http\Header\HeaderInterface as HttpHeaderInterface;
15
use
Magento\PageCache\Model\Cache\Type
as CacheType;
16
22
class
BuiltinPlugin
23
{
27
private
$config;
28
32
private
$kernel;
33
37
private
$state;
38
42
private
$registry;
43
50
public
function
__construct
(
Config
$config,
Kernel
$kernel,
AppState
$state,
Registry
$registry)
51
{
52
$this->config =
$config
;
53
$this->kernel =
$kernel
;
54
$this->state = $state;
55
$this->registry =
$registry
;
56
}
57
68
public
function
afterRenderResult
(
ResultInterface
$subject,
ResultInterface
$result
,
ResponseHttp
$response
)
69
{
70
$usePlugin = $this->registry->registry(
'use_page_cache_plugin'
);
71
72
if
(!$usePlugin || !$this->config->isEnabled() || $this->config->getType() !=
Config::BUILT_IN
) {
73
return
$result
;
74
}
75
76
if
($this->state->getMode() == AppState::MODE_DEVELOPER) {
77
$cacheControlHeader =
$response
->getHeader(
'Cache-Control'
);
78
79
if
($cacheControlHeader instanceof HttpHeaderInterface) {
80
$response
->setHeader(
'X-Magento-Cache-Control'
, $cacheControlHeader->getFieldValue());
81
}
82
83
$response
->setHeader(
'X-Magento-Cache-Debug'
,
'MISS'
,
true
);
84
}
85
86
$tagsHeader =
$response
->getHeader(
'X-Magento-Tags'
);
87
$tags = [];
88
89
if
($tagsHeader) {
90
$tags = explode(
','
, $tagsHeader->getFieldValue());
91
$response
->clearHeader(
'X-Magento-Tags'
);
92
}
93
94
$tags = array_unique(array_merge($tags, [CacheType::CACHE_TAG]));
95
$response
->setHeader(
'X-Magento-Tags'
, implode(
','
, $tags));
96
$this->kernel->process(
$response
);
97
98
return
$result
;
99
}
100
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Framework\App\Response\Http
Definition:
FileFactory.php:7
$response
$response
Definition:
404.php:11
Magento\PageCache\Model\Controller\Result\BuiltinPlugin
Definition:
BuiltinPlugin.php:22
Magento\PageCache\Model\Controller\Result
Definition:
BuiltinPlugin.php:6
$config
$config
Definition:
fraud_order.php:17
Magento\Framework\Controller\ResultInterface
Definition:
ResultInterface.php:19
Magento\PageCache\Model\Controller\Result\BuiltinPlugin\__construct
__construct(Config $config, Kernel $kernel, AppState $state, Registry $registry)
Definition:
BuiltinPlugin.php:50
$registry
$registry
Definition:
bundle_product_with_not_visible_children_rollback.php:16
Magento\Framework\App\PageCache\Kernel
Definition:
Kernel.php:11
$kernel
$kernel
Definition:
_bootstrap.php:17
Magento\PageCache\Model\Config
Definition:
Config.php:21
Magento\PageCache\Model\Controller\Result\BuiltinPlugin\afterRenderResult
afterRenderResult(ResultInterface $subject, ResultInterface $result, ResponseHttp $response)
Definition:
BuiltinPlugin.php:68
Magento\Framework\App\State
Definition:
CleanupFiles.php:7
Magento\PageCache\Model\Config\BUILT_IN
const BUILT_IN
Definition:
Config.php:26
Magento\Framework\Registry
Definition:
Registry.php:18
Magento\PageCache\Model\Cache\Type
Definition:
Type.php:13