mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
Config - fix management scripts with --database parameter
Summary: Fixes T6923. Turns out we can't use the editor since we don't have a user with a phid (just some omnipotent guy). Test Plan: ./bin/config set --database syntax.filemap '{}'; ./bin/config delete --database syntax.filemap Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6923 Differential Revision: https://secure.phabricator.com/D11301
This commit is contained in:
parent
a823654be0
commit
1a997fb0df
4 changed files with 11 additions and 21 deletions
|
@ -56,15 +56,9 @@ final class PhabricatorConfigManagementDeleteWorkflow
|
|||
}
|
||||
|
||||
if ($use_database) {
|
||||
$config_entry = id(new PhabricatorConfigOption())
|
||||
->loadOneWhere(
|
||||
'namespace = %s and key = %s',
|
||||
'default',
|
||||
$key);
|
||||
PhabricatorConfigEditor::deleteConfig(
|
||||
$this->getViewer(),
|
||||
$config_entry,
|
||||
PhabricatorContentSource::newConsoleSource());
|
||||
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
|
||||
$config_entry->setIsDeleted(1);
|
||||
$config_entry->save();
|
||||
} else {
|
||||
$config->deleteKeys(array($key));
|
||||
}
|
||||
|
|
|
@ -55,11 +55,9 @@ final class PhabricatorConfigManagementMigrateWorkflow
|
|||
'Skipping option "%s"; already in database config.', $key)."\n");
|
||||
continue;
|
||||
} else {
|
||||
PhabricatorConfigEditor::storeNewValue(
|
||||
$this->getViewer(),
|
||||
id(new PhabricatorConfigEntry())
|
||||
->loadOneWhere('namespace = %s AND key = %s', 'default', $key),
|
||||
PhabricatorContentSource::newConsoleSource());
|
||||
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
|
||||
$config_entry->setValue($value);
|
||||
$config_entry->save();
|
||||
$key_count++;
|
||||
$console->writeOut(pht(
|
||||
'Migrated option "%s" from file to database config.', $key)."\n");
|
||||
|
|
|
@ -111,12 +111,9 @@ final class PhabricatorConfigManagementSetWorkflow
|
|||
|
||||
if ($use_database) {
|
||||
$config_type = 'database';
|
||||
PhabricatorConfigEditor::storeNewValue(
|
||||
$this->getViewer(),
|
||||
id(new PhabricatorConfigEntry())
|
||||
->loadOneWhere('namespace = %s AND key = %s', 'default', $key),
|
||||
$value,
|
||||
PhabricatorContentSource::newConsoleSource());
|
||||
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
|
||||
$config_entry->setValue($value);
|
||||
$config_entry->save();
|
||||
} else {
|
||||
$config_type = 'local';
|
||||
id(new PhabricatorConfigLocalSource())
|
||||
|
|
|
@ -46,7 +46,8 @@ final class PhabricatorConfigEntry
|
|||
if (!$config_entry) {
|
||||
$config_entry = id(new PhabricatorConfigEntry())
|
||||
->setConfigKey($key)
|
||||
->setNamespace('default');
|
||||
->setNamespace('default')
|
||||
->setIsDeleted(0);
|
||||
}
|
||||
|
||||
return $config_entry;
|
||||
|
|
Loading…
Reference in a new issue