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

Contents of /contributions/modules/taxonomy_timer/taxonomy_timer.install

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


Revision 1.5 - (show annotations) (download) (as text)
Tue Aug 26 01:00:23 2008 UTC (15 months ago) by suydam
Branch: MAIN
CVS Tags: DRUPAL-5--1-9, DRUPAL-5--1-8, DRUPAL-6--1-0-ALPHA1, DRUPAL-6--1-0-BETA1, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.4: +1 -1 lines
File MIME type: text/x-php
Updated installer.  Removed some extra watchdogging
1 <?php
2 function taxonomy_timer_install() {
3 drupal_set_message( t('Installing taxonomy_timer.module...') );
4 watchdog("taxonomy_timer","Intalling taxonomy_timer.module...");
5 switch ( $GLOBALS['db_type'] ) {
6 case 'mysql':
7 case 'mysqli':
8 watchdog("taxonomy_timer","DB Type = Mysql(i?)");
9 db_query("
10 CREATE TABLE {taxonomy_timer_nodes} (
11 ttid int(10) unsigned NOT NULL auto_increment,
12 nid int(10) unsigned NOT NULL default '0',
13 tid int(10) unsigned NOT NULL default '0',
14 tt_assigned int(11) unsigned NOT NULL default '0',
15 tt_expiration int(11) unsigned NOT NULL default '0',
16 tt_next_tid int(10) unsigned NOT NULL default '0',
17 tt_unpublish tinyint(3) unsigned NOT NULL default '0',
18 completed tinyint(3) unsigned NOT NULL default '0',
19 PRIMARY KEY (ttid)
20 )"
21 ) or drupal_set_message("FAILURE on create tt nodes table",'error');
22 db_query("
23 CREATE TABLE {taxonomy_timer_defaults} (
24 ttid int(10) unsigned NOT NULL auto_increment,
25 tid int(10) unsigned NOT NULL default '0',
26 tt_duration int(10) NOT NULL default '0',
27 tt_next_tid int(10) unsigned NOT NULL default '0',
28 tt_unpublish tinyint(3) unsigned NOT NULL default '0',
29 tt_type varchar(32) NOT NULL default 'story',
30 PRIMARY KEY (ttid)
31 )"
32 ) or drupal_set_message("FAILURE on create tt defaults table",'error');
33 watchdog("taxonomy_timer","SUCCESS!");
34 $success = TRUE;
35 break;
36 default:
37 drupal_set_message( t('Unsupported database for taxonomy_timer.module during install routine'),'error');
38 }
39 if ( $success ) {
40 drupal_set_message( t('taxonomy_timer.module installed successfully...<OL><LI>Grant yourself access control for the modules functions at ' . l('admin/user/access','admin/user/access') . '<LI>Then visit ' . l('admin/settings/taxonomy_timer','admin/settings/taxonomy_timer') . ' to continue configuration.</ol>' ) );
41 }
42 else {
43 drupal_set_message( t('taxonomy_timer.module failed install'),'error' );
44 }
45 }
46
47
48 function taxonomy_timer_update_2() {
49 $items = array();
50
51 // add the new field
52 $items[] = update_sql("ALTER TABLE {taxonomy_timer_nodes} ADD notified tinyint(3) UNSIGNED not null DEFAULT '0'");
53
54 // failsafe completed timers to notified=1
55 $items[] = update_sql("UPDATE {taxonomy_timer_nodes} SET notified = 1 WHERE completed=1");
56
57 return $items;
58 }
59 ?>

  ViewVC Help
Powered by ViewVC 1.1.2