@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3abstract class AphrontSite extends Phobject {
4
5 abstract public function getPriority();
6 abstract public function getDescription();
7
8 abstract public function shouldRequireHTTPS();
9 abstract public function newSiteForRequest(AphrontRequest $request);
10 abstract public function getRoutingMaps();
11
12 public function new404Controller(AphrontRequest $request) {
13 return new Phabricator404Controller();
14 }
15
16 protected function isHostMatch($host, array $uris) {
17 foreach ($uris as $uri) {
18 if (!phutil_nonempty_string($uri)) {
19 continue;
20 }
21
22 $domain = id(new PhutilURI($uri))->getDomain();
23
24 if ($domain === $host) {
25 return true;
26 }
27 }
28
29 return false;
30 }
31
32 protected function newRoutingMap() {
33 return id(new AphrontRoutingMap())
34 ->setSite($this);
35 }
36
37 final public static function getAllSites() {
38 return id(new PhutilClassMapQuery())
39 ->setAncestorClass(self::class)
40 ->setSortMethod('getPriority')
41 ->execute();
42 }
43
44}