You are here

function ddl_once in Devel Debug Log 8

Same name and namespace in other branches
  1. 7 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.

string $title: Title for the debug message.

File

./devel_debug_log.module, line 54
Contains Drupal\devel_debug_log\devel_debug_log.module.

Code

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