You are here

function devel_querylog_arguments in Devel 7

Page callback: Called by the AJAX link in query log.

1 string reference to 'devel_querylog_arguments'
devel_menu in ./devel.module
Implements hook_menu().

File

./devel.pages.inc, line 92
Page callbacks for Devel.

Code

function devel_querylog_arguments($request_id, $qid) {
  if (!is_numeric($request_id)) {
    return MENU_ACCESS_DENIED;
  }
  $path = "temporary://devel_querylog/{$request_id}.txt";
  $path = file_stream_wrapper_uri_normalize($path);
  $output = t('No arguments log found.');
  if (file_exists($path)) {
    $queries = json_decode(file_get_contents($path));
    if ($queries !== FALSE && isset($queries[$qid])) {
      $query = $queries[$qid];
      $conn = Database::getConnection();
      $quoted = array();
      foreach ((array) $query->args as $key => $val) {
        $quoted[$key] = $conn
          ->quote($val);
      }
      $output = strtr($query->query, $quoted);
    }
  }

  // Print and return nothing thus avoiding page wrapper.
  print $output;
  $GLOBALS['devel_shutdown'] = FALSE;
}