Beispiel #1
0
 /**
  * On post dispatch we try to find affected articleIds displayed during this request
  *
  * @param \Enlight_Controller_ActionEventArgs $args
  */
 public function onPostDispatch(\Enlight_Controller_ActionEventArgs $args)
 {
     $view = $args->getSubject()->View();
     if (!$this->request->isDispatched() || $this->response->isException() || !$view->hasTemplate()) {
         return;
     }
     if (!$this->hasSurrogateEsiCapability($this->request)) {
         return;
     }
     if ($this->request->getModuleName() != 'frontend' && $this->request->getModuleName() != 'widgets') {
         return;
     }
     // Do not cache if shop(template) is not esi-enabled
     if (!Shopware()->Shop()->get('esi')) {
         return;
     }
     // Enable esi tag output
     $this->registerEsiRenderer();
     $this->addSurrogateControl($this->response);
     $this->addContextCookie($this->request, $this->response);
     $this->setNoCacheCookie();
     /**
      * Emits Shopware_Plugins_HttpCache_ShouldNotCache Event
      */
     if (Enlight()->Events()->notifyUntil('Shopware_Plugins_HttpCache_ShouldNotCache', array('subject' => $this, 'action' => $this->action))) {
         return;
     }
     $this->setCacheHeaders();
 }