Changeset View
Changeset View
Standalone View
Standalone View
webroot/index.php
| <?php | <?php | ||||
| $phabricator_root = dirname(dirname(__FILE__)); | phabricator_startup(); | ||||
| require_once $phabricator_root.'/support/PhabricatorStartup.php'; | |||||
| // If the preamble script exists, load it. | |||||
| $preamble_path = $phabricator_root.'/support/preamble.php'; | |||||
| if (file_exists($preamble_path)) { | |||||
| require_once $preamble_path; | |||||
| } | |||||
| PhabricatorStartup::didStartup(); | |||||
| try { | try { | ||||
| PhabricatorStartup::beginStartupPhase('libraries'); | |||||
| PhabricatorStartup::loadCoreLibraries(); | PhabricatorStartup::loadCoreLibraries(); | ||||
| PhabricatorStartup::beginStartupPhase('purge'); | |||||
| PhabricatorCaches::destroyRequestCache(); | PhabricatorCaches::destroyRequestCache(); | ||||
| PhabricatorStartup::beginStartupPhase('sink'); | |||||
| $sink = new AphrontPHPHTTPSink(); | $sink = new AphrontPHPHTTPSink(); | ||||
| try { | try { | ||||
| PhabricatorStartup::beginStartupPhase('run'); | |||||
| AphrontApplicationConfiguration::runHTTPRequest($sink); | AphrontApplicationConfiguration::runHTTPRequest($sink); | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| try { | try { | ||||
| $response = new AphrontUnhandledExceptionResponse(); | $response = new AphrontUnhandledExceptionResponse(); | ||||
| $response->setException($ex); | $response->setException($ex); | ||||
| PhabricatorStartup::endOutputCapture(); | PhabricatorStartup::endOutputCapture(); | ||||
| $sink->writeResponse($response); | $sink->writeResponse($response); | ||||
| } catch (Exception $response_exception) { | } catch (Exception $response_exception) { | ||||
| // If we hit a rendering exception, ignore it and throw the original | // If we hit a rendering exception, ignore it and throw the original | ||||
| // exception. It is generally more interesting and more likely to be | // exception. It is generally more interesting and more likely to be | ||||
| // the root cause. | // the root cause. | ||||
| throw $ex; | throw $ex; | ||||
| } | } | ||||
| } | } | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| PhabricatorStartup::didEncounterFatalException('Core Exception', $ex, false); | PhabricatorStartup::didEncounterFatalException('Core Exception', $ex, false); | ||||
| } | } | ||||
| function phabricator_startup() { | |||||
| // Load the PhabricatorStartup class itself. | |||||
| $t_startup = microtime(true); | |||||
| $root = dirname(dirname(__FILE__)); | |||||
| require_once $root.'/support/PhabricatorStartup.php'; | |||||
| // If the preamble script exists, load it. | |||||
| $t_preamble = microtime(true); | |||||
| $preamble_path = $root.'/support/preamble.php'; | |||||
| if (file_exists($preamble_path)) { | |||||
| require_once $preamble_path; | |||||
| } | |||||
| $t_hook = microtime(true); | |||||
| PhabricatorStartup::didStartup($t_startup); | |||||
| PhabricatorStartup::recordStartupPhase('startup.init', $t_startup); | |||||
| PhabricatorStartup::recordStartupPhase('preamble', $t_preamble); | |||||
| PhabricatorStartup::recordStartupPhase('hook', $t_hook); | |||||
| } | |||||