mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Drop unavailable PDO drivers in admin contacts
Based on good feedback in issue #11 by @phsc84
This commit is contained in:
parent
e174248463
commit
578131e22a
8 changed files with 15 additions and 59 deletions
|
|
@ -3,7 +3,6 @@ import ko from 'ko';
|
||||||
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender } from 'Common/Utils';
|
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender } from 'Common/Utils';
|
||||||
|
|
||||||
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
|
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
|
||||||
import { i18n } from 'Common/Translator';
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
import { command } from 'Knoin/Knoin';
|
import { command } from 'Knoin/Knoin';
|
||||||
|
|
||||||
|
|
@ -15,50 +14,22 @@ class ContactsAdminSettings {
|
||||||
this.enableContacts = ko.observable(!!settingsGet('ContactsEnable'));
|
this.enableContacts = ko.observable(!!settingsGet('ContactsEnable'));
|
||||||
this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
|
this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
|
||||||
|
|
||||||
const supportedTypes = [],
|
const supportedTypes = settingsGet('supportedPdoDrivers') || [],
|
||||||
types = ['sqlite', 'mysql', 'pgsql'],
|
types = [{
|
||||||
getTypeName = (name) => {
|
id:'sqlite',
|
||||||
switch (name) {
|
name:'SQLite'
|
||||||
case 'sqlite':
|
},{
|
||||||
name = 'SQLite';
|
id:'mysql',
|
||||||
break;
|
name:'MySQL'
|
||||||
case 'mysql':
|
},{
|
||||||
name = 'MySQL';
|
id:'pgsql',
|
||||||
break;
|
name:'PostgreSQL'
|
||||||
case 'pgsql':
|
}].filter(type => supportedTypes.includes(type.id));
|
||||||
name = 'PostgreSQL';
|
|
||||||
break;
|
|
||||||
// no default
|
|
||||||
}
|
|
||||||
|
|
||||||
return name;
|
this.contactsSupported = 0 < types.length;
|
||||||
};
|
|
||||||
|
|
||||||
if (settingsGet('SQLiteIsSupported')) {
|
this.contactsTypesOptions = types;
|
||||||
supportedTypes.push('sqlite');
|
|
||||||
}
|
|
||||||
if (settingsGet('MySqlIsSupported')) {
|
|
||||||
supportedTypes.push('mysql');
|
|
||||||
}
|
|
||||||
if (settingsGet('PostgreSqlIsSupported')) {
|
|
||||||
supportedTypes.push('pgsql');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.contactsSupported = 0 < supportedTypes.length;
|
|
||||||
|
|
||||||
this.contactsTypes = ko.observableArray([]);
|
|
||||||
this.contactsTypesOptions = ko.computed(() =>
|
|
||||||
this.contactsTypes().map(value => {
|
|
||||||
const disabled = !supportedTypes.includes(value);
|
|
||||||
return {
|
|
||||||
'id': value,
|
|
||||||
'name': getTypeName(value) + (disabled ? ' (' + i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
|
|
||||||
'disabled': disabled
|
|
||||||
};
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
this.contactsTypes(types);
|
|
||||||
this.contactsType = ko.observable('');
|
this.contactsType = ko.observable('');
|
||||||
|
|
||||||
this.mainContactsType = ko
|
this.mainContactsType = ko
|
||||||
|
|
@ -68,7 +39,7 @@ class ContactsAdminSettings {
|
||||||
if (value !== this.contactsType()) {
|
if (value !== this.contactsType()) {
|
||||||
if (supportedTypes.includes(value)) {
|
if (supportedTypes.includes(value)) {
|
||||||
this.contactsType(value);
|
this.contactsType(value);
|
||||||
} else if (supportedTypes.length) {
|
} else if (types.length) {
|
||||||
this.contactsType('');
|
this.contactsType('');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1326,10 +1326,7 @@ NewThemeLink IncludeCss TemplatesLink LangLink IncludeBackground PluginsLink Aut
|
||||||
$aResult['VerifySslCertificate'] = (bool) $oConfig->Get('ssl', 'verify_certificate', false);
|
$aResult['VerifySslCertificate'] = (bool) $oConfig->Get('ssl', 'verify_certificate', false);
|
||||||
$aResult['AllowSelfSigned'] = (bool) $oConfig->Get('ssl', 'allow_self_signed', true);
|
$aResult['AllowSelfSigned'] = (bool) $oConfig->Get('ssl', 'allow_self_signed', true);
|
||||||
|
|
||||||
$aDrivers = \class_exists('PDO') ? \PDO::getAvailableDrivers() : null;
|
$aResult['supportedPdoDrivers'] = \class_exists('PDO') ? \PDO::getAvailableDrivers() : [];
|
||||||
$aResult['MySqlIsSupported'] = \is_array($aDrivers) ? \in_array('mysql', $aDrivers) : false;
|
|
||||||
$aResult['SQLiteIsSupported'] = \is_array($aDrivers) ? \in_array('sqlite', $aDrivers) : false;
|
|
||||||
$aResult['PostgreSqlIsSupported'] = \is_array($aDrivers) ? \in_array('pgsql', $aDrivers) : false;
|
|
||||||
|
|
||||||
$aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false);
|
$aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false);
|
||||||
$aResult['ContactsSync'] = (bool) $oConfig->Get('contacts', 'allow_sync', false);
|
$aResult['ContactsSync'] = (bool) $oConfig->Get('contacts', 'allow_sync', false);
|
||||||
|
|
|
||||||
|
|
@ -209,8 +209,6 @@ en:
|
||||||
BETA: "beta"
|
BETA: "beta"
|
||||||
UNSTABLE: "unstable"
|
UNSTABLE: "unstable"
|
||||||
WARNING: "Warning!"
|
WARNING: "Warning!"
|
||||||
NOT_SUPPORTED: "not supported"
|
|
||||||
REQUIRES_PHP_54: "requires PHP 5.4 or greater"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "Domain already exists"
|
DOMAIN_ALREADY_EXISTS: "Domain already exists"
|
||||||
UNKNOWN_ERROR: "Unknown error"
|
UNKNOWN_ERROR: "Unknown error"
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,6 @@ de_DE:
|
||||||
BETA: "Beta"
|
BETA: "Beta"
|
||||||
UNSTABLE: "Nicht stabil"
|
UNSTABLE: "Nicht stabil"
|
||||||
WARNING: "Warnung!"
|
WARNING: "Warnung!"
|
||||||
NOT_SUPPORTED: "Nicht unterstützt"
|
|
||||||
REQUIRES_PHP_54: "PHP 5.4 oder höher ist erforderlich"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "Domain existiert bereits"
|
DOMAIN_ALREADY_EXISTS: "Domain existiert bereits"
|
||||||
UNKNOWN_ERROR: "Unbekannter Fehler"
|
UNKNOWN_ERROR: "Unbekannter Fehler"
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,6 @@ en_US:
|
||||||
BETA: "beta"
|
BETA: "beta"
|
||||||
UNSTABLE: "unstable"
|
UNSTABLE: "unstable"
|
||||||
WARNING: "Warning!"
|
WARNING: "Warning!"
|
||||||
NOT_SUPPORTED: "not supported"
|
|
||||||
REQUIRES_PHP_54: "requires PHP 5.4 or greater"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "Domain already exists"
|
DOMAIN_ALREADY_EXISTS: "Domain already exists"
|
||||||
UNKNOWN_ERROR: "Unknown error"
|
UNKNOWN_ERROR: "Unknown error"
|
||||||
|
|
|
||||||
|
|
@ -203,8 +203,6 @@ es_ES:
|
||||||
BETA: "beta"
|
BETA: "beta"
|
||||||
UNSTABLE: "inestable"
|
UNSTABLE: "inestable"
|
||||||
WARNING: "¡Atención!"
|
WARNING: "¡Atención!"
|
||||||
NOT_SUPPORTED: "no soportado"
|
|
||||||
REQUIRES_PHP_54: "requiere PHP 5.4 o superior"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "El Dominio ya existe"
|
DOMAIN_ALREADY_EXISTS: "El Dominio ya existe"
|
||||||
UNKNOWN_ERROR: "Error desconocido"
|
UNKNOWN_ERROR: "Error desconocido"
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,6 @@ fr_FR:
|
||||||
BETA: "bêta"
|
BETA: "bêta"
|
||||||
UNSTABLE: "instable"
|
UNSTABLE: "instable"
|
||||||
WARNING: "ATTENTION !"
|
WARNING: "ATTENTION !"
|
||||||
NOT_SUPPORTED: "non supporté"
|
|
||||||
REQUIRES_PHP_54: "nécessite PHP 5.4 ou supérieur"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "Le domaine existe déjà"
|
DOMAIN_ALREADY_EXISTS: "Le domaine existe déjà"
|
||||||
UNKNOWN_ERROR: "Erreur inconnue"
|
UNKNOWN_ERROR: "Erreur inconnue"
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,6 @@ nl_NL:
|
||||||
BETA: "bèta"
|
BETA: "bèta"
|
||||||
UNSTABLE: "onstabiel"
|
UNSTABLE: "onstabiel"
|
||||||
WARNING: "Waarschuwing!"
|
WARNING: "Waarschuwing!"
|
||||||
NOT_SUPPORTED: "niet ondersteund"
|
|
||||||
REQUIRES_PHP_54: "vereist PHP 5.4 of hoger"
|
|
||||||
ERRORS:
|
ERRORS:
|
||||||
DOMAIN_ALREADY_EXISTS: "Domein bestaat al"
|
DOMAIN_ALREADY_EXISTS: "Domein bestaat al"
|
||||||
UNKNOWN_ERROR: "Onbekende fout"
|
UNKNOWN_ERROR: "Onbekende fout"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue