--- aggregation/aggregation.install	2008-03-26 00:46:43.000000000 -0400
+++ aggregation.install	2008-03-24 12:34:56.000000000 -0400
@@ -4,53 +4,7 @@
 
 function aggregation_install()
 {
-	switch ($GLOBALS['db_type'])
-	{
-		case 'mysqli':
-		case 'mysql':
-
-			$query = <<<begin_create_query
-				CREATE TABLE IF NOT EXISTS {aggregation_feed} (
-					`nid` int(10) unsigned NOT NULL,
-					`original_author` varchar(100) NOT NULL default '',
-					`url` varchar(250) NOT NULL,
-					`username` varchar(50) NOT NULL default '',
-					`password` varchar(50) NOT NULL default '',
-					`refresh_interval` int(10) unsigned NOT NULL,
-					`title_as_guid_interval` int(10) unsigned NOT NULL,
-					`promote_to_frontpage` int(10) NOT NULL default 0,
-					`time_to_live` int(10) NOT NULL default 0,
-					`item_categories` varchar(150) NOT NULL default '',
-					`aggregation_feed_options` text NOT NULL,
-					`etag` varchar(255) NOT NULL default '',
-					`last_modified` int(11) NOT NULL default 0,
-					`last_refreshed` int(11) NOT NULL default 0,
-					PRIMARY KEY  (`nid`)
-				) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
-begin_create_query;
-
-			db_query($query);
-
-			$query = <<<begin_create_query
-				CREATE TABLE IF NOT EXISTS {aggregation_item} (
-					`nid` int(10) unsigned NOT NULL,
-					`url` varchar(250) NOT NULL default '',
-					`aggregation_item_options` text NOT NULL,
-					`original_author` varchar(100) NOT NULL default '',
-					`original_comments` varchar(250) NOT NULL,
-					`story_guid` int unsigned NOT NULL default 0,
-					`fid` int(10) unsigned NOT NULL default 0,
-					`image_id` int(10) unsigned NOT NULL default 0,
-					`image_guid` int unsigned NOT NULL default 0,
-					PRIMARY KEY  (`nid`),
-					INDEX (`story_guid`),
-					INDEX (`image_id`),
-					INDEX (`fid`),
-					INDEX (`image_guid`)
-				) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
-begin_create_query;
-
-			db_query($query);
+  drupal_install_schema('aggregation');
 
 			$vocab_count = db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary} ".
 				"WHERE name = '%s'", 'Aggregation Feed Types');
@@ -105,12 +59,162 @@
 
 					taxonomy_save_term($term);
 				}
-			break;
-	}
 
 	aggregation_update_6();
 }
 
