/** * 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); }
/** * 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; }
/** * Runs a callback function in the kernel environment. * This is useful to run eZ Publish 4.x code from a non-related context (like eZ Publish 5) * * @param \Closure $callback * @param bool $postReinitialize Default is true. * If set to false, the kernel environment will not be reinitialized. * This can be useful to optimize several calls to the kernel within the same context. * @return mixed The result of the callback */ public function runCallback(\Closure $callback, $postReinitialize = true) { return $this->kernelHandler->runCallback($callback, $postReinitialize); }