Index: release/project-release-serve-history.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/release/project-release-serve-history.php,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 project-release-serve-history.php
--- release/project-release-serve-history.php	14 Sep 2007 16:17:55 -0000	1.8
+++ release/project-release-serve-history.php	2 Oct 2007 15:58:13 -0000
@@ -98,6 +98,7 @@ if (isset($_GET['site_key'])) {
   if (db_table_exists('project_usage_raw')) {
     $site_key = $_GET['site_key'];
     $project_version = isset($_GET['version']) ? $_GET['version'] : '';
+    $hostname = $_SERVER['REMOTE_ADDR'];
 
     // Compute a GMT timestamp for begining of the day. getdate() is
     // affected by the server's timezone so we need to cancel it out.
@@ -106,10 +107,10 @@ if (isset($_GET['site_key'])) {
     $timestamp = gmmktime(0, 0, 0, $time_parts['mon'], $time_parts['mday'], $time_parts['year']);
 
     if (db_result(db_query("SELECT COUNT(*) FROM {project_usage_raw} WHERE project_uri = '%s' AND timestamp = %d AND site_key = '%s'", $project_name, $timestamp, $site_key))) {
-      db_query("UPDATE {project_usage_raw} SET api_version = '%s', project_version = '%s' WHERE project_uri = '%s' AND timestamp = %d AND site_key = '%s'", $api_version, $project_version, $project_name, $timestamp, $site_key);
+      db_query("UPDATE {project_usage_raw} SET api_version = '%s', project_version = '%s', hostname = '%s' WHERE project_uri = '%s' AND timestamp = %d AND site_key = '%s'", $api_version, $project_version, $hostname, $project_name, $timestamp, $site_key);
     }
     else {
-      db_query("INSERT INTO {project_usage_raw} (project_uri, timestamp, site_key, api_version, project_version) VALUES ('%s', %d, '%s', '%s', '%s')", $project_name, $timestamp, $site_key, $api_version, $project_version);
+      db_query("INSERT INTO {project_usage_raw} (project_uri, timestamp, site_key, api_version, project_version, hostname) VALUES ('%s', %d, '%s', '%s', '%s', '%s')", $project_name, $timestamp, $site_key, $api_version, $project_version, $hostname);
     }
   }
 }
Index: usage/project_usage.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project_usage.install,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 project_usage.install
--- usage/project_usage.install	14 Sep 2007 16:17:55 -0000	1.3
+++ usage/project_usage.install	2 Oct 2007 15:59:13 -0000
@@ -15,6 +15,7 @@ function project_usage_install() {
           pid int unsigned NOT NULL default '0',
           nid int unsigned NOT NULL default '0',
           tid int unsigned NOT NULL default '0',
+          hostname varchar(128) NOT NULL default '',
           PRIMARY KEY (timestamp, project_uri, site_key)
         ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
       db_query("CREATE TABLE IF NOT EXISTS {project_usage_day} (
@@ -23,6 +24,7 @@ function project_usage_install() {
           pid int unsigned NOT NULL default '0',
           nid int unsigned NOT NULL default '0',
           tid int unsigned NOT NULL default '0',
+          hostname varchar(128) NOT NULL default '',
           PRIMARY KEY (timestamp, site_key, pid)
         ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
       db_query("CREATE TABLE IF NOT EXISTS {project_usage_week_project} (
@@ -99,3 +101,18 @@ function project_usage_update_5000() {
 
   return $ret;
 }
+
+/**
+ * Add a hostname field to {project_usage_raw} and {project_usage_day}.
+ */
+function project_usage_update_5001() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("ALTER TABLE {project_usage_raw} ADD COLUMN hostname varchar(128) NOT NULL default '' AFTER tid");
+      $ret[] = update_sql("ALTER TABLE {project_usage_day} ADD COLUMN hostname varchar(128) NOT NULL default '' AFTER tid");
+      break;
+  }
+  return $ret;
+}
Index: usage/project_usage.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project_usage.module,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 project_usage.module
--- usage/project_usage.module	14 Sep 2007 16:17:55 -0000	1.6
+++ usage/project_usage.module	2 Oct 2007 15:57:00 -0000
@@ -147,7 +147,7 @@ function project_usage_process_daily() {
 
   // Move usage records with project node IDs into the daily table and remove
   // the rest.
-  db_query("INSERT INTO {project_usage_day} (timestamp, site_key, pid, nid, tid) SELECT timestamp, site_key, pid, nid, tid FROM {project_usage_raw} WHERE timestamp < %d AND pid <> 0", $timestamp);
+  db_query("INSERT INTO {project_usage_day} (timestamp, site_key, pid, nid, tid, hostname) SELECT timestamp, site_key, pid, nid, tid, hostname FROM {project_usage_raw} WHERE timestamp < %d AND pid <> 0", $timestamp);
   db_query("DELETE FROM {project_usage_raw} WHERE timestamp < %d", $timestamp);
   watchdog('project_usage', t('Moved usage from raw to daily.'));
 
