/** * Executes a legacy kernel callback * * Does the callback with both post-reinitialize and formtoken checks disabled. * * @param callable $callback * * @return mixed */ protected function runLegacyKernelCallback($callback) { // Initialize legacy kernel if not already done if ($this->legacyKernel instanceof Closure) { $legacyKernelClosure = $this->legacyKernel; $this->legacyKernel = $legacyKernelClosure(); } return $this->legacyKernel->runCallback($callback, false, false); }
/** * @return \Symfony\Component\HttpFoundation\Response */ public function restAction() { $this->restKernel->run(); $result = ezpKernelRest::getResponse(); if ($result === null) { throw new Exception('Rest Kernel run failed'); } return new Response($result->getContent(), $result->hasAttribute('statusCode') ? $result->getAttribute('statusCode') : 200, $result->hasAttribute('headers') ? $result->getAttribute('headers') : array()); }
/** * Action rendering the tree menu for admin interface. * Note that parameters are not used at all since the request is entirely forwarded to the legacy kernel. * * @param int $nodeId * @param int $modified * @param int $expiry * @param string $perm * * @return \Symfony\Component\HttpFoundation\Response */ public function viewMenu($nodeId, $modified, $expiry, $perm) { $response = new Response(); if ($this->getParameter('treemenu.http_cache')) { $response->setMaxAge($this->getParameter('treemenu.ttl_cache')); } $result = $this->treeMenuKernel->run(); if ($result->hasAttribute('lastModified')) { $response->setLastModified($result->getAttribute('lastModified')); } $response->setContent($result->getContent()); return $response; }
/** * Executes a legacy kernel callback. * * Does the callback with both post-reinitialize and formtoken checks disabled. * * @param callable $callback * * @return mixed */ protected function runLegacyKernelCallback($callback) { $this->persistenceCacheClearer->switchOff(); $this->httpCacheClearer->switchOff(); // Initialize legacy kernel if not already done if ($this->legacyKernel instanceof Closure) { $legacyKernelClosure = $this->legacyKernel; $this->legacyKernel = $legacyKernelClosure(); } $return = $this->legacyKernel->runCallback($callback, false, false); $this->persistenceCacheClearer->switchOn(); $this->httpCacheClearer->switchOn(); return $return; }
/** * Action rendering the tree menu for admin interface. * Note that parameters are not used at all since the request is entirely forwarded to the legacy kernel. * * @param int $nodeId * @param int $modified * @param int $expiry * @param string $perm * * @return \Symfony\Component\HttpFoundation\Response */ public function viewMenu($nodeId, $modified, $expiry, $perm) { $response = new Response(); if ($this->getParameter('treemenu.http_cache')) { $request = $this->getRequest(); $response->setMaxAge($this->getParameter('treemenu.ttl_cache')); // Aggressive cache : Always return a 304 response if "If-Modified-Since" request header is present. if ($request->headers->has('If-Modified-Since')) { $response->setNotModified(); return $response; } } $result = $this->treeMenuKernel->run(); if ($result->hasAttribute('lastModified')) { $response->setLastModified($result->getAttribute('lastModified')); } $response->setContent($result->getContent()); return $response; }
/** * Reinitializes the kernel environment. */ public function reInitialize() { $this->kernelHandler->reInitialize(); }
/** * Returns the Symfony service container if it has been injected, * otherwise returns null. * * @return \Symfony\Component\DependencyInjection\ContainerInterface|null */ public function getServiceContainer() { return $this->kernelHandler->getServiceContainer(); }