[Web] Run _sogo_static_view update when changing sogo_view content
parent
de00654a0a
commit
51cb3e1aa3
|
@ -1,8 +1,19 @@
|
|||
<?php
|
||||
function update_sogo_static_view() {
|
||||
global $pdo;
|
||||
global $lang;
|
||||
$stmt = $pdo->query("SELECT 'OK' FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_NAME = 'sogo_view'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
if ($num_results != 0) {
|
||||
$stmt = $pdo->query("REPLACE INTO _sogo_static_view SELECT * from sogo_view");
|
||||
$stmt = $pdo->query("DELETE FROM _sogo_static_view WHERE `c_uid` NOT IN (SELECT `username` FROM `mailbox` WHERE `active` = '1');");
|
||||
}
|
||||
}
|
||||
function mailbox($_action, $_type, $_data = null, $attr = null) {
|
||||
global $pdo;
|
||||
global $redis;
|
||||
global $lang;
|
||||
global $pdo;
|
||||
global $redis;
|
||||
global $lang;
|
||||
switch ($_action) {
|
||||
case 'add':
|
||||
switch ($_type) {
|
||||
|
@ -180,7 +191,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['mailbox_modified'], $username)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'syncjob':
|
||||
if (!isset($_SESSION['acl']['syncjobs']) || $_SESSION['acl']['syncjobs'] != "1" ) {
|
||||
|
@ -327,7 +337,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['mailbox_modified'], $username)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'domain':
|
||||
if ($_SESSION['mailcow_cc_role'] != "admin") {
|
||||
|
@ -1577,7 +1586,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['mailbox_modified'], $username)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'filter':
|
||||
$sieve = new Sieve\SieveParser();
|
||||
|
@ -1671,7 +1679,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['mailbox_modified'], $username)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'alias':
|
||||
if (!is_array($_data['address'])) {
|
||||
|
@ -3219,7 +3226,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => 'Deleted syncjob id/s ' . implode(', ', $ids)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'filter':
|
||||
if (!is_array($_data['id'])) {
|
||||
|
@ -3266,7 +3272,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => 'Deleted filter id/s ' . implode(', ', $ids)
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'time_limited_alias':
|
||||
if (!is_array($_data['address'])) {
|
||||
|
@ -3473,7 +3478,6 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['domain_removed'], htmlspecialchars(implode(', ', $domains)))
|
||||
);
|
||||
return true;
|
||||
break;
|
||||
case 'alias':
|
||||
if (!is_array($_data['address'])) {
|
||||
|
@ -3787,4 +3791,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if ($_action != 'get' && in_array($_type, array('domain', 'alias', 'alias_domain', 'mailbox'))) {
|
||||
update_sogo_static_view();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue