public function willShutdown() { if (isset($_REQUEST['__profile__']) && $_REQUEST['__profile__'] != 'all') { $this->xhprofID = DarkConsoleXHProfPluginAPI::stopProfiler(); } }
phabricator_fatal('[Rendering Exception] ' . $ex->getMessage()); } $write_guard->dispose(); // TODO: Share the $sink->writeResponse() pathway here? $sink = new AphrontPHPHTTPSink(); $sink->writeHTTPStatus($response->getHTTPResponseCode()); $headers = $response->getCacheHeaders(); $headers = array_merge($headers, $response->getHeaders()); $sink->writeHeaders($headers); $sink->writeData($response_string); if ($access_log) { $access_log->setData(array('c' => $response->getHTTPResponseCode(), 'T' => (int) (1000000 * (microtime(true) - $__start__)))); $access_log->write(); } if (DarkConsoleXHProfPluginAPI::isProfilerRequested()) { $profile = DarkConsoleXHProfPluginAPI::stopProfiler(); $profile_sample = id(new PhabricatorXHProfSample())->setFilePHID($profile); if (empty($_REQUEST['__profile__'])) { $sample_rate = PhabricatorEnv::getEnvConfig('debug.profile-rate'); } else { $sample_rate = 0; } $profile_sample->setSampleRate($sample_rate); if ($access_log) { $profile_sample->setUsTotal($access_log->getData('T'))->setHostname($access_log->getData('h'))->setRequestPath($access_log->getData('U'))->setController($access_log->getData('C'))->setUserPHID($request->getUser()->getPHID()); } $profile_sample->save(); } } catch (Exception $ex) { phabricator_fatal("[Exception] " . $ex->getMessage()); }
public function willShutdown() { if (DarkConsoleXHProfPluginAPI::isProfilerRequested() && DarkConsoleXHProfPluginAPI::isProfilerRequested() !== 'all') { $this->xhprofID = DarkConsoleXHProfPluginAPI::stopProfiler(); } }