Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/response/PhabricatorConfigResponse.php
| <?php | <?php | ||||
| final class PhabricatorConfigResponse extends AphrontHTMLResponse { | final class PhabricatorConfigResponse extends AphrontStandaloneHTMLResponse { | ||||
| private $view; | private $view; | ||||
| public function setView(PhabricatorSetupIssueView $view) { | public function setView(PhabricatorSetupIssueView $view) { | ||||
| $this->view = $view; | $this->view = $view; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function buildResponseString() { | public function getHTTPResponseCode() { | ||||
| // Check to make sure we aren't requesting this via ajax or conduit | return 500; | ||||
| if (isset($_REQUEST['__ajax__']) || isset($_REQUEST['__conduit__'])) { | |||||
| // We don't want to flood the console with html, just return a simple | |||||
| // message for now. | |||||
| return pht( | |||||
| 'This install has a fatal setup error, access the internet web '. | |||||
| 'version to view details and resolve it.'); | |||||
| } | } | ||||
| $resources = $this->buildResources(); | protected function getResources() { | ||||
| return array( | |||||
| $view = $this->view->render(); | 'css/application/config/config-template.css', | ||||
| 'css/application/config/setup-issue.css', | |||||
| return hsprintf( | |||||
| '<!DOCTYPE html>'. | |||||
| '<html>'. | |||||
| '<head>'. | |||||
| '<meta charset="UTF-8" />'. | |||||
| '<title>Phabricator Setup</title>'. | |||||
| '%s'. | |||||
| '</head>'. | |||||
| '<body class="setup-fatal">%s</body>'. | |||||
| '</html>', | |||||
| $resources, | |||||
| $view); | |||||
| } | |||||
| private function buildResources() { | |||||
| $css = array( | |||||
| 'application/config/config-template.css', | |||||
| 'application/config/setup-issue.css', | |||||
| ); | ); | ||||
| } | |||||
| $webroot = dirname(phutil_get_library_root('phabricator')).'/webroot/'; | protected function getResponseTitle() { | ||||
| return pht('Phabricator Setup Error'); | |||||
| } | |||||
| $resources = array(); | protected function getResponseBodyClass() { | ||||
| foreach ($css as $path) { | return 'setup-fatal'; | ||||
| $resources[] = phutil_tag( | |||||
| 'style', | |||||
| array('type' => 'text/css'), | |||||
| phutil_safe_html(Filesystem::readFile($webroot.'/rsrc/css/'.$path))); | |||||
| } | } | ||||
| return phutil_implode_html("\n", $resources); | |||||
| protected function getResponseBody() { | |||||
| return $this->view->render(); | |||||
| } | } | ||||
| protected function buildPlainTextResponseString() { | |||||
| return pht( | |||||
| 'This install has a fatal setup error, access the internet web '. | |||||
| 'version to view details and resolve it.'); | |||||
| } | |||||
| } | } | ||||