Index: contributions/modules/quickstats/quickstats.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quickstats/quickstats.info,v
retrieving revision 1.2
diff -u -p -r1.2 quickstats.info
--- contributions/modules/quickstats/quickstats.info	18 Jun 2007 22:53:55 -0000	1.2
+++ contributions/modules/quickstats/quickstats.info	14 Sep 2008 15:24:33 -0000
@@ -1,6 +1,4 @@
 ; $Id: quickstats.info,v 1.2 2007/06/18 22:53:55 dww Exp $
 name = Quickstats
 description = A simple and efficient module to count node views
-
-; Information added by drupal.org packaging script on 2007-04-10
-project = "quickstats"
\ No newline at end of file
+core = 6.x
Index: contributions/modules/quickstats/quickstats.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quickstats/quickstats.install,v
retrieving revision 1.1
diff -u -p -r1.1 quickstats.install
--- contributions/modules/quickstats/quickstats.install	18 Apr 2007 04:37:07 -0000	1.1
+++ contributions/modules/quickstats/quickstats.install	14 Sep 2008 16:49:59 -0000
@@ -1,4 +1,35 @@
 <?php
+// $Id$
+/**
+ * @file
+ * Install/Uninstall the Quickstats module.
+ */
+
+/**
+ * Implementation of hook_schema().
+ */
+function quickstats_schema() {
+
+  $schema['quickstats_node_views'] = array(
+    'description' => t('The base table for Quickstats.'),
+    'fields' => array(
+      'insert_time' => array(
+        'description' => t('The timestamp of the insertation.'),
+        'type' => 'timestamp',
+        'not null' => TRUE,
+        'default' => CURRENT_TIMESTAMP,
+        'on update' => 'CURRENT_TIMESTAMP'),
+      'nid' => array(
+        'description' => t('The {node} identifier.'),
+        'type' => 'int',
+        'precision' => 11,
+        'not null' => TRUE,
+        'default' => '0')
+      )
+    );
+
+  return $schema;
+}
 
 /**
  * Implementation of hook_install().
@@ -8,13 +39,25 @@ function quickstats_install() {
   insert_time timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
   nid int(11) NOT NULL default '0'
   ) /*!40100 DEFAULT CHARACTER SET utf8 */");
-  db_query("ALTER TABLE {node} ADD quickstats_views INT NOT NULL default '0'");
+
+//  How to create timestamp fields?
+//  drupal_install_schema('quickstats');
+
+
+//  db_query("ALTER TABLE {node} ADD quickstats_views INT NOT NULL default '0'");
+  $ret = array();
+  db_add_field($ret, 'node', 'quickstats_views', array('type' => 'int', 'not null' => TRUE, 'default' => '0'));
 }
 
 /**
  * Implementation of hook_uninstall().
  */
 function quickstats_uninstall() {
-  db_query("DROP TABLE {quickstats_node_views}");
-  db_query("ALTER TABLE {node} DROP quickstats_views");
-}
\ No newline at end of file
+  drupal_uninstall_schema('quickstats');
+
+
+//  db_query("ALTER TABLE {node} DROP quickstats_views");
+  $ret = array();
+  db_drop_field($ret, 'node', 'quickstats_view');
+}
+
Index: contributions/modules/quickstats/quickstats.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/quickstats/quickstats.module,v
retrieving revision 1.5
diff -u -p -r1.5 quickstats.module
--- contributions/modules/quickstats/quickstats.module	21 Aug 2007 07:47:15 -0000	1.5
+++ contributions/modules/quickstats/quickstats.module	14 Sep 2008 15:26:15 -0000
@@ -1,6 +1,8 @@
 <?php
 // $Id: quickstats.module,v 1.5 2007/08/21 07:47:15 fireang3l Exp $
-
+/** @file
+ * Quickstats Module
+ */
 
 /**
  * Implementation of hook_init().
@@ -23,7 +25,7 @@ function quickstats_init() {
     if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
       drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
     }
-    
+
     $path = trim($_GET['q'], '/');
     if ($src = drupal_get_normal_path($path)) {
       $path = $src;
@@ -40,7 +42,7 @@ function quickstats_init() {
  * Implementation of hook_cron().
  */
 function quickstats_cron() {
-  if (db_fetch_array(db_query_range("SELECT nid FROM {quickstats_node_views} WHERE insert_time < (SELECT MAX(insert_time) FROM {quickstats_node_views})", 0, 1))) { 
+  if (db_fetch_array(db_query_range("SELECT nid FROM {quickstats_node_views} WHERE insert_time < (SELECT MAX(insert_time) FROM {quickstats_node_views})", 0, 1))) {
     db_query("SET @@group_concat_max_len=1024000");
     db_query("SET @timestamp=(SELECT MAX(insert_time) FROM {quickstats_node_views})");
     db_query("SET @ids=(SELECT GROUP_CONCAT(nid SEPARATOR ',') FROM {quickstats_node_views} WHERE insert_time < @timestamp)");
@@ -69,7 +71,7 @@ function quickstats_perm() {
 function quickstats_link($type, $node = NULL, $teaser = FALSE) {
   global $id;
   $links = array();
-  
+
   if ($type != 'comment' && user_access('view post access counter')) {
     $statistics = quickstats_get($node->nid);
     if ($statistics) {
@@ -83,11 +85,11 @@ function quickstats_link($type, $node = 
  * Feel free to comment out if you hacked node.module to correctly display page views
  */
 function quickstats_get($nid) {
-  
+
   if ($nid > 0) {
     $statistics = db_fetch_array(db_query('SELECT quickstats_views FROM {node} WHERE nid = %d', $nid));
   }
-  
+
   return $statistics;
 }
 
@@ -96,31 +98,31 @@ function quickstats_get($nid) {
  * Provides two 'most popular content' blocks for the past 7 and 30 days
  */
 function quickstats_block($op = 'list', $delta = 0, $edit = array()) {
-  
+
   switch ($op) {
   case 'list':
     $blocks[0]['info'] = t('Most popular nodes in the past 7 days');
     $blocks[1]['info'] = t('Most popular nodes in the past 30 days');
     return $blocks;
     break;
-    
+
   case 'view':
     $block = array();
-    
+
     switch ($delta) {
     case 0:
-      $result = db_query_range("SELECT nid, title, quickstats_views FROM node WHERE quickstats_views > 0 and DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= FROM_UNIXTIME(created) ORDER by quickstats_views DESC", 0, 5);
+      $result = db_query_range("SELECT nid, title, quickstats_views FROM {node} WHERE quickstats_views > 0 and DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= FROM_UNIXTIME(created) ORDER by quickstats_views DESC", 0, 5);
       $list = array();
       while ($item = db_fetch_array($result)) {
         $list[] = l($item['title'], 'node/'. $item['nid']);
       }
-      
+
       $block['subject'] = t('Most popular content - past 7 days');
       $block['content'] = theme('item_list', $list);
       break;
-      
+
     case 1:
-      $result = db_query_range("SELECT nid, title, quickstats_views FROM node WHERE quickstats_views > 0 and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= FROM_UNIXTIME(created) ORDER by quickstats_views DESC", 0, 5);
+      $result = db_query_range("SELECT nid, title, quickstats_views FROM {node} WHERE quickstats_views > 0 and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= FROM_UNIXTIME(created) ORDER by quickstats_views DESC", 0, 5);
       $list = array();
       while ($item = db_fetch_array($result)) {
         $list[] = l($item['title'], 'node/'. $item['nid']);
@@ -131,4 +133,4 @@ function quickstats_block($op = 'list', 
     }
     return $block;
   }
-}
\ No newline at end of file
+}
