deleteAll(); // Bootstrap up to where caches exist and clear them. $kernel = new DrupalKernel('prod', $class_loader); $kernel->setSitePath(DrupalKernel::findSitePath($request)); $kernel->boot(); $kernel->preHandle($request); // Ensure our request includes the session if appropriate. if (PHP_SAPI !== 'cli') { $request->setSession($kernel->getContainer()->get('session')); } // Invalidate the container. $kernel->invalidateContainer(); foreach (Cache::getBins() as $bin) { $bin->deleteAll(); } // Disable recording of cached pages. \Drupal::service('page_cache_kill_switch')->trigger(); drupal_flush_all_caches(); // Restore Drupal's error and exception handlers. // @see \Drupal\Core\DrupalKernel::boot() set_error_handler('_drupal_error_handler'); set_exception_handler('_drupal_exception_handler'); }