Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/configuration/AphrontApplicationConfiguration.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | abstract class AphrontApplicationConfiguration extends Phobject { | ||||
| public function willBuildRequest() {} | public function willBuildRequest() {} | ||||
| /** | /** | ||||
| * @phutil-external-symbol class PhabricatorStartup | * @phutil-external-symbol class PhabricatorStartup | ||||
| */ | */ | ||||
| public static function runHTTPRequest(AphrontHTTPSink $sink) { | public static function runHTTPRequest(AphrontHTTPSink $sink) { | ||||
| PhabricatorStartup::beginStartupPhase('multimeter'); | |||||
| $multimeter = MultimeterControl::newInstance(); | $multimeter = MultimeterControl::newInstance(); | ||||
| $multimeter->setEventContext('<http-init>'); | $multimeter->setEventContext('<http-init>'); | ||||
| $multimeter->setEventViewer('<none>'); | $multimeter->setEventViewer('<none>'); | ||||
| // Build a no-op write guard for the setup phase. We'll replace this with a | // Build a no-op write guard for the setup phase. We'll replace this with a | ||||
| // real write guard later on, but we need to survive setup and build a | // real write guard later on, but we need to survive setup and build a | ||||
| // request object first. | // request object first. | ||||
| $write_guard = new AphrontWriteGuard('id'); | $write_guard = new AphrontWriteGuard('id'); | ||||
| PhabricatorStartup::beginStartupPhase('env.init'); | |||||
| PhabricatorEnv::initializeWebEnvironment(); | PhabricatorEnv::initializeWebEnvironment(); | ||||
| $multimeter->setSampleRate( | $multimeter->setSampleRate( | ||||
| PhabricatorEnv::getEnvConfig('debug.sample-rate')); | PhabricatorEnv::getEnvConfig('debug.sample-rate')); | ||||
| $debug_time_limit = PhabricatorEnv::getEnvConfig('debug.time-limit'); | $debug_time_limit = PhabricatorEnv::getEnvConfig('debug.time-limit'); | ||||
| if ($debug_time_limit) { | if ($debug_time_limit) { | ||||
| PhabricatorStartup::setDebugTimeLimit($debug_time_limit); | PhabricatorStartup::setDebugTimeLimit($debug_time_limit); | ||||
| } | } | ||||
| // This is the earliest we can get away with this, we need env config first. | // This is the earliest we can get away with this, we need env config first. | ||||
| PhabricatorStartup::beginStartupPhase('log.access'); | |||||
| PhabricatorAccessLog::init(); | PhabricatorAccessLog::init(); | ||||
| $access_log = PhabricatorAccessLog::getLog(); | $access_log = PhabricatorAccessLog::getLog(); | ||||
| PhabricatorStartup::setAccessLog($access_log); | PhabricatorStartup::setAccessLog($access_log); | ||||
| $access_log->setData( | $access_log->setData( | ||||
| array( | array( | ||||
| 'R' => AphrontRequest::getHTTPHeader('Referer', '-'), | 'R' => AphrontRequest::getHTTPHeader('Referer', '-'), | ||||
| 'r' => idx($_SERVER, 'REMOTE_ADDR', '-'), | 'r' => idx($_SERVER, 'REMOTE_ADDR', '-'), | ||||
| 'M' => idx($_SERVER, 'REQUEST_METHOD', '-'), | 'M' => idx($_SERVER, 'REQUEST_METHOD', '-'), | ||||
| )); | )); | ||||
| DarkConsoleXHProfPluginAPI::hookProfiler(); | DarkConsoleXHProfPluginAPI::hookProfiler(); | ||||
| // We just activated the profiler, so we don't need to keep track of | |||||
| // startup phases anymore: it can take over from here. | |||||
| PhabricatorStartup::beginStartupPhase('startup.done'); | |||||
| DarkConsoleErrorLogPluginAPI::registerErrorHandler(); | DarkConsoleErrorLogPluginAPI::registerErrorHandler(); | ||||
| $response = PhabricatorSetupCheck::willProcessRequest(); | $response = PhabricatorSetupCheck::willProcessRequest(); | ||||
| if ($response) { | if ($response) { | ||||
| PhabricatorStartup::endOutputCapture(); | PhabricatorStartup::endOutputCapture(); | ||||
| $sink->writeResponse($response); | $sink->writeResponse($response); | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 368 Lines • Show Last 20 Lines | |||||