mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Cleanup Contacts/AddressBook PDO settings
This commit is contained in:
parent
275e5c5947
commit
0374ded776
|
@ -19,7 +19,7 @@ export class ContactsAdminSettings {
|
||||||
addObservablesTo(this, {
|
addObservablesTo(this, {
|
||||||
enableContacts: !!SettingsGet('ContactsEnable'),
|
enableContacts: !!SettingsGet('ContactsEnable'),
|
||||||
contactsSync: !!SettingsGet('ContactsSync'),
|
contactsSync: !!SettingsGet('ContactsSync'),
|
||||||
contactsType: '',
|
contactsType: SettingsGet('ContactsPdoType'),
|
||||||
|
|
||||||
pdoDsn: SettingsGet('ContactsPdoDsn'),
|
pdoDsn: SettingsGet('ContactsPdoDsn'),
|
||||||
pdoUser: SettingsGet('ContactsPdoUser'),
|
pdoUser: SettingsGet('ContactsPdoUser'),
|
||||||
|
@ -69,8 +69,6 @@ export class ContactsAdminSettings {
|
||||||
})
|
})
|
||||||
.extend({ notify: 'always' });
|
.extend({ notify: 'always' });
|
||||||
|
|
||||||
this.contactsType(SettingsGet('ContactsPdoType'));
|
|
||||||
|
|
||||||
addSubscribablesTo(this, {
|
addSubscribablesTo(this, {
|
||||||
enableContacts: value =>
|
enableContacts: value =>
|
||||||
Remote.saveAdminConfig(null, {
|
Remote.saveAdminConfig(null, {
|
||||||
|
|
|
@ -265,18 +265,17 @@ class Actions
|
||||||
break;
|
break;
|
||||||
case 'address-book':
|
case 'address-book':
|
||||||
// Providers\AddressBook\AddressBookInterface
|
// Providers\AddressBook\AddressBookInterface
|
||||||
|
|
||||||
$sDsn = \trim($this->Config()->Get('contacts', 'pdo_dsn', ''));
|
$sDsn = \trim($this->Config()->Get('contacts', 'pdo_dsn', ''));
|
||||||
$sUser = \trim($this->Config()->Get('contacts', 'pdo_user', ''));
|
$sUser = \trim($this->Config()->Get('contacts', 'pdo_user', ''));
|
||||||
$sPassword = (string)$this->Config()->Get('contacts', 'pdo_password', '');
|
$sPassword = (string)$this->Config()->Get('contacts', 'pdo_password', '');
|
||||||
|
|
||||||
$sDsnType = $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite')));
|
$sDsnType = $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite')));
|
||||||
if ('sqlite' === $sDsnType) {
|
if ('sqlite' === $sDsnType) {
|
||||||
$mResult = new Providers\AddressBook\PdoAddressBook(
|
$sUser = $sPassword = '';
|
||||||
'sqlite:' . APP_PRIVATE_DATA . 'AddressBook.sqlite', '', '', 'sqlite');
|
$sDsn = 'sqlite:' . APP_PRIVATE_DATA . 'AddressBook.sqlite';
|
||||||
} else {
|
} else {
|
||||||
$mResult = new Providers\AddressBook\PdoAddressBook($sDsn, $sUser, $sPassword, $sDsnType);
|
$sDsn = $sDsnType . ':' . \preg_replace('/^[a-z]+:/', '', $sDsn);
|
||||||
}
|
}
|
||||||
|
$mResult = new Providers\AddressBook\PdoAddressBook($sDsn, $sUser, $sPassword, $sDsnType);
|
||||||
break;
|
break;
|
||||||
case 'identities':
|
case 'identities':
|
||||||
$mResult = [];
|
$mResult = [];
|
||||||
|
|
|
@ -141,7 +141,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
'allow_sync' => array(false),
|
'allow_sync' => array(false),
|
||||||
'sync_interval' => array(20),
|
'sync_interval' => array(20),
|
||||||
'type' => array('sqlite', ''),
|
'type' => array('sqlite', ''),
|
||||||
'pdo_dsn' => array('mysql:host=127.0.0.1;port=3306;dbname=rainloop', ''),
|
'pdo_dsn' => array('host=127.0.0.1;port=3306;dbname=snappymail', ''),
|
||||||
'pdo_user' => array('root', ''),
|
'pdo_user' => array('root', ''),
|
||||||
'pdo_password' => array('', ''),
|
'pdo_password' => array('', ''),
|
||||||
'suggestions_limit' => array(30)
|
'suggestions_limit' => array(30)
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
data-bind="value: pdoDsn, saveTrigger: pdoDsnTrigger" />
|
data-bind="value: pdoDsn, saveTrigger: pdoDsnTrigger" />
|
||||||
<blockquote style="margin: 0">
|
<blockquote style="margin: 0">
|
||||||
<p class="muted">
|
<p class="muted">
|
||||||
mysql:host=127.0.0.1;port=3306;dbname=rainloop<br />
|
host=127.0.0.1;port=3306;dbname=snappymail<br />
|
||||||
pgsql:host=127.0.0.1;port=5432;dbname=rainloop
|
host=127.0.0.1;port=5432;dbname=snappymail
|
||||||
</p>
|
</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue