Skip to content
Snippets Groups Projects
Commit 354e0c1f authored by Steven Wittens's avatar Steven Wittens
Browse files

- #23651: Display referrer info with watchdog messages.

parent 515f7b41
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -768,6 +768,7 @@ CREATE TABLE watchdog (
severity tinyint(3) unsigned NOT NULL default '0',
link varchar(255) NOT NULL default '',
location varchar(128) NOT NULL default '',
referer varchar(128) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp int(11) NOT NULL default '0',
PRIMARY KEY (wid)
......
......@@ -762,6 +762,7 @@ CREATE TABLE watchdog (
severity smallint NOT NULL default '0',
link varchar(255) NOT NULL default '',
location varchar(128) NOT NULL default '',
referer varchar(128) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp integer NOT NULL default '0',
PRIMARY KEY (wid)
......
......@@ -117,7 +117,8 @@
"2005-05-10" => "update_138",
"2005-05-11" => "update_139",
"2005-05-12" => "update_140",
"2005-05-22" => "update_141"
"2005-05-22" => "update_141",
"2005-07-29" => "update_142"
);
function update_32() {
......@@ -2511,6 +2512,12 @@ function update_141() {
return $ret;
}
function update_142() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {watchdog} ADD COLUMN referer varchar(128) NOT NULL");
return $ret;
}
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
......
......@@ -739,7 +739,7 @@ function request_uri() {
*/
function watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) {
global $user;
db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, request_uri(), $_SERVER['REMOTE_ADDR'], time());
db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, request_uri(), referer_uri(), $_SERVER['REMOTE_ADDR'], time());
}
/**
......
......@@ -141,6 +141,7 @@ function watchdog_event($id) {
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($watchdog->timestamp, 'large') .'</td></tr>';
$output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". l($watchdog->referer, $watchdog->referer) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
$output .= ' <tr><th>'. t('Severity') .'</th><td>'. $severity[$watchdog->severity] .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') ."</th><td>$watchdog->hostname</td></tr>";
......
......@@ -141,6 +141,7 @@ function watchdog_event($id) {
$output .= ' <tr><th>'. t('Date') .'</th><td>'. format_date($watchdog->timestamp, 'large') .'</td></tr>';
$output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Referrer') ."</th><td>". l($watchdog->referer, $watchdog->referer) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
$output .= ' <tr><th>'. t('Severity') .'</th><td>'. $severity[$watchdog->severity] .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') ."</th><td>$watchdog->hostname</td></tr>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment