@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
3/**
4 * Configuration source which reads from the database.
5 */
6final class PhabricatorConfigDatabaseSource
7 extends PhabricatorConfigProxySource {
8
9 public function __construct($namespace) {
10 $config = $this->loadConfig($namespace);
11 $this->setSource(new PhabricatorConfigDictionarySource($config));
12 }
13
14 public function isWritable() {
15 // While this is writable, writes occur through the Config application.
16 return false;
17 }
18
19 private function loadConfig($namespace) {
20 $objects = id(new PhabricatorConfigEntry())->loadAllWhere(
21 'namespace = %s AND isDeleted = 0',
22 $namespace);
23 return mpull($objects, 'getValue', 'getConfigKey');
24 }
25
26}