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

Contents of /contributions/modules/custom_pagers/custom_pagers.install

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


Revision 1.3 - (show annotations) (download) (as text)
Tue Jun 17 20:47:05 2008 UTC (17 months, 1 week ago) by eaton
Branch: MAIN
CVS Tags: DRUPAL-6--1-10-BETA1, HEAD
Branch point for: DRUPAL-6--1, DRUPAL-6--2
Changes since 1.2: +107 -21 lines
File MIME type: text/x-php
Initial port to Drupal 6. Views handling code will need to be made more efficient, but it works for now.
1 <?php
2 // $Id: custom_pagers.install,v 1.2.4.5 2007/11/06 10:54:55 eaton Exp $
3
4 /**
5 * Implementation of hook_install().
6 */
7 function custom_pagers_install() {
8 drupal_install_schema('custom_pagers');
9 }
10
11 function custom_pagers_schema() {
12 $schema['custom_pager'] = array(
13 'description' => t('Stores data for previous/next pagers to be added to nodes.'),
14 'fields' => array(
15 'pid' => array(
16 'type' => 'serial',
17 'unsigned' => TRUE,
18 'not null' => TRUE,
19 'description' => t('Unique identifier for the {custom_pager}.'),
20 ),
21 'title' => array(
22 'type' => 'varchar',
23 'length' => 255,
24 'not null' => TRUE,
25 'default' => '',
26 'description' => t("The visible title of the {custom_pager}.")
27 ),
28 'list_php' => array(
29 'type' => 'text',
30 'not null' => FALSE,
31 'size' => 'big',
32 'description' => t('Raw PHP to populate this {custom_pager}.'),
33 ),
34 'view' => array(
35 'type' => 'varchar',
36 'length' => 255,
37 'not null' => TRUE,
38 'default' => '',
39 'description' => t("The name of the view used for this {custom_pager}.")
40 ),
41 'args' => array(
42 'type' => 'varchar',
43 'length' => 255,
44 'not null' => TRUE,
45 'default' => '',
46 'description' => t("A serialized array of arguments for the {custom_pager}'s view.")
47 ),
48 'position' => array(
49 'type' => 'varchar',
50 'length' => 16,
51 'not null' => TRUE,
52 'default' => '',
53 'description' => t("The position where this {custom_pager} should be displayed.")
54 ),
55 'visibility_php' => array(
56 'type' => 'text',
57 'not null' => FALSE,
58 'size' => 'big',
59 'description' => t('Raw PHP to determine when the {custom_pager} should be displayed.'),
60 ),
61 'node_type' => array(
62 'type' => 'varchar',
63 'length' => 255,
64 'not null' => TRUE,
65 'default' => '',
66 'description' => t("A specific node type this {custom_pager} should be displayed with.")
67 ),
68 'reverse_list' => array(
69 'type' => 'int',
70 'not null' => TRUE,
71 'default' => 0,
72 'size' => 'tiny',
73 'description' => t("A boolean flag indicating that this {custom_pager} should be displayed in reverse order.")
74 ),
75 'cache_list' => array(
76 'type' => 'int',
77 'not null' => TRUE,
78 'default' => 0,
79 'size' => 'tiny',
80 'description' => t("A boolean flag indicating that this {custom_pager}'s list of nodes should be cached.")
81 ),
82 ),
83 'primary key' => array('pid'),
84 );
85 return $schema;
86 }
87
88
89 function custom_pagers_update_1() {
90 $ret = array();
91 switch ($GLOBALS['db_type']) {
92 case 'mysql':
93 case 'mysqli':
94 $ret[] = update_sql("ALTER TABLE {custom_pager} ADD list_php text");
95 $ret[] = update_sql("ALTER TABLE {custom_pager} ADD visibility_php text");
96 break;
97 case 'pgsql':
98 db_add_column($ret, 'custom_pager', 'list_php', 'text', array('default' => ''));
99 db_add_column($ret, 'custom_pager', 'visibility_php', 'text', array('default' => ''));
100 break;
101 }
102 return $ret;
103 }
104
105 function custom_pagers_update_2() {
106 $ret = array();
107 switch ($GLOBALS['db_type']) {
108 case 'mysql':
109 case 'mysqli':
110 $ret[] = update_sql("ALTER TABLE {custom_pager} ADD cache_list tinyint NOT NULL default 0");
111 $ret[] = update_sql("ALTER TABLE {custom_pager} ADD reverse_list tinyint NOT NULL default 0");
112 break;
113 case 'pgsql':
114 db_add_column($ret, 'custom_pager', 'cache_list', 'smallint', array('not null' => TRUE, 'default' => 0));
115 db_add_column($ret, 'custom_pager', 'reverse_list', 'smallint', array('not null' => TRUE, 'default' => 0));
116 break;
117 }
118 return $ret;
119 }
120
121 function custom_pagers_uninstall() {
122 drupal_uninstall_schema('custom_pagers');
123 }

  ViewVC Help
Powered by ViewVC 1.1.2