From 354e0c1f83c83bd134cd5d682f5ddcb2316f7c75 Mon Sep 17 00:00:00 2001 From: Steven Wittens <steven@10.no-reply.drupal.org> Date: Fri, 29 Jul 2005 04:12:19 +0000 Subject: [PATCH] - #23651: Display referrer info with watchdog messages. --- database/database.mysql | 1 + database/database.pgsql | 1 + database/updates.inc | 9 ++++++++- includes/bootstrap.inc | 2 +- modules/watchdog.module | 1 + modules/watchdog/watchdog.module | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/database/database.mysql b/database/database.mysql index 334561860b9f..70bfb5231114 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -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) diff --git a/database/database.pgsql b/database/database.pgsql index 31c4fcd0d83f..5aab7c4eda4e 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -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) diff --git a/database/updates.inc b/database/updates.inc index fa63b67e217b..5427e9674d16 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -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); diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 8354520e6609..b307ab910c3e 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -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()); } /** diff --git a/modules/watchdog.module b/modules/watchdog.module index 64a580fef02b..68f460c35de1 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -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>"; diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 64a580fef02b..68f460c35de1 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -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>"; -- GitLab