2001-03-10 11:07:52 +00:00
< ? php
2000-05-18 19:51:59 +00:00
2004-08-21 06:42:38 +00:00
/**
* @ file
* The PHP page that serves all page requests on a Drupal installation .
*
2007-12-26 08:46:48 +00:00
* All Drupal code is released under the GNU General Public License .
2011-10-31 04:05:57 +00:00
* See COPYRIGHT . txt and LICENSE . txt files in the " core " directory .
2004-08-21 06:42:38 +00:00
*/
2014-06-26 10:47:01 +00:00
use Drupal\Core\DrupalKernel ;
2014-04-25 19:13:44 +00:00
use Drupal\Core\Site\Settings ;
2014-11-21 09:31:37 +00:00
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface ;
2014-06-26 10:47:01 +00:00
use Symfony\Component\HttpFoundation\Request ;
2014-11-21 09:31:37 +00:00
use Symfony\Component\HttpFoundation\Response ;
2014-04-25 19:13:44 +00:00
2014-06-26 10:47:01 +00:00
$autoloader = require_once __DIR__ . '/core/vendor/autoload.php' ;
2013-09-02 19:53:23 +00:00
2013-05-19 19:32:09 +00:00
try {
2014-06-26 10:47:01 +00:00
$request = Request :: createFromGlobals ();
$kernel = DrupalKernel :: createFromRequest ( $request , $autoloader , 'prod' );
$response = $kernel
2014-09-04 02:58:45 +00:00
-> handle ( $request )
2014-06-26 10:47:01 +00:00
// Handle the response object.
-> prepare ( $request ) -> send ();
$kernel -> terminate ( $request , $response );
2013-05-19 19:32:09 +00:00
}
2014-11-21 09:31:37 +00:00
catch ( HttpExceptionInterface $e ) {
2015-01-22 18:57:56 +00:00
$response = new Response ( $e -> getMessage (), $e -> getStatusCode ());
2014-11-21 09:31:37 +00:00
$response -> prepare ( $request ) -> send ();
}
2013-05-19 19:32:09 +00:00
catch ( Exception $e ) {
2013-12-10 13:50:21 +00:00
$message = 'If you have just changed code (for example deployed a new module or moved an existing one) read <a href="http://drupal.org/documentation/rebuild">http://drupal.org/documentation/rebuild</a>' ;
2014-04-25 19:13:44 +00:00
if ( Settings :: get ( 'rebuild_access' , FALSE )) {
2013-12-10 13:50:21 +00:00
$rebuild_path = $GLOBALS [ 'base_url' ] . '/rebuild.php' ;
$message .= " or run the <a href= \" $rebuild_path\ " > rebuild script </ a > " ;
}
2014-06-18 07:07:06 +00:00
// Set the response code manually. Otherwise, this response will default to a
// 200.
http_response_code ( 500 );
2013-12-10 13:50:21 +00:00
print $message ;
2013-05-19 19:32:09 +00:00
throw $e ;
}