Loading src/CacheManager.php +18 −5 Original line number Diff line number Diff line Loading @@ -177,6 +177,19 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa $this->killSwitch = $killSwitch; } /** * Gets the request object. * * @return \Symfony\Component\HttpFoundation\Request * The request object. */ protected function getRequest() { if (!$this->request) { $this->request = \Drupal::request(); } return $this->request; } /** * {@inheritdoc} */ Loading Loading @@ -356,7 +369,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa * ESI enable state. */ public function isEsiRequest() { $request_uri = $this->request->getRequestUri(); $request_uri = $this->getRequest()->getRequestUri(); // Check if we're not on user data route which is already an ESI callback. if (stripos($request_uri, '/adv_varnish/esi/user_blocks') !== FALSE) { Loading Loading @@ -469,8 +482,8 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa // Check if we acn be on disabled domain. $excluded_urls = explode(PHP_EOL, $this->config->get('available.excluded_urls')); $request_uri = $this->request->getRequestUri(); $host = $this->request->getHost(); $request_uri = $this->getRequest()->getRequestUri(); $host = $this->getRequest()->getHost(); foreach ($excluded_urls as $line) { $rule = explode('|', trim($line)); if ((($rule[0] === '*') || ($host === $rule[0])) Loading @@ -489,7 +502,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa } // Disable cache if page_cache_kill_switch is called. if ($this->killSwitch->check(new Response(), $this->request) == 'deny') { if ($this->killSwitch->check(new Response(), $this->getRequest()) == 'deny') { $this->log(RfcLogLevel::DEBUG, 'Cache disabled - page_kill_switch.'); return FALSE; } Loading Loading @@ -536,7 +549,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa public function purgeUserBlocks() { $esi = $this->config->get('available.esi'); $purge_user_blocks = $this->config->get('available.esi_purge_user_blocks'); if ($esi && $purge_user_blocks && $this->request->isMethod('POST') && $this->account->id() > 0) { if ($esi && $purge_user_blocks && $this->getRequest()->isMethod('POST') && $this->account->id() > 0) { $this->invalidateTags(['user:' . $this->account->id()]); } } Loading Loading
src/CacheManager.php +18 −5 Original line number Diff line number Diff line Loading @@ -177,6 +177,19 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa $this->killSwitch = $killSwitch; } /** * Gets the request object. * * @return \Symfony\Component\HttpFoundation\Request * The request object. */ protected function getRequest() { if (!$this->request) { $this->request = \Drupal::request(); } return $this->request; } /** * {@inheritdoc} */ Loading Loading @@ -356,7 +369,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa * ESI enable state. */ public function isEsiRequest() { $request_uri = $this->request->getRequestUri(); $request_uri = $this->getRequest()->getRequestUri(); // Check if we're not on user data route which is already an ESI callback. if (stripos($request_uri, '/adv_varnish/esi/user_blocks') !== FALSE) { Loading Loading @@ -469,8 +482,8 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa // Check if we acn be on disabled domain. $excluded_urls = explode(PHP_EOL, $this->config->get('available.excluded_urls')); $request_uri = $this->request->getRequestUri(); $host = $this->request->getHost(); $request_uri = $this->getRequest()->getRequestUri(); $host = $this->getRequest()->getHost(); foreach ($excluded_urls as $line) { $rule = explode('|', trim($line)); if ((($rule[0] === '*') || ($host === $rule[0])) Loading @@ -489,7 +502,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa } // Disable cache if page_cache_kill_switch is called. if ($this->killSwitch->check(new Response(), $this->request) == 'deny') { if ($this->killSwitch->check(new Response(), $this->getRequest()) == 'deny') { $this->log(RfcLogLevel::DEBUG, 'Cache disabled - page_kill_switch.'); return FALSE; } Loading Loading @@ -536,7 +549,7 @@ class CacheManager implements CacheManagerInterface, CacheTagsInvalidatorInterfa public function purgeUserBlocks() { $esi = $this->config->get('available.esi'); $purge_user_blocks = $this->config->get('available.esi_purge_user_blocks'); if ($esi && $purge_user_blocks && $this->request->isMethod('POST') && $this->account->id() > 0) { if ($esi && $purge_user_blocks && $this->getRequest()->isMethod('POST') && $this->account->id() > 0) { $this->invalidateTags(['user:' . $this->account->id()]); } } Loading