| 1 |
<?php
|
| 2 |
// $Id: project.install,v 1.26 2009/08/03 18:25:14 dww Exp $
|
| 3 |
|
| 4 |
function project_install() {
|
| 5 |
// Create the database tables.
|
| 6 |
drupal_install_schema('project');
|
| 7 |
|
| 8 |
// Make this module heavier than the default module weight.
|
| 9 |
db_query("UPDATE {system} SET weight = %d WHERE name = 'project'", 2);
|
| 10 |
}
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_uninstall().
|
| 14 |
*/
|
| 15 |
function project_uninstall() {
|
| 16 |
// Drop database tables.
|
| 17 |
drupal_uninstall_schema('project');
|
| 18 |
|
| 19 |
$variables = array(
|
| 20 |
'project_vocabulary',
|
| 21 |
'project_search_block_help_text',
|
| 22 |
'project_enable_alias',
|
| 23 |
);
|
| 24 |
foreach ($variables as $variable) {
|
| 25 |
variable_del($variable);
|
| 26 |
}
|
| 27 |
}
|
| 28 |
|
| 29 |
/**
|
| 30 |
* Implementation of hook_schema().
|
| 31 |
*/
|
| 32 |
function project_schema() {
|
| 33 |
$schema['project_projects'] = array(
|
| 34 |
'description' => 'The base table for project_project nodes.',
|
| 35 |
'fields' => array(
|
| 36 |
'nid' => array(
|
| 37 |
'description' => 'Primary Key: The {node}.nid of the project_project node.',
|
| 38 |
'type' => 'int',
|
| 39 |
'unsigned' => TRUE,
|
| 40 |
'not null' => TRUE,
|
| 41 |
'default' => 0,
|
| 42 |
),
|
| 43 |
'uri' => array(
|
| 44 |
'description' => 'The short name of the project.',
|
| 45 |
'type' => 'varchar',
|
| 46 |
'length' => 50,
|
| 47 |
'not null' => TRUE,
|
| 48 |
'default' => '',
|
| 49 |
),
|
| 50 |
'homepage' => array(
|
| 51 |
'description' => "An external link to the project's homepage.",
|
| 52 |
'type' => 'varchar',
|
| 53 |
'length' => 255,
|
| 54 |
'not null' => TRUE,
|
| 55 |
'default' => '',
|
| 56 |
),
|
| 57 |
'changelog' => array(
|
| 58 |
'description' => 'An external link to a log of changes for the project.',
|
| 59 |
'type' => 'varchar',
|
| 60 |
'length' => 255,
|
| 61 |
'not null' => TRUE,
|
| 62 |
'default' => '',
|
| 63 |
),
|
| 64 |
'cvs' => array(
|
| 65 |
'description' => 'An external link to the CVS repository for the project.',
|
| 66 |
'type' => 'varchar',
|
| 67 |
'length' => 255,
|
| 68 |
'not null' => TRUE,
|
| 69 |
'default' => '',
|
| 70 |
),
|
| 71 |
'demo' => array(
|
| 72 |
'description' => 'An external link to a demonstration site for the project.',
|
| 73 |
'type' => 'varchar',
|
| 74 |
'length' => 255,
|
| 75 |
'not null' => TRUE,
|
| 76 |
'default' => '',
|
| 77 |
),
|
| 78 |
'documentation' => array(
|
| 79 |
'description' => 'An external link to documentation for the project.',
|
| 80 |
'type' => 'varchar',
|
| 81 |
'length' => 255,
|
| 82 |
'not null' => TRUE,
|
| 83 |
'default' => '',
|
| 84 |
),
|
| 85 |
'screenshots' => array(
|
| 86 |
'description' => 'An external link to screenshots of the project.',
|
| 87 |
'type' => 'varchar',
|
| 88 |
'length' => 255,
|
| 89 |
'not null' => TRUE,
|
| 90 |
'default' => '',
|
| 91 |
),
|
| 92 |
'license' => array(
|
| 93 |
'description' => 'An external link to the license of the project.',
|
| 94 |
'type' => 'varchar',
|
| 95 |
'length' => 255,
|
| 96 |
'not null' => TRUE,
|
| 97 |
'default' => '',
|
| 98 |
),
|
| 99 |
),
|
| 100 |
'primary key' => array('nid'),
|
| 101 |
'indexes' => array(
|
| 102 |
'project_projects_uri' => array(array('uri', 8)),
|
| 103 |
),
|
| 104 |
);
|
| 105 |
return $schema;
|
| 106 |
}
|
| 107 |
|
| 108 |
/**
|
| 109 |
* Delete variables that are no longer used in the Drupal 6 version of the module.
|
| 110 |
*/
|
| 111 |
function project_update_6000() {
|
| 112 |
$variables = array(
|
| 113 |
'project_browse_nodes',
|
| 114 |
'project_sort_method',
|
| 115 |
);
|
| 116 |
foreach ($variables as $variable) {
|
| 117 |
variable_del($variable);
|
| 118 |
}
|
| 119 |
|
| 120 |
$variables = db_query("SELECT name FROM {variable} WHERE name LIKE 'project_sort_method_used_%%'");
|
| 121 |
while ($variable = db_fetch_object($variables)) {
|
| 122 |
variable_del($variable->name);
|
| 123 |
}
|
| 124 |
return array();
|
| 125 |
}
|
| 126 |
|
| 127 |
/**
|
| 128 |
* Fix deltas for project blocks.
|
| 129 |
*/
|
| 130 |
function project_update_6001() {
|
| 131 |
$ret = array();
|
| 132 |
$ret[] = update_sql("UPDATE {blocks} SET delta = 'project_navigation_select' WHERE delta = '0' AND module = 'project'");
|
| 133 |
$ret[] = update_sql("UPDATE {blocks} SET delta = 'project_search' WHERE delta = '1' AND module = 'project'");
|
| 134 |
$ret[] = update_sql("UPDATE {blocks} SET delta = 'project_navigation_text' WHERE delta = '2' AND module = 'project'");
|
| 135 |
return $ret;
|
| 136 |
}
|
| 137 |
|