forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorConfigResponse.php
59 lines (47 loc) · 1.51 KB
/
PhabricatorConfigResponse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
final class PhabricatorConfigResponse extends AphrontHTMLResponse {
private $view;
public function setView(PhabricatorSetupIssueView $view) {
$this->view = $view;
return $this;
}
public function buildResponseString() {
// Check to make sure we aren't requesting this via ajax or conduit
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();
$view = $this->view->render();
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/';
$resources = array();
foreach ($css as $path) {
$resources[] = phutil_tag(
'style',
array('type' => 'text/css'),
phutil_safe_html(Filesystem::readFile($webroot.'/rsrc/css/'.$path)));
}
return phutil_implode_html("\n", $resources);
}
}