Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. // Begin building the query.
  3. $query = db_select('watchdog', 'th')
  4. ->extend('PagerDefault')
  5. ->orderBy('wid')
  6. ->distinct()
  7. ->fields('th', array('variables', 'type', 'severity', 'message'))
  8. ->limit(2000);
  9.  
  10.  
  11. // Fetch the result set.
  12. $result = $query -> execute();
  13.  
  14.  
  15. // Loop through each item and add to $row
  16. foreach ($result as $row) {
  17. blablabla($row);
  18. }
  19. function
  20.  
  21. blablabla($row) {
  22. $severity = $row -> severity;
  23. $type = $row -> type;
  24. $message = $row -> message;
  25. ?>
  26.  
  27. %type: !message in %function (line %line of %file)...
  28.  
  29. %type: !message in %function (line %line of %file)...
  30.  
  31. blablabla($row) {
  32. $variables = unserialize($row->variables); // un serialize variables
  33. $message = t($row->message, array(
  34. 'type' => $row->type,
  35. 'severity'=> $row->severity,
  36. // replace the rest of the variables
  37. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement