Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/aphront/site/PhabricatorPlatformSite.php
13419 views
1
<?php
2
3
final class PhabricatorPlatformSite extends PhabricatorSite {
4
5
public function getDescription() {
6
return pht('Serves the core platform and applications.');
7
}
8
9
public function getPriority() {
10
return 1000;
11
}
12
13
public function newSiteForRequest(AphrontRequest $request) {
14
// If no base URI has been configured yet, match this site so the user
15
// can follow setup instructions.
16
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
17
if (!strlen($base_uri)) {
18
return new PhabricatorPlatformSite();
19
}
20
21
$uris = array();
22
$uris[] = $base_uri;
23
$uris[] = PhabricatorEnv::getEnvConfig('phabricator.production-uri');
24
25
$allowed = PhabricatorEnv::getEnvConfig('phabricator.allowed-uris');
26
if ($allowed) {
27
foreach ($allowed as $uri) {
28
$uris[] = $uri;
29
}
30
}
31
32
$host = $request->getHost();
33
if ($this->isHostMatch($host, $uris)) {
34
return new PhabricatorPlatformSite();
35
}
36
37
return null;
38
}
39
40
public function getRoutingMaps() {
41
$applications = PhabricatorApplication::getAllInstalledApplications();
42
43
$maps = array();
44
foreach ($applications as $application) {
45
$maps[] = $this->newRoutingMap()
46
->setApplication($application)
47
->setRoutes($application->getRoutes());
48
}
49
50
return $maps;
51
}
52
53
public function new404Controller(AphrontRequest $request) {
54
return new PhabricatorPlatform404Controller();
55
}
56
57
}
58
59