Drop mkdruFacetLimit, extend args for mkdruFacet
[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' => 'Stores settings for mkdru nodes.',
14     'fields' => array(
15       'nid' => array(
16         'description' => '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' => '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' => 'Path to Pazpar2 or Service Proxy.',
33       ),
34       'use_sessions' => array(
35         'description' => 'Session handling toggle.',
36         'type' => 'int',
37         'unsigned' => TRUE,
38         'not null' => TRUE,
39       ),
40       'source_max' => array(
41         'description' => 'Number of sources to display',
42         'type' => 'int',
43         'unsigned' => TRUE,
44         'not null' => TRUE,
45       ),
46       'author_max' => array(
47         'description' => 'Number of authors to display',
48         'type' => 'int',
49         'unsigned' => TRUE,
50         'not null' => TRUE,
51       ),
52       'subject_max' => array(
53         'description' => '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' => 'Service Proxy username'
62       ),
63       'sp_pass' => array(
64         'type' => 'text',
65         'not null' => FALSE,
66         'description' => '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_HIDDEN);
82   // Facets
83   $facets = array('source', 'subject', 'author');
84   variable_set('mkdru_facets', $facets);
85   // Restrict facet block visibility
86   foreach ($facets as $facet) {
87     db_insert('block_node_type')
88     ->fields(array(
89       'module' => 'mkdru',
90       'delta' => 'mkdru_facet_' . $facet,
91       'type' => 'mkdru'))->execute();
92   }
93 }
94
95 /**
96 * Implements hook_uninstall().
97 */
98 function mkdru_uninstall() {
99   // Delete variables
100   variable_del('pz2_js_path');
101   // Clear block visibility
102   db_delete('block_node_type')->condition('module', 'mkdru')->execute();
103 }