[Web] Remove XMPP options
[Web] Add Rspamd preset #4 [Web] Do not show failed SASL logins (and also remove them from db)
This commit is contained in:
@@ -3,7 +3,7 @@ function init_db_schema() {
|
||||
try {
|
||||
global $pdo;
|
||||
|
||||
$db_version = "07062021_2320";
|
||||
$db_version = "30062021_0910";
|
||||
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
@@ -240,8 +240,6 @@ function init_db_schema() {
|
||||
"gal" => "TINYINT(1) NOT NULL DEFAULT '1'",
|
||||
"relay_all_recipients" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"relay_unknown_only" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"xmpp" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"xmpp_prefix" => "VARCHAR(255) DEFAULT 'im'",
|
||||
"created" => "DATETIME(0) NOT NULL DEFAULT NOW(0)",
|
||||
"modified" => "DATETIME ON UPDATE CURRENT_TIMESTAMP",
|
||||
"active" => "TINYINT(1) NOT NULL DEFAULT '1'"
|
||||
@@ -513,7 +511,6 @@ function init_db_schema() {
|
||||
"sasl_logs" => array(
|
||||
"cols" => array(
|
||||
"id" => "INT NOT NULL AUTO_INCREMENT",
|
||||
"success" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"service" => "VARCHAR(32) NOT NULL DEFAULT ''",
|
||||
"app_password" => "INT",
|
||||
"username" => "VARCHAR(255) NOT NULL",
|
||||
@@ -527,7 +524,6 @@ function init_db_schema() {
|
||||
"key" => array(
|
||||
"username" => array("username"),
|
||||
"service" => array("service"),
|
||||
"success" => array("success"),
|
||||
"datetime" => array("datetime"),
|
||||
"real_rip" => array("real_rip")
|
||||
)
|
||||
@@ -598,10 +594,6 @@ function init_db_schema() {
|
||||
"alias_domains" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"mailbox_relayhost" => "TINYINT(1) NOT NULL DEFAULT '1'",
|
||||
"domain_relayhost" => "TINYINT(1) NOT NULL DEFAULT '1'",
|
||||
"xmpp_prefix" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"xmpp_domain_access" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"xmpp_mailbox_access" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"xmpp_admin" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"domain_desc" => "TINYINT(1) NOT NULL DEFAULT '0'"
|
||||
),
|
||||
"keys" => array(
|
||||
@@ -1007,6 +999,7 @@ function init_db_schema() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Migrate tls_enforce_* options
|
||||
if ($table == 'mailbox') {
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE 'mailbox'");
|
||||
@@ -1023,6 +1016,20 @@ function init_db_schema() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deprecated success = 0 entries before migrating sasl_logs
|
||||
if ($table == 'sasl_logs') {
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE 'sasl_logs'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
if ($num_results != 0) {
|
||||
$stmt = $pdo->query("SHOW COLUMNS FROM `sasl_logs` LIKE '%success%'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
if ($num_results != 0) {
|
||||
$stmt = $pdo->query("DELETE FROM `sasl_logs` WHERE `success` = 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
if ($num_results != 0) {
|
||||
@@ -1216,8 +1223,6 @@ function init_db_schema() {
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = '{}' WHERE `attributes` = '' OR `attributes` IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.passwd_update', \"0\") WHERE JSON_VALUE(`attributes`, '$.passwd_update') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.relayhost', \"0\") WHERE JSON_VALUE(`attributes`, '$.relayhost') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.xmpp_access', \"1\") WHERE JSON_VALUE(`attributes`, '$.xmpp_access') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.xmpp_admin', \"0\") WHERE JSON_VALUE(`attributes`, '$.xmpp_admin') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.force_pw_update', \"0\") WHERE JSON_VALUE(`attributes`, '$.force_pw_update') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.sogo_access', \"1\") WHERE JSON_VALUE(`attributes`, '$.sogo_access') IS NULL;");
|
||||
$pdo->query("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.imap_access', \"1\") WHERE JSON_VALUE(`attributes`, '$.imap_access') IS NULL;");
|
||||
@@ -1266,7 +1271,6 @@ function init_db_schema() {
|
||||
if (php_sapi_name() == "cli") {
|
||||
include '/web/inc/vars.inc.php';
|
||||
include '/web/inc/functions.docker.inc.php';
|
||||
include '/web/inc/functions.xmpp.inc.php';
|
||||
// $now = new DateTime();
|
||||
// $mins = $now->getOffset() / 60;
|
||||
// $sgn = ($mins < 0 ? -1 : 1);
|
||||
@@ -1305,7 +1309,5 @@ if (php_sapi_name() == "cli") {
|
||||
catch ( Exception $e ) {
|
||||
// Dunno
|
||||
}
|
||||
xmpp_rebuild_configs();
|
||||
echo "Rebuilt XMPP configuration". PHP_EOL;
|
||||
init_db_schema();
|
||||
}
|
||||
|
Reference in New Issue
Block a user