diff --git a/Block/Adminhtml/Report/Edit.php b/Block/Adminhtml/Report/Edit.php
index 6cf8fd3..6b40769 100644
--- a/Block/Adminhtml/Report/Edit.php
+++ b/Block/Adminhtml/Report/Edit.php
@@ -1,6 +1,6 @@
_objectId = 'general_id';
@@ -28,7 +28,7 @@ protected function _construct()
parent::_construct();
}
-
+
/**
* Retrieve text for header element
*
diff --git a/Block/Adminhtml/Report/Edit/Form.php b/Block/Adminhtml/Report/Edit/Form.php
index fe5f60b..c96d8e7 100644
--- a/Block/Adminhtml/Report/Edit/Form.php
+++ b/Block/Adminhtml/Report/Edit/Form.php
@@ -1,12 +1,12 @@
setUseContainer(true);
$this->setForm($form);
-
+
return parent::_prepareForm();
}
}
diff --git a/Block/Adminhtml/Report/Edit/Tab/Credentials.php b/Block/Adminhtml/Report/Edit/Tab/Credentials.php
index 714a580..0e85c76 100644
--- a/Block/Adminhtml/Report/Edit/Tab/Credentials.php
+++ b/Block/Adminhtml/Report/Edit/Tab/Credentials.php
@@ -1,6 +1,6 @@
_scopeConfig->isSetFlag('system/full_page_cache/sectionio/include_cms_in_product_purge');
+ }
+ }
diff --git a/Model/PurgeCache.php b/Model/PurgeCache.php
index 1f2dd8f..58c9154 100644
--- a/Model/PurgeCache.php
+++ b/Model/PurgeCache.php
@@ -14,6 +14,13 @@ class PurgeCache
*/
private $logger;
+ /**
+ * Application config object
+ *
+ * @var \Magento\Framework\App\Config\ScopeConfigInterface
+ */
+ private $config;
+
/** @var \Sectionio\Metrics\Helper\State $helper */
protected $state;
@@ -27,15 +34,18 @@ class PurgeCache
* Constructor
*
* @param InvalidateLogger $logger
+ * @param \Sectionio\Metrics\Model\Config $config
* @param \Sectionio\Metrics\Helper\State $state
* @param \Sectionio\Metrics\Helper\Aperture $aperture
*/
public function __construct(
InvalidateLogger $logger,
+ \Sectionio\Metrics\Model\Config $config,
\Sectionio\Metrics\Helper\State $state,
\Sectionio\Metrics\Helper\Aperture $aperture
) {
$this->logger = $logger;
+ $this->config = $config;
$this->state = $state;
$this->aperture = $aperture;
}
@@ -54,13 +64,20 @@ public function sendPurgeRequest($tagsPattern)
$environment_name = $this->state->getEnvironmentName();
$proxy_name = $this->state->getProxyName();
+ $banExpression = urlencode('obj.http.X-Magento-Tags ~ ' . $tagsPattern);
+
+ // If this ban contains product tags & includeCmsInProductPurge is false, exclude any object that also has a CMS Page tag
+ if (!$this->config->includeCmsInProductPurge() && strpos($tagsPattern, \Magento\Catalog\Model\Product::CACHE_TAG) !== false) {
+ $banExpression .= urlencode(' && obj.http.X-Magento-Tags !~ (^|,)'.\Magento\Cms\Model\Page::CACHE_TAG.'_[0-9]+');
+ }
+
$uri = $this->aperture->generateUrl([
'api' => true,
'accountId' => $account_id,
'applicationId' => $application_id,
'environmentName' => $environment_name,
'proxyName' => $proxy_name,
- 'uriStem' => '/state?async=true&banExpression=' . urlencode('obj.http.X-Magento-Tags ~ ' . $tagsPattern)
+ 'uriStem' => '/state?async=true&banExpression=' . $banExpression
]);
$info = $this->aperture->executeAuthRequest($uri, 'POST', [], self::BAN_TIMEOUT_SECONDS);
@@ -68,7 +85,7 @@ public function sendPurgeRequest($tagsPattern)
$this->logger->execute('Error executing purge: ' . $tagsPattern.', Error: ' . $info['body_content']);
return false;
}
- $this->logger->execute(compact('server', 'tagsPattern'));
return true;
}
}
+
diff --git a/Model/ResourceModel/Account.php b/Model/ResourceModel/Account.php
index 780e446..a5fb9aa 100644
--- a/Model/ResourceModel/Account.php
+++ b/Model/ResourceModel/Account.php
@@ -1,6 +1,6 @@
transactionManager = $context->getTransactionManager();
$this->_resources = $context->getResources();
$this->objectRelationProcessor = $context->getObjectRelationProcessor();
diff --git a/Model/ResourceModel/Account/Collection.php b/Model/ResourceModel/Account/Collection.php
index 94c7507..e9b2965 100644
--- a/Model/ResourceModel/Account/Collection.php
+++ b/Model/ResourceModel/Account/Collection.php
@@ -1,6 +1,6 @@
transactionManager = $context->getTransactionManager();
$this->_resources = $context->getResources();
$this->objectRelationProcessor = $context->getObjectRelationProcessor();
diff --git a/Model/ResourceModel/Application/Collection.php b/Model/ResourceModel/Application/Collection.php
index ab7488c..fef56f9 100644
--- a/Model/ResourceModel/Application/Collection.php
+++ b/Model/ResourceModel/Application/Collection.php
@@ -1,6 +1,6 @@
config = $config;
@@ -43,7 +43,7 @@ public function __construct(
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
- if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled()) {
+ if ($this->config->getType() == \Sectionio\Metrics\Model\Config::VARNISH && $this->config->isEnabled()) {
$object = $observer->getEvent()->getObject();
if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) {
$tags = [];
diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php
index d6cc694..398de6d 100644
--- a/Setup/InstallSchema.php
+++ b/Setup/InstallSchema.php
@@ -1,6 +1,6 @@
-