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

Dries's avatar
 
Dries committed
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.
Dries's avatar
 
Dries committed
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
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
36 37 38 39 40

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

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