| 1 |
<?php
|
| 2 |
// $Id: tasks.install,v 1.6 2007/03/19 15:55:16 moonray Exp $
|
| 3 |
|
| 4 |
// Create the database table on install (MySQL only for now)
|
| 5 |
function tasks_install() {
|
| 6 |
if ($GLOBALS['db_type'] == 'mysqli' || $GLOBALS['db_type'] == 'mysql') {
|
| 7 |
drupal_set_message("Creating required tasks.module MySQL tables for first install");
|
| 8 |
db_query("CREATE TABLE {tasks} (
|
| 9 |
nid int(10) unsigned NOT NULL default '0',
|
| 10 |
task_parent int(10) unsigned NOT NULL default '0',
|
| 11 |
assigned_to int(10) unsigned NOT NULL default '0',
|
| 12 |
order_by float unsigned NOT NULL default '0',
|
| 13 |
completed date NOT NULL default '0000-00-00',
|
| 14 |
PRIMARY KEY (nid)
|
| 15 |
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
|
| 16 |
}
|
| 17 |
}
|
| 18 |
|
| 19 |
function tasks_uninstall() {
|
| 20 |
db_query('DROP TABLE {tasks}');
|
| 21 |
}
|
| 22 |
|
| 23 |
function tasks_update_1() {
|
| 24 |
$ret[] = update_sql("UPDATE {permission} SET perm = REPLACE(perm, 'edit own task', 'edit own tasks') WHERE perm LIKE '%edit own task%'");
|
| 25 |
$ret[] = update_sql("UPDATE {permission} SET perm = REPLACE(perm, 'create task', 'create tasks') WHERE perm LIKE '%create task%'");
|
| 26 |
return $ret;
|
| 27 |
}
|
| 28 |
|
| 29 |
function tasks_update_2() {
|
| 30 |
$items = array();
|
| 31 |
$items[] = update_sql("ALTER TABLE {tasks} CHANGE parent task_parent int(10) unsigned NOT NULL default '0'");
|
| 32 |
return $items;
|
| 33 |
}
|