You are here

public static function Messaging_Store::message_save in Messaging 6.4

Put into database storage, create one line for each destination

If there are many destinations they will be stored as 'multiple'

Parameters

$message: Message object

Return value

int Result from drupal_write_record: SAVED_NEW, SAVED_UPDATED, FALSE

2 calls to Messaging_Store::message_save()
Messaging_Store::message_log in includes/messaging_store.class.inc
Log message for further reference
Messaging_Store::message_queue in includes/messaging_store.class.inc
Queue message for next delivery

File

includes/messaging_store.class.inc, line 406
Database storage for the messaging framework

Class

Messaging_Store
Default storage and queueing system for Messaging

Code

public static function message_save($message) {

  // Check we have a message object
  $message = messaging_message_build($message);
  self::message_prepare($message);
  $update = empty($message->mqid) ? array() : 'mqid';
  $result = drupal_write_record(self::DB_TABLE, $message, $update);
  if ($result) {

    // For this store, queue and log are the same so we mark the messages accordingly
    $message->updated = FALSE;
    $message->queued = $message->queue;
    $message->logged = $message->log;

    // Store it into the cache for further reference
    self::cache_set(self::message_key($message), $message);
  }
  messaging_debug('Saved message to store', array(
    'message' => $message,
  ));
  return $result;
}