diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-01-26 13:36:22 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-01-26 13:36:22 +0100 |
commit | 5da4071c4553b5ee64799856e4db58e9484d9839 (patch) | |
tree | a266d0814d94d572e2a0a0d913ca592ca29e9719 /settings | |
parent | 810d5a6a675bed9a6a04bf7995a88021642c36e5 (diff) | |
parent | 9ad9d7bfbb85b03bacf0ed1c12d16bae5c8bc6ac (diff) | |
download | nextcloud-server-5da4071c4553b5ee64799856e4db58e9484d9839.tar.gz nextcloud-server-5da4071c4553b5ee64799856e4db58e9484d9839.zip |
Merge pull request #13621 from owncloud/system-config-multiset
Add a method to set/unset multiple config values with one write
Diffstat (limited to 'settings')
-rw-r--r-- | settings/controller/mailsettingscontroller.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/settings/controller/mailsettingscontroller.php b/settings/controller/mailsettingscontroller.php index d050a5ea03e..5874e644abb 100644 --- a/settings/controller/mailsettingscontroller.php +++ b/settings/controller/mailsettingscontroller.php @@ -84,20 +84,19 @@ class MailSettingsController extends Controller { $mail_smtpport) { $params = get_defined_vars(); + $configs = []; foreach($params as $key => $value) { - if(empty($value)) { - $this->config->deleteSystemValue($key); - } else { - $this->config->setSystemValue($key, $value); - } + $configs[$key] = (empty($value)) ? null : $value; } // Delete passwords from config in case no auth is specified - if($params['mail_smtpauth'] !== 1) { - $this->config->deleteSystemValue('mail_smtpname'); - $this->config->deleteSystemValue('mail_smtppassword'); + if ($params['mail_smtpauth'] !== 1) { + $configs['mail_smtpname'] = null; + $configs['mail_smtppassword'] = null; } + $this->config->setSystemValues($configs); + return array('data' => array('message' => (string) $this->l10n->t('Saved') @@ -113,8 +112,10 @@ class MailSettingsController extends Controller { * @return array */ public function storeCredentials($mail_smtpname, $mail_smtppassword) { - $this->config->setSystemValue('mail_smtpname', $mail_smtpname); - $this->config->setSystemValue('mail_smtppassword', $mail_smtppassword); + $this->config->setSystemValues([ + 'mail_smtpname' => $mail_smtpname, + 'mail_smtppassword' => $mail_smtppassword, + ]); return array('data' => array('message' => |