mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-03 16:08:19 +02:00
Add a config setting for storing application settings
Summary: I'm just going to store application policy settings (like view/edit policy, and default policies for content) in config, because: 1) We'll need access to it on every page, and Config is "free" since we already pull it. 2) Building separate storage and transactions seems like overkill, we get less-nice but pretty-reasonable transactions for free with config. 3) We could easily move it later if this is a bad call. Also fix some formatting. Test Plan: See future revisions. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7202
This commit is contained in:
parent
461fc3dadf
commit
516116e229
3 changed files with 18 additions and 11 deletions
|
@ -105,14 +105,17 @@ final class PhabricatorConfigEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storeNewValue(
|
public static function storeNewValue(
|
||||||
PhabricatorConfigEntry $config_entry, $value, AphrontRequest $request) {
|
PhabricatorConfigEntry $config_entry,
|
||||||
|
$value,
|
||||||
|
AphrontRequest $request) {
|
||||||
|
|
||||||
$xaction = id(new PhabricatorConfigTransaction())
|
$xaction = id(new PhabricatorConfigTransaction())
|
||||||
->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT)
|
->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT)
|
||||||
->setNewValue(
|
->setNewValue(
|
||||||
array(
|
array(
|
||||||
'deleted' => false,
|
'deleted' => false,
|
||||||
'value' => $value
|
'value' => $value
|
||||||
));
|
));
|
||||||
|
|
||||||
$editor = id(new PhabricatorConfigEditor())
|
$editor = id(new PhabricatorConfigEditor())
|
||||||
->setActor($request->getUser())
|
->setActor($request->getUser())
|
||||||
|
|
|
@ -175,6 +175,10 @@ final class PhabricatorCoreConfigOptions
|
||||||
->setLocked(true)
|
->setLocked(true)
|
||||||
->setDescription(
|
->setDescription(
|
||||||
pht('Array containing list of Uninstalled applications.')),
|
pht('Array containing list of Uninstalled applications.')),
|
||||||
|
$this->newOption('phabricator.application-settings', 'wild', array())
|
||||||
|
->setLocked(true)
|
||||||
|
->setDescription(
|
||||||
|
pht('Customized settings for Phabricator applications.')),
|
||||||
$this->newOption('welcome.html', 'string', null)
|
$this->newOption('welcome.html', 'string', null)
|
||||||
->setLocked(true)
|
->setLocked(true)
|
||||||
->setDescription(
|
->setDescription(
|
||||||
|
|
|
@ -26,10 +26,10 @@ final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO
|
||||||
|
|
||||||
public static function loadConfigEntry($key) {
|
public static function loadConfigEntry($key) {
|
||||||
$config_entry = id(new PhabricatorConfigEntry())
|
$config_entry = id(new PhabricatorConfigEntry())
|
||||||
->loadOneWhere(
|
->loadOneWhere(
|
||||||
'configKey = %s AND namespace = %s',
|
'configKey = %s AND namespace = %s',
|
||||||
$key,
|
$key,
|
||||||
'default');
|
'default');
|
||||||
|
|
||||||
if (!$config_entry) {
|
if (!$config_entry) {
|
||||||
$config_entry = id(new PhabricatorConfigEntry())
|
$config_entry = id(new PhabricatorConfigEntry())
|
||||||
|
|
Loading…
Add table
Reference in a new issue