/** * @Flow\Around("method(Neos\Neos\Domain\Repository\DomainRepository->findOneByActiveRequest())") * @param JoinPointInterface $joinPoint The current join point * @return mixed */ public function cacheDomainForActiveRequest(JoinPointInterface $joinPoint) { if ($this->domainForActiveRequest === false || $this->environment->getContext()->isTesting()) { $domain = $joinPoint->getAdviceChain()->proceed($joinPoint); $this->domainForActiveRequest = $domain; } return $this->domainForActiveRequest; }
/** * Handle an exception depending on the context with an HTML message or XML comment * * @param array $typoScriptPath path causing the exception * @param \Exception $exception exception to handle * @param integer $referenceCode * @return string */ protected function handle($typoScriptPath, \Exception $exception, $referenceCode) { $context = $this->environment->getContext(); if ($context->isDevelopment()) { $handler = new HtmlMessageHandler(); } else { $handler = new XmlCommentHandler(); } $handler->setRuntime($this->getRuntime()); return $handler->handleRenderingException($typoScriptPath, $exception); }
/** * Constructs this cache factory * * @param ApplicationContext $context The current Flow context * @param Environment $environment * @Flow\Autowiring(enabled=false) */ public function __construct(ApplicationContext $context, Environment $environment) { $this->context = $context; $this->environment = $environment; $environmentConfiguration = new EnvironmentConfiguration(FLOW_PATH_ROOT . '~' . (string) $environment->getContext(), $environment->getPathToTemporaryDirectory(), PHP_MAXPATHLEN); parent::__construct($environmentConfiguration); }
/** * renders the exception to nice html content element to display, edit, remove, ... * * @param string $typoScriptPath - path causing the exception * @param \Exception $exception - exception to handle * @param integer $referenceCode - might be unset * @return string */ protected function handle($typoScriptPath, \Exception $exception, $referenceCode) { $handler = new ContextDependentHandler(); $handler->setRuntime($this->runtime); $output = $handler->handleRenderingException($typoScriptPath, $exception); $currentContext = $this->getRuntime()->getCurrentContext(); if (isset($currentContext['node'])) { /** @var NodeInterface $node */ $node = $currentContext['node']; $applicationContext = $this->environment->getContext(); if ($applicationContext->isProduction() && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') && $node->getContext()->getWorkspaceName() !== 'live') { $output = '<div class="neos-rendering-exception"><div class="neos-rendering-exception-title">Failed to render element' . $output . '</div></div>'; } return $this->contentElementWrappingService->wrapContentObject($node, $output, $typoScriptPath); } return $output; }
/** * Injects the Environment object * * @param Environment $environment * @return void */ public function injectEnvironment(Environment $environment) { $this->environment = $environment; $this->environmentConfiguration = $this->createEnvironmentConfiguration($environment->getContext(), $environment->getPathToTemporaryDirectory()); }
/** * @return boolean */ protected function hasFrozenCacheInProduction() { return $this->environment->getContext()->isProduction() && $this->reflectionDataRuntimeCache->getBackend()->isFrozen(); }