? _project.module_
? test.patch
? usage/_project_usage.install_
? usage/_project_usage.module_
? usage/project_usage.css
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.7
diff -u -p -u -p -r1.7 project-release-serve-history.php
--- release/project-release-serve-history.php	22 Aug 2007 16:30:52 -0000	1.7
+++ release/project-release-serve-history.php	5 Sep 2007 23:30:06 -0000
@@ -101,8 +101,8 @@ if (isset($_GET['site_key'])) {
 
     // Compute a timestamp for the begining of the day.
     $time_parts = getdate();
-    $timestamp = mktime(0, 0, 0, $time_parts['mon'], $time_parts['mday'], $time_parts['year']);
-
+    $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);
     }
Index: usage/project_usage.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project_usage.install,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 project_usage.install
--- usage/project_usage.install	22 Aug 2007 16:30:52 -0000	1.2
+++ usage/project_usage.install	5 Sep 2007 23:37:57 -0000
@@ -66,3 +66,50 @@ function project_usage_uninstall() {
     variable_del($variable);
   }
 }
+
+/**
+ * Use GMT timestamps for daily tables.
+ */
+function project_usage_update_5000() {
+  $ret = array();
+
+  // Fix the timestamps on daily tables.
+  $day_tables = array(
+    'project_usage_raw',
+    'project_usage_day',
+  );
+  foreach ($day_tables as $table) {
+    $query = db_query("SELECT DISTINCT timestamp FROM {$table}");
+    while ($row = db_fetch_object($query)) {
+      $old = (int) $row->timestamp;
+      $time_parts = getdate($old);
+      // Compute a timestamp for the begining of the day.
+      $new = (int) gmmktime(0, 0, 0, $time_parts['mon'], $time_parts['mday'] - $time_parts['wday'], $time_parts['year']);
+      $ret[] = update_sql("UPDATE {$table} SET timestamp = $new WHERE timestamp = $old");
+    }
+  }
+
+  return $ret;
+}
+  
+/**
+ * Use GMT timestamps for weekly tables.
+ */
+function project_usage_update_5001() {
+  $week_tables = array(
+    'project_usage_week_project',
+    'project_usage_week_release',
+  );
+  foreach ($week_tables as $table) {
+    $query = db_query("SELECT DISTINCT timestamp FROM {$table}");
+    while ($row = db_fetch_object($query)) {
+      $old = (int) $row->timestamp;
+      $time_parts = getdate($old);
+      // Compute a timestamp for the begining of the week.
+      $new = (int) gmmktime(0, 0, 0, $time_parts['mon'], $time_parts['mday'], $time_parts['year']);
+      $ret[] = update_sql("UPDATE {$table} SET timestamp = $new WHERE timestamp = $old");
+    }
+  }
+
+  return $ret;
+}
Index: usage/project_usage.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project_usage.module,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 project_usage.module
--- usage/project_usage.module	22 Aug 2007 16:30:52 -0000	1.5
+++ usage/project_usage.module	5 Sep 2007 23:07:20 -0000
@@ -119,7 +119,7 @@ function project_usage_cron() {
 function project_usage_process_daily() {
   // Timestamp for begining of the previous day.
   $d = getdate(isset($timestamp) ? $timestamp : time());
-  $timestamp = mktime(0, 0, 0, $d['mon'], $d['mday'] - 1, $d['year']);
+  $timestamp = gmmktime(0, 0, 0, $d['mon'], $d['mday'] - 1, $d['year']);
 
   watchdog('project_usage', t('Starting to process daily usage data for @date.', array('@date' => format_date($timestamp))));
 
@@ -217,13 +217,13 @@ function project_usage_get_weeks_since($
 
   // Compute the start of the current week so we know when to stop.
   $d = getdate();
-  $this_week = mktime(0, 0, 0, $d['mon'], $d['mday'] - $d['wday'], $d['year']);
+  $this_week = gmmktime(0, 0, 0, $d['mon'], $d['mday'] - $d['wday'], $d['year']);
 
   // Then compute all the weeks before that.
   $d = getdate($timestamp);
   $i = 0;
   do {
-    $times[$i] = mktime(0, 0, 0, $d['mon'], $d['mday'] - $d['wday'] + (7 * $i), $d['year']);
+    $times[$i] = gmmktime(0, 0, 0, $d['mon'], $d['mday'] - $d['wday'] + (7 * $i), $d['year']);
   } while ($times[$i++] < $this_week);
 
   return $times;
