mkdru.removeLimits() no longer leaves dangling limit_subject
[mkdru-moved-to-drupal.org.git] / mkdru.install
1 <?php
2 // $Id$
3 /**
4  * @file
5  * Install, update and uninstall functions.
6  */
7
8 /**
9 * Implements hook_schema().
10 */
11 function mkdru_schema() {
12   $schema['mkdru'] = array(
13     'description' => t('Stores settings for mkdru nodes.'),
14     'fields' => array(
15       'nid' => array(
16         'description' => t('The primary identifier for a node.'),
17         'type' => 'int',
18         'unsigned' => TRUE,
19         'not null' => TRUE,
20         'default' => 0
21        ),
22       'vid' => array(
23         'description' => t('The current {node_revisions}.vid version identifier.'),
24         'type' => 'int',
25         'unsigned' => TRUE,
26         'not null' => TRUE,
27         'default' => 0
28       ),
29       'pz2_path' => array(
30         'type' => 'text',
31         'not null' => TRUE,
32         'description' => t('Path to Pazpar2 or Service Proxy.')
33       ),
34       'use_sessions' => array(
35         'description' => t('Session handling toggle.'),
36         'type' => 'int',
37         'unsigned' => TRUE,
38         'not null' => TRUE,
39       ),
40       'source_max' => array(
41         'description' => t('Number of sources to display'),
42         'type' => 'int',
43         'unsigned' => TRUE,
44         'not null' => TRUE,
45       ),
46       'author_max' => array(
47         'description' => t('Number of authors to display'),
48         'type' => 'int',
49         'unsigned' => TRUE,
50         'not null' => TRUE,
51       ),
52       'subject_max' => array(
53         'description' => t('Number of subjects to display'),
54         'type' => 'int',
55         'unsigned' => TRUE,
56         'not null' => TRUE,
57       ),
58       'sp_user' => array(
59         'type' => 'text',
60         'not null' => FALSE,
61         'description' => t('Service Proxy username')
62       ),
63       'sp_pass' => array(
64         'type' => 'text',
65         'not null' => FALSE,
66         'description' => t('Service Proxy password')
67       ),
68     ),
69     'primary key' => array('nid', 'vid'),
70     'unique keys' => array('vid' => array('vid')),
71     'indexes' => array('nid' => array('nid')),
72   );
73   return $schema;
74 }
75
76 /**
77 * Implements hook_install().
78 */
79 function mkdru_install() {
80   // Disable comments by default
81   variable_set('comment_mkdru', COMMENT_NODE_DISABLED);
82   // Create table.
83   drupal_install_schema('mkdru');
84 }
85
86 /**
87 * Implements hook_uninstall().
88 */
89 function mkdru_uninstall() {
90   // Drop table.
91   drupal_uninstall_schema('mkdru');
92   // Delete variables
93   variable_del('pz2_js_path');
94 }
95
96 function mkdru_update_6100() {
97   $ret = array();
98   db_add_field($ret, 'mkdru', 'sp_user', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE, 'default' => '') );
99   db_add_field($ret, 'mkdru', 'sp_pass', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE, 'default' => '') );
100   return $ret;
101 }