index.php 1.49 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
use Drupal\Core\DrupalKernel;
15 16
use Symfony\Component\HttpFoundation\Request;

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

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

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

34 35 36
$kernel = new DrupalKernel('prod', FALSE);
$kernel->boot();

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

Crell's avatar
Crell committed
44
$response = $kernel->handle($request)->prepare($request)->send();
45

46
$kernel->terminate($request, $response);