+function aggregation_schema() {
+  $schema['aggregation_feed'] = array(
+      'fields' => array(
+        'nid' => array(
+          'type' => 'int', 
+          'length' => 10,
+          'unsigned' => TRUE, 
+          'not null' => TRUE,
+          ),
+        'original_author' => array(
+          'type' => 'varchar', 
+          'length' => 100,
+          'not null'  => TRUE, 
+          'default' => '',
+          ),
+        'url' => array(
+          'type' => 'varchar', 
+          'length' => 250,
+          'not null' => TRUE,
+          ),
+        'username' => array(
+          'type' => 'varchar', 
+          'length' => 50,
+          'not null'  => TRUE, 
+          'default' => '',
+          ),
+        'password' => array(
+          'type' => 'varchar', 
+          'length' => 50,
+          'not null'  => TRUE, 
+          'default' => '',
+          ),
+        'refresh_interval' => array(
+            'type' => 'int', 
+            'length' => 10,
+            'unsigned' => TRUE, 
+            'not null' => TRUE,
+            ),
+        'title_as_guid_interval' => array(
+            'type' => 'int', 
+            'length' => 10,
+            'unsigned' => TRUE, 
+            'not null' => TRUE,
+            ),
+        'promote_to_frontpage' => array(
+            'type' => 'int', 
+            'length' => 10,
+            'not null'  => TRUE, 
+            'default' => 0,
+            ),
+        'time_to_live' => array(
+            'type' => 'int', 
+            'length' => 10,
+            'not null'  => TRUE, 
+            'default' => 0,
+            ),
+        'item_categories' => array(
+            'type' => 'varchar', 
+            'length' => 150,
+            'not null'  => TRUE, 
+            'default' => '',
+            ),
+        'aggregation_feed_options' => array(
+            'type' => 'text', 
+            'not null'  => TRUE,
+            ),
+        'etag' => array(
+            'type' => 'varchar', 
+            'length' => 255,
+            'not null'  => TRUE, 
+            'default' => '',
+            ),
+        'last_modified' => array(
+            'type' => 'int', 
+            'not null'  => TRUE, 
+            'default' => 0,
+            ),
+        'last_refreshed' => array(
+            'type' => 'int', 
+            'not null'  => TRUE, 
+            'default' => 0,
+            ),
+        ),
+      'primary key' => array('nid'),
+      );
+
+  $schema['aggregation_item'] = array(
+      'fields' => array(
+        'nid' => array(
+          'type' => 'int',
+          'length' => 10,
+          'unsigned' => TRUE,
+          'not null'  => TRUE),
+        'url' => array(
+          'type' => 'varchar', 
+          'length' => 250,
+          'not null'  => TRUE,
+          'default' => '',
+          ),
+        'aggregation_item_options' => array(
+          'type' => 'text',
+          'not null'  => TRUE),
+        'original_author' => array(
+          'type' => 'varchar', 
+          'length' => 100,
+          'not null'  => TRUE,
+          'default' => '',
+          ),
+        'original_comments' => array(
+          'type' => 'varchar', 
+          'length' => 250,
+          'not null'  => TRUE,
+          ),
+        'story_guid' => array(
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null'  => TRUE,
+          'default' => 0,
+          ),
+        'fid' => array(
+          'type' => 'int',
+          'length' => 10,
+          'unsigned' => TRUE,
+          'not null'  => TRUE,
+          'default' => 0,
+          ),
+        'image_id' => array(
+            'type' => 'int',
+            'length' => 10,
+            'unsigned' => TRUE,
+            'not null'  => TRUE,
+            'default' => 0,
+            ),
+        'image_guid' => array(
+            'type' => 'int',
+            'unsigned' => TRUE,
+            'not null'  => TRUE,
+            'default' => 0,
+            ),
+        ),
+      'primary key' => array('nid'),
+      'indexes' => array( 
+        'story_guid' => array('story_guid'),
+        'image_id' => array('image_id'),
+        'fid' => array('fid'),
+        'image_guid' => array('image_guid'),
+        ),
+      );
+  return $schema;
+}
+
+
 //update function for 4.7 branch
 function aggregation_update_1()
 {
@@ -230,8 +334,8 @@
 
 function aggregation_update_6()
 {
-    if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_feed') . "}'")) == 0) return;
-    if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_item') . "}'")) == 0) return;
+    if (! db_fetch_array(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_feed') . "}'"))) return;
+    if (! db_fetch_array(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_item') . "}'"))) return;
 
     if (!ini_get('safe_mode'))
 		set_time_limit(30 * 60);
@@ -399,8 +503,9 @@
 	if ($vocabulary_to_delete >= 0)
 		taxonomy_del_vocabulary($vocabulary_to_delete);
 
-	db_query("DROP TABLE {aggregation_item}");
-	db_query("DROP TABLE {aggregation_feed}");
+  drupal_uninstall_schema('aggregation_item');
+  drupal_uninstall_schema('aggregation_feed');
+
 	variable_del('aggregation_current_vid');
 	variable_del('aggregation_item_time_to_live');
 	variable_del('aggregation_enable_logging');
@@ -426,8 +531,8 @@
 	// Test PHP version
 	$requirements['PHP'] = array(
 		'title' => $t('PHP'),
-		'value' => ($phase == 'runtime') ? l(phpversion(), 'admin/logs/status/php') :
-			phpversion(),
+		'value' => ($phase == 'runtime') 
+      ? l(phpversion(), 'admin/reports/status/php') : phpversion(),
 	);
 
 	if (version_compare(phpversion(), '5.0.0') < 0)
@@ -453,7 +558,7 @@
 	$requirements['DRUPAL']['value'] = VERSION;
 
 	// Test drupal version support
-	if (strpos(VERSION, '5.') !== 0)
+	if (strpos(VERSION, '6.') !== 0)
 	{
 		$requirements['DRUPAL']['description'] = $t('Drupal version incompatible with this module.');
 		$requirements['DRUPAL']['severity'] = REQUIREMENT_ERROR;
