You are here

function ddl_once in Devel Debug Log 7

Same name and namespace in other branches
  1. 8 devel_debug_log.module \ddl_once()

Checks if the message has already been saved during the current page request, and saves the message only if it is not a repetition of a previous one.

Parameters

$message: A debug message to save, which can be:

  • string: saved as is.
  • object or array: saved serialized.

File

./devel_debug_log.module, line 64
Creates a page that shows debug messages.

Code

function ddl_once($message, $title = '') {
  $message_history =& drupal_static(__FUNCTION__);
  if (!is_resource($message)) {
    if (!isset($message_history)) {
      $message_history = array();
    }
    $serialized = serialize($message);
    $hash = md5($serialized);
    if (in_array($hash, $message_history)) {
      return;
    }
    $message_history[] = $hash;
  }
  ddl($message, $title);
}