index.php 1.37 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 28

// A request object from the HTTPFoundation to tell us about the request.
$request = Request::createFromGlobals();
29

30 31 32 33 34 35
// 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.
request($request);

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
36 37 38 39 40

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

$kernel = new DrupalKernel($dispatcher, $resolver);
41
$response = $kernel->handle($request);
42
$response->prepare($request);
43 44
$response->send();
$kernel->terminate($request, $response);