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

Contents of /contributions/modules/tasks_advanced/tasks_advanced.install

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


Revision 1.7 - (show annotations) (download) (as text)
Thu Apr 3 17:11:07 2008 UTC (19 months, 3 weeks ago) by moonray
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, HEAD
Changes since 1.6: +4 -4 lines
File MIME type: text/x-php
#147225 by tom friedhof, arif_mandra, AgnesCB: Update tasklist_advanced to match tasklist updates.
1 <?php
2 // $Id: tasks_advanced.install,v 1.6 2007/03/16 18:12:28 moonray Exp $
3
4 /**
5 * @file tasks_advanced.install
6 *
7 * install and update hooks for tasks_advanced module
8 */
9
10 /**
11 * Implementation of hook_install()
12 */
13 function tasks_advanced_install() {
14 switch ($GLOBALS['db_type']) {
15 case 'mysql':
16 case 'mysqli':
17 drupal_set_message("Creating required tasks_advanced.module MySQL tables for first install.");
18 db_query("CREATE TABLE {tasks_advanced} (
19 nid int(10) unsigned NOT NULL default '0',
20 taskcategory varchar(255) NOT NULL default 'unknown',
21 tasktype varchar(255) NOT NULL default 'action',
22 task_tree_left int(10) unsigned NOT NULL default '0',
23 task_tree_right int(10) unsigned NOT NULL default '0',
24 task_tree_depth int(10) unsigned NOT NULL default '0',
25 PRIMARY KEY (nid)
26 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
27 break;
28
29 case 'pgsql':
30 break;
31 }
32
33 // let's make sure that there's an entry in {tasks_advanced} for each existing entry in {tasks}
34 // need to make sure all parents are turned into projects
35 db_query("INSERT INTO {tasks_advanced} (nid, taskcategory, tasktype)
36 SELECT t.nid, 'unknown', IF(t.nid IN (SELECT task_parent FROM {tasks}), 'project', 'action')
37 FROM {tasks} t
38 LEFT JOIN {tasks_advanced} a ON t.nid = a.nid
39 WHERE ISNULL(a.nid)");
40
41 // mark the master tasklist as a project
42 db_query("UPDATE {tasks_advanced} SET tasktype = 'project' WHERE nid = (SELECT nid FROM {tasks} WHERE task_parent = 0)");
43
44 // build the tree structure
45 include_once(drupal_get_path('module', 'tasks_advanced'). '/tasks_advanced.module');
46 tasks_advanced_rebuild_tree(0, 0, -1);
47 }
48
49 /**
50 * Implementation of hook_uninstall()
51 */
52 function tasks_advanced_uninstall() {
53 db_query('DROP TABLE {tasks_advanced}');
54 }
55
56 function tasks_advanced_update_1() {
57 $ret[] = update_sql("ALTER TABLE {tasks_advanced} ADD COLUMN task_tree_left int(10) unsigned NOT NULL default '0', ADD COLUMN task_tree_right int(10) unsigned NOT NULL default '0', ADD COLUMN task_tree_depth int(10) unsigned NOT NULL default '0'");
58
59 // build the tree structure
60 include_once 'tasks_advanced.module';
61 tasks_advanced_rebuild_tree(0, 0, -1);
62
63 return $ret;
64 }

  ViewVC Help
Powered by ViewVC 1.1.2