2015-06-29 23:04:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorPlatformSite extends PhabricatorSite {
|
|
|
|
|
|
|
|
public function getDescription() {
|
|
|
|
return pht('Serves the core platform and applications.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPriority() {
|
|
|
|
return 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function newSiteForRequest(AphrontRequest $request) {
|
2015-06-30 14:18:51 +02:00
|
|
|
// If no base URI has been configured yet, match this site so the user
|
|
|
|
// can follow setup instructions.
|
|
|
|
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
|
|
|
|
if (!strlen($base_uri)) {
|
|
|
|
return new PhabricatorPlatformSite();
|
|
|
|
}
|
|
|
|
|
2015-06-29 23:04:48 +02:00
|
|
|
$uris = array();
|
2015-06-30 14:18:51 +02:00
|
|
|
$uris[] = $base_uri;
|
2015-06-29 23:04:48 +02:00
|
|
|
$uris[] = PhabricatorEnv::getEnvConfig('phabricator.production-uri');
|
|
|
|
|
|
|
|
$allowed = PhabricatorEnv::getEnvConfig('phabricator.allowed-uris');
|
|
|
|
if ($allowed) {
|
|
|
|
foreach ($allowed as $uri) {
|
|
|
|
$uris[] = $uri;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$host = $request->getHost();
|
|
|
|
if ($this->isHostMatch($host, $uris)) {
|
|
|
|
return new PhabricatorPlatformSite();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-08-31 13:01:01 +02:00
|
|
|
public function getRoutingMaps() {
|
|
|
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
|
|
|
|
|
|
|
$maps = array();
|
|
|
|
foreach ($applications as $application) {
|
|
|
|
$maps[] = $this->newRoutingMap()
|
|
|
|
->setApplication($application)
|
|
|
|
->setRoutes($application->getRoutes());
|
|
|
|
}
|
|
|
|
|
|
|
|
return $maps;
|
|
|
|
}
|
|
|
|
|
2015-06-29 23:04:48 +02:00
|
|
|
}
|