index.php 1.63 KB
Newer Older
1
<?php
Dries's avatar
Dries committed
2

3 4 5 6 7 8
/**
 * @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.
9 10
 *
 * All Drupal code is released under the GNU General Public License.
11
 * See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
12 13
 */

14 15 16 17 18
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;

19 20 21
/**
 * Root directory of Drupal installation.
 */
22
define('DRUPAL_ROOT', getcwd());
neclimdul's avatar
WIP  
neclimdul committed
23
// Bootstrap the lowest level of what we need.
24
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
25
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
neclimdul's avatar
WIP  
neclimdul committed
26

27
// Create a request object from the HTTPFoundation.
neclimdul's avatar
WIP  
neclimdul committed
28
$request = Request::createFromGlobals();
29

30 31 32
// Set the global $request object. This is a temporary measure to keep legacy
// utility functions working. It should be moved to a dependency injection
// container at some point.
33 34
request($request);

35 36 37 38 39
// 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;
40
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
41 42 43 44 45

$dispatcher = new EventDispatcher();
$resolver = new ControllerResolver();

$kernel = new DrupalKernel($dispatcher, $resolver);
Crell's avatar
Crell committed
46
$response = $kernel->handle($request)->prepare($request)->send();
47
$kernel->terminate($request, $response);