@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
3final class PhabricatorFaviconController
4 extends PhabricatorController {
5
6 public function shouldRequireLogin() {
7 return false;
8 }
9
10 public function handleRequest(AphrontRequest $request) {
11 // See PHI1719. Phabricator uses "<link /"> tags in the document body
12 // to direct user agents to icons, like this:
13 //
14 // <link rel="icon" href="..." />
15 //
16 // However, some software requests the hard-coded path "/favicon.ico"
17 // directly. To tidy the logs, serve some reasonable response rather than
18 // a 404.
19
20 // NOTE: Right now, this only works for the "PhabricatorPlatformSite".
21 // Other sites (like custom Phame blogs) won't currently route this
22 // path.
23
24 $ref = id(new PhabricatorFaviconRef())
25 ->setWidth(64)
26 ->setHeight(64);
27
28 id(new PhabricatorFaviconRefQuery())
29 ->withRefs(array($ref))
30 ->execute();
31
32 return id(new AphrontRedirectResponse())
33 ->setIsExternal(true)
34 ->setURI($ref->getURI());
35 }
36}