/[drupal]/contributions/sandbox/pwolanin/test/outline.install
ViewVC logotype

Contents of /contributions/sandbox/pwolanin/test/outline.install

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


Revision 1.2 - (show annotations) (download) (as text)
Sat Mar 17 03:02:16 2007 UTC (2 years, 8 months ago) by pwolanin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -2 lines
File MIME type: text/x-php
update for 6.x menu system
1 <?php
2 // $Id: outline.install,v 1.1 2007/01/16 03:04:41 pwolanin Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function outline_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 db_query("CREATE TABLE {outline_hierarchy} (
12 nid int unsigned NOT NULL default '0',
13 outid int unsigned NOT NULL default '0',
14 parent int unsigned NOT NULL default '0',
15 weight smallint NOT NULL default '0',
16 child_type varchar(32) NOT NULL default '',
17 toc_depth smallint unsigned NOT NULL default '1',
18 PRIMARY KEY (nid),
19 KEY outid (outid),
20 KEY parent (parent),
21 KEY child_node_type (child_type(4))
22 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
23 break;
24 case 'pgsql':
25 db_query("CREATE TABLE {outline_hierarchy} (
26 nid int_unsigned NOT NULL default '0',
27 outid int_unsigned NOT NULL default '0',
28 parent int_unsigned NOT NULL default '0',
29 weight smallint NOT NULL default '0',
30 child_type varchar(32) NOT NULL default '',
31 toc_depth smallint_unsigned NOT NULL default '1',
32 PRIMARY KEY (nid)
33 ");
34 db_query("CREATE INDEX {outline_hierarchy}_outid_idx ON {outline} (outid)");
35 db_query("CREATE INDEX {outline_hierarchy}_parent_idx ON {outline} (parent)");
36 db_query("CREATE INDEX {outline_hierarchy}_child_type_idx ON {outline} (substr (child_type, 1, 4))");
37 break;
38 }
39
40 // Insert default user-defined node type into the database.
41 $type = array(
42 'type' => 'book',
43 'name' => t('Book page'),
44 'module' => 'node',
45 'description' => t('A simple type like page for use as the default type in outlines.'),
46 'custom' => TRUE,
47 'modified' => TRUE,
48 'locked' => TRUE,
49 );
50
51 $type = (object) _node_type_set_defaults($type);
52 node_type_save($type);
53 variable_set('node_options_book', array('status', 'revision'));
54
55 cache_clear_all();
56 system_modules();
57 menu_rebuild();
58 node_types_rebuild();
59 }
60
61
62 /**
63 * Implementation of hook_uninstall().
64 */
65 function outline_uninstall() {
66 db_query('DROP TABLE {outline_hierarchy}');
67 }

  ViewVC Help
Powered by ViewVC 1.1.2