Commit 8d723826 authored by Dries's avatar Dries

- Patch #15962 by Goba: fixed the association between the accesslog data and the nodes.

parent a3322283
...@@ -1307,9 +1307,12 @@ function update_95() { ...@@ -1307,9 +1307,12 @@ function update_95() {
function update_96() { function update_96() {
$ret = array(); $ret = array();
$ret[] = update_sql('ALTER TABLE {accesslog} DROP nid');
$ret[] = update_sql('ALTER TABLE {accesslog} ADD title VARCHAR(255) DEFAULT NULL');
$ret[] = update_sql('ALTER TABLE {accesslog} ADD path VARCHAR(255) DEFAULT NULL'); $ret[] = update_sql('ALTER TABLE {accesslog} ADD path VARCHAR(255) DEFAULT NULL');
$ret[] = update_sql('UPDATE {accesslog} SET path = CONCAT("node/", nid) WHERE nid != 0');
$ret[] = update_sql('ALTER TABLE {accesslog} ADD title VARCHAR(255) DEFAULT NULL');
/* Only supported by MySQL 4.0.4 and up
$ret[] = update_sql('UPDATE {accesslog} a, {node} n SET a.title = n.title WHERE a.nid = n.nid');*/
$ret[] = update_sql('ALTER TABLE {accesslog} DROP nid');
if ($GLOBALS['db_type'] == 'mysql') { if ($GLOBALS['db_type'] == 'mysql') {
$ret[] = update_sql("ALTER TABLE {menu} ADD description varchar(255) DEFAULT '' NOT NULL"); $ret[] = update_sql("ALTER TABLE {menu} ADD description varchar(255) DEFAULT '' NOT NULL");
......
...@@ -74,10 +74,9 @@ function statistics_exit() { ...@@ -74,10 +74,9 @@ function statistics_exit() {
// Statistical logs are enabled. // Statistical logs are enabled.
$referrer = referer_uri(); $referrer = referer_uri();
$hostname = $_SERVER['REMOTE_ADDR']; $hostname = $_SERVER['REMOTE_ADDR'];
$path = (drupal_get_path_alias($_GET['q'])) ? drupal_get_path_alias($_GET['q']) : $_GET['q'];
// Log this page access. // Log this page access.
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', %d, %d)", drupal_get_title(), $path, $referrer, $hostname, $user->uid, time()); db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', %d, %d)", drupal_get_title(), $_GET['q'], $referrer, $hostname, $user->uid, time());
} }
} }
......
...@@ -74,10 +74,9 @@ function statistics_exit() { ...@@ -74,10 +74,9 @@ function statistics_exit() {
// Statistical logs are enabled. // Statistical logs are enabled.
$referrer = referer_uri(); $referrer = referer_uri();
$hostname = $_SERVER['REMOTE_ADDR']; $hostname = $_SERVER['REMOTE_ADDR'];
$path = (drupal_get_path_alias($_GET['q'])) ? drupal_get_path_alias($_GET['q']) : $_GET['q'];
// Log this page access. // Log this page access.
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', %d, %d)", drupal_get_title(), $path, $referrer, $hostname, $user->uid, time()); db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, timestamp) values('%s', '%s', '%s', '%s', %d, %d)", drupal_get_title(), $_GET['q'], $referrer, $hostname, $user->uid, time());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment