function messaging_store_sent in Messaging 6
Same name and namespace in other branches
- 5 messaging.store.inc \messaging_store_sent()
- 6.2 messaging.store.inc \messaging_store_sent()
- 6.3 messaging.store.inc \messaging_store_sent()
Mark messages as sent, either deleting them, or keeping logs
Parameters
$mqid: Single message id or array of message ids
$error: Optional, just mark as error move queue messages to log, for messages on which sending failed
1 call to messaging_store_sent()
- messaging_store_queue_process_step in ./
messaging.store.inc - Retrieve and send queued messages
File
- ./
messaging.store.inc, line 221 - Database storage for the messaging framework
Code
function messaging_store_sent($mqid, $error = FALSE) {
$mqid = is_array($mqid) ? $mqid : array(
$mqid,
);
list($where, $args) = messaging_store_query(array(
'mqid' => $mqid,
));
if ($error) {
// Error, log them all, sent = 0
$sent = 0;
}
else {
// First delete the ones that are not for logging, then mark as sent
db_query("DELETE FROM {messaging_store} WHERE log = 0 AND " . implode(' AND ', $where), $args);
$sent = time();
}
// Now unmark the rest for queue processing, as logs
$args = array_merge(array(
$sent,
), $args);
db_query("UPDATE {messaging_store} SET queue = 0, cron = 0, log = 1, sent = %d WHERE " . implode(' AND ', $where), $args);
}