/[drupal]/contributions/modules/update_status_aggregator/update_status_aggregator.install
ViewVC logotype

Contents of /contributions/modules/update_status_aggregator/update_status_aggregator.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Tue Mar 25 18:49:13 2008 UTC (20 months ago) by yrocq
Branch: MAIN
CVS Tags: DRUPAL-5--1-0-RC2, DRUPAL-5--1-1, DRUPAL-5--1-0, DRUPAL-5--1-2, HEAD
Branch point for: DRUPAL-5--2, DRUPAL-5
Changes since 1.5: +3 -1 lines
File MIME type: text/x-php
Sites are no more promoted on front page by default
1 <?php
2 // $Id: update_status_aggregator.install,v 1.5 2008/03/25 18:46:18 yrocq Exp $
3 /**
4 * Implementation of hook_install().
5 */
6 function update_status_aggregator_install() {
7 switch ($GLOBALS['db_type']) {
8 case 'mysql':
9 case 'mysqli':
10 db_query("CREATE TABLE {update_status_aggregator} (
11 nid int unsigned NOT NULL default '0',
12 vid int unsigned NOT NULL default '0',
13 module text NOT NULL,
14 site INT UNSIGNED NOT NULL,
15 status int unsigned NOT NULL default '0',
16 PRIMARY KEY (nid,vid),
17 UNIQUE KEY vid (vid),
18 KEY nid (nid)
19 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
20 db_query("CREATE TABLE {update_status_aggregator_keys} (
21 nid int unsigned NOT NULL default '0',
22 vid int unsigned NOT NULL default '0',
23 drupal_key varchar(32),
24 PRIMARY KEY (nid,vid),
25 UNIQUE KEY vid (vid),
26 KEY nid (nid)
27 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
28 break;
29 case 'pgsql':
30 db_query("CREATE TABLE {update_status_aggregator} (
31 nid int unsigned NOT NULL default '0',
32 vid int unsigned NOT NULL default '0',
33 module text NOT NULL,
34 site INT UNSIGNED NOT NULL,
35 status int unsigned NOT NULL default '0',
36 PRIMARY KEY (nid,vid),
37 UNIQUE KEY vid (vid),
38 KEY nid (nid)
39 )");
40 db_query("CREATE TABLE {update_status_aggregator_keys} (
41 nid int unsigned NOT NULL default '0',
42 vid int unsigned NOT NULL default '0',
43 drupal_key varchar(32),
44 PRIMARY KEY (nid,vid),
45 UNIQUE KEY vid (vid),
46 KEY nid (nid)
47 )");
48 break;
49 }
50
51 variable_set('node_options_update_status_aggregator_site', array('status'));
52 }
53
54 function update_status_aggregator_update_1()
55 {
56 $items = array();
57
58 $items[] = update_sql("ALTER TABLE {update_status_aggregator} CHANGE site site INT UNSIGNED NOT NULL");
59 $items[] = update_sql("TRUNCATE TABLE {update_status_aggregator}");
60
61
62 return $items;
63 }
64
65 function update_status_aggregator_update_2()
66 {
67 $items = array();
68
69 $items[] = update_sql("TRUNCATE TABLE {update_status_aggregator}");
70 $items[] = update_sql("DELETE FROM node WHERE type='update_status_aggregator_module'");
71
72 return $items;
73 }
74
75 /**
76 * Implementation of hook_uninstall().
77 */
78 function update_status_aggregator_uninstall() {
79 db_query('DROP TABLE {update_status_aggregator}');
80 db_query('DROP TABLE {update_status_aggregator_keys}');
81 db_query('DELETE FROM node WHERE type="update_status_aggregator_module" OR type="update_status_aggregator_site"');
82 }

  ViewVC Help
Powered by ViewVC 1.1.2