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

Contents of /contributions/modules/archiver/archiver.install

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


Revision 1.1 - (show annotations) (download) (as text)
Sun Apr 1 19:52:47 2007 UTC (2 years, 7 months ago) by lafo
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
File MIME type: text/x-php
Initial release for Drupal 5.1
1 <?php
2 // $Id$
3 /**
4 * Archiver installer
5 **/
6 function archiver_install() {
7 if(!db_table_exists('{archiver}')) {
8
9 switch ($GLOBALS['db_type']) {
10 case 'mysql':
11 case 'mysqli':
12 // the {tablename} syntax is so multisite installs can add a
13 // prefix to the table name as set in the settings.php file
14 echo "installing archiver";
15 db_query("CREATE TABLE {archiver} (`nid` INT( 11 ) NOT NULL, `created_on` INT(11) NOT NULL , PRIMARY KEY ( `nid` ))");
16 break;
17
18 case 'pgsql':
19 db_query("CREATE TABLE {archiver} (`nid` INT( 11 ) NOT NULL, `created_on` INT(11) NOT NULL )");
20 db_query("ALTER TABLE {archiver} ADD PRIMARY KEY ( `nid` )");
21 // Pgsql requires keys and indexes to be defined separately.
22 // It's important to name the index as {tablename}_fieldname_idx
23 // (the trailing _idx!) so update scripts can be written easily
24 /*db_query("CREATE INDEX {node_field_nodereference_data}_field_name_idx
25 ON {my_table} (field_name)");*/
26 break;
27 }
28 }
29
30 }
31
32 /**
33 * Implementation of hook_uninstall().
34 */
35 function archiver_uninstall() {
36 if(db_table_exists('{archiver}')) {
37 db_query('DROP TABLE {archiver}');
38 }
39 variable_del('archiver_node_types');
40 variable_del('archiver_max_title_length');
41 variable_del('archiver_listed_info');
42 variable_del('archiver_max_nodes_per_page');
43 variable_del('archiver_displayed_details');
44 variable_del('archiver_date_format');
45 variable_del('archiver_remove_from_frontpage');
46 variable_del('archiver_remove_from_categories');
47 }
48 ?>

  ViewVC Help
Powered by ViewVC 1.1.2