diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index d53cda9aef..57fd8b022c 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -2837,6 +2837,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $domain )); // save tags + $tags_changed = false; foreach($tags as $index => $tag){ if (empty($tag)) continue; if ($index > $GLOBALS['TAGGING_LIMIT']) { @@ -2852,6 +2853,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $domain, ':tag_name' => $tag, )); + if ($stmt->rowCount() > 0) $tags_changed = true; + } + // tags are stored in a separate table, so adding one does not touch + // `domain` and its `modified` ON UPDATE column never fires + if ($tags_changed) { + $stmt = $pdo->prepare("UPDATE `domain` SET `modified` = NOW() WHERE `domain` = :domain"); + $stmt->execute(array(':domain' => $domain)); } $_SESSION['return'][] = array( @@ -3005,6 +3013,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $domain )); // save tags + $tags_changed = false; foreach($tags as $index => $tag){ if (empty($tag)) continue; if ($index > $GLOBALS['TAGGING_LIMIT']) { @@ -3020,6 +3029,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $domain, ':tag_name' => $tag, )); + if ($stmt->rowCount() > 0) $tags_changed = true; + } + // tags are stored in a separate table, so adding one does not touch + // `domain` and its `modified` ON UPDATE column never fires + if ($tags_changed) { + $stmt = $pdo->prepare("UPDATE `domain` SET `modified` = NOW() WHERE `domain` = :domain"); + $stmt->execute(array(':domain' => $domain)); } $_SESSION['return'][] = array( @@ -3479,6 +3495,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { )); } // save tags + $tags_changed = false; foreach($tags as $index => $tag){ if (empty($tag)) continue; if ($index > $GLOBALS['TAGGING_LIMIT']) { @@ -3495,9 +3512,16 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':username' => $username, ':tag_name' => $tag, )); + if ($stmt->rowCount() > 0) $tags_changed = true; } catch (Exception $e) { } } + // tags are stored in a separate table, so adding one does not touch + // `mailbox` and its `modified` ON UPDATE column never fires + if ($tags_changed) { + $stmt = $pdo->prepare("UPDATE `mailbox` SET `modified` = NOW() WHERE `username` = :username"); + $stmt->execute(array(':username' => $username)); + } $_SESSION['return'][] = array( 'type' => 'success', @@ -6273,6 +6297,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { return false; } + $tags_changed = false; foreach($tags as $tag){ // delete tag $wasModified = true; @@ -6281,6 +6306,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $domain, ':tag_name' => $tag, )); + if ($stmt->rowCount() > 0) $tags_changed = true; + } + // tags are stored in a separate table, so removing one does not touch + // `domain` and its `modified` ON UPDATE column never fires + if ($tags_changed) { + $stmt = $pdo->prepare("UPDATE `domain` SET `modified` = NOW() WHERE `domain` = :domain"); + $stmt->execute(array(':domain' => $domain)); } } @@ -6325,6 +6357,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { } // delete tags + $tags_changed = false; foreach($tags as $tag){ $wasModified = true; @@ -6333,6 +6366,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':username' => $username, ':tag_name' => $tag, )); + if ($stmt->rowCount() > 0) $tags_changed = true; + } + // tags are stored in a separate table, so removing one does not touch + // `mailbox` and its `modified` ON UPDATE column never fires + if ($tags_changed) { + $stmt = $pdo->prepare("UPDATE `mailbox` SET `modified` = NOW() WHERE `username` = :username"); + $stmt->execute(array(':username' => $username)); } }