Skip to content

Instantly share code, notes, and snippets.

@LionsAd
Created December 6, 2012 21:11
Show Gist options
  • Select an option

  • Save LionsAd/4228447 to your computer and use it in GitHub Desktop.

Select an option

Save LionsAd/4228447 to your computer and use it in GitHub Desktop.
Drupal Flush all Caches in D8
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
// Bootstrap all of Drupal's subsystems, but do not initialize anything that
// depends on the fully resolved Drupal path, because path resolution happens
// during the REQUEST event of the kernel.
// @see Drupal\Core\EventSubscriber\PathSubscriber;
// @see Drupal\Core\EventSubscriber\LegacyRequestSubscriber;
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
// @todo Figure out how best to handle the Kernel constructor parameters.
$kernel = new DrupalKernel('prod', FALSE, drupal_classloader());
// @todo Remove this once everything in the bootstrap has been
// converted to services in the DIC.
$kernel->boot();
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
// Create a request object from the HTTPFoundation.
$request = Request::createFromGlobals();
#$response = $kernel->handle($request)->prepare($request)->send();
drupal_flush_all_caches();
$kernel->terminate($request, $response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment