summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-01-23 11:13:47 +0100
committerJoas Schilling <nickvergessen@gmx.de>2015-01-23 14:52:21 +0100
commit039397bd3104d92f7957263520eab0ccfb54f869 (patch)
treebf87c547f087ba08cea035de5a881c35b2f4c9e3 /settings
parentc61e9f391273e5f7f4b7aa91ee4174d47402cae9 (diff)
downloadnextcloud-server-039397bd3104d92f7957263520eab0ccfb54f869.tar.gz
nextcloud-server-039397bd3104d92f7957263520eab0ccfb54f869.zip
Use setConfigs() instead of calling setConfig() multiple times
Diffstat (limited to 'settings')
-rw-r--r--settings/controller/mailsettingscontroller.php21
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' =>