@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 68 lines 1.7 kB view raw
1<?php 2 3final class AlmanacKeys extends Phobject { 4 5 public static function getKeyPath($key_name) { 6 $root = dirname(phutil_get_library_root('phabricator')); 7 $keys = $root.'/conf/keys/'; 8 9 return $keys.ltrim($key_name, '/'); 10 } 11 12 public static function getDeviceID() { 13 // While running unit tests, ignore any configured device identity. 14 try { 15 PhabricatorTestCase::assertExecutingUnitTests(); 16 return null; 17 } catch (Exception $ex) { 18 // Continue normally. 19 } 20 21 $device_id_path = self::getKeyPath('device.id'); 22 23 if (Filesystem::pathExists($device_id_path)) { 24 return trim(Filesystem::readFile($device_id_path)); 25 } 26 27 return null; 28 } 29 30 public static function getLiveDevice() { 31 $device_id = self::getDeviceID(); 32 if (!$device_id) { 33 return null; 34 } 35 36 $cache = PhabricatorCaches::getRequestCache(); 37 $cache_key = 'almanac.device.self'; 38 39 $device = $cache->getKey($cache_key); 40 if (!$device) { 41 $viewer = PhabricatorUser::getOmnipotentUser(); 42 $device = id(new AlmanacDeviceQuery()) 43 ->setViewer($viewer) 44 ->withNames(array($device_id)) 45 ->executeOne(); 46 if (!$device) { 47 throw new Exception( 48 pht( 49 'This host has device ID "%s", but there is no corresponding '. 50 'device record in Almanac.', 51 $device_id)); 52 } 53 $cache->setKey($cache_key, $device); 54 } 55 56 return $device; 57 } 58 59 public static function getClusterSSHUser() { 60 $username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user'); 61 if (strlen($username)) { 62 return $username; 63 } 64 65 return null; 66 } 67 68}