setSitePath(DrupalKernel::findSitePath($request)); $kernel->invalidateContainer(); $kernel->boot(); $kernel->preHandle($request); // Ensure our request includes the session if appropriate. if (PHP_SAPI !== 'cli') { $request->setSession($kernel->getContainer()->get('session')); } drupal_flush_all_caches($kernel); // Disable recording of cached pages. \Drupal::service('page_cache_kill_switch')->trigger(); // Restore Drupal's error and exception handlers. // @see \Drupal\Core\DrupalKernel::boot() set_error_handler('_drupal_error_handler'); set_exception_handler('_drupal_exception_handler'); }