Example #1
0
<?php

$phabricator_root = dirname(dirname(__FILE__));
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();
$show_unexpected_traces = false;
try {
    PhabricatorStartup::loadCoreLibraries();
    PhabricatorEnv::initializeWebEnvironment();
    $show_unexpected_traces = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
    // This is the earliest we can get away with this, we need env config first.
    PhabricatorAccessLog::init();
    $access_log = PhabricatorAccessLog::getLog();
    PhabricatorStartup::setGlobal('log.access', $access_log);
    $access_log->setData(array('R' => AphrontRequest::getHTTPHeader('Referer', '-'), 'r' => idx($_SERVER, 'REMOTE_ADDR', '-'), 'M' => idx($_SERVER, 'REQUEST_METHOD', '-')));
    DarkConsoleXHProfPluginAPI::hookProfiler();
    DarkConsoleErrorLogPluginAPI::registerErrorHandler();
    $sink = new AphrontPHPHTTPSink();
    $response = PhabricatorSetupCheck::willProcessRequest();
    if ($response) {
        PhabricatorStartup::endOutputCapture();
        $sink->writeResponse($response);
        return;
    }
    $host = AphrontRequest::getHTTPHeader('Host');
    $path = $_REQUEST['__path__'];