Minor cleanup.
[mkdru-moved-to-drupal.org.git] / mkdru.install
1 <?php
2 /**
3  * @file
4  * Install, update and uninstall functions.
5  */
6
7 /**
8 * Implements hook_schema().
9 */
10 function mkdru_schema() {
11   $schema['mkdru'] = array(
12     'description' => t('Stores settings for mkdru nodes.'),
13     'fields' => array(
14       'nid' => array(
15         'description' => t('The primary identifier for a node.'),
16         'type' => 'int',
17         'unsigned' => TRUE,
18         'not null' => TRUE,
19         'default' => 0
20        ),
21       'vid' => array(
22         'description' => t('The current {node_revisions}.vid version identifier.'),
23         'type' => 'int',
24         'unsigned' => TRUE,
25         'not null' => TRUE,
26         'default' => 0
27       ),
28       'settings' => array(
29         'type' => 'text',
30         'not null' => TRUE,
31         'description' => 'Metasearch settings',
32       ),
33     ),
34     'primary key' => array('nid', 'vid'),
35     'unique keys' => array('vid' => array('vid')),
36     'indexes' => array('nid' => array('nid')),
37   );
38   return $schema;
39 }
40
41 /**
42 * Implements hook_install().
43 */
44 function mkdru_install() {
45   // Disable comments by default
46   variable_set('comment_mkdru', COMMENT_NODE_DISABLED);
47   // Create table.
48   drupal_install_schema('mkdru');
49   // Default settings
50   $settings['pz2_path'] = "/pazpar2/search.pz2";
51   $settings['use_sessions'] = 1;
52   $settings['sp']['user'] = "";
53   $settings['sp']['pass'] = "";
54   $settings['facets']['source']['displayName'] = "Source";
55   $settings['facets']['source']['pz2Name'] = "xtargets";
56   $settings['facets']['source']['limiter'] = NULL;
57   $settings['facets']['source']['multiLimit'] = NULL;
58   $settings['facets']['source']['max'] = 10;
59   $settings['facets']['source']['orderWeight'] = 1;
60   $settings['facets']['subject']['displayName'] = "Subject";
61   $settings['facets']['subject']['pz2Name'] = "subject";
62   $settings['facets']['subject']['limiter'] = "su";
63   $settings['facets']['subject']['multiLimit'] = 1;
64   $settings['facets']['subject']['max'] = 10;
65   $settings['facets']['subject']['orderWeight'] = 2;
66   $settings['facets']['author']['displayName'] = "Author";
67   $settings['facets']['author']['pz2Name'] = "author";
68   $settings['facets']['author']['limiter'] = "au";
69   $settings['facets']['author']['multiLimit'] = 0;
70   $settings['facets']['author']['max'] = 10;
71   $settings['facets']['author']['orderWeight'] = 3;
72   variable_set('mkdru_defaults', $settings);
73 }
74
75 /**
76 * Implements hook_uninstall().
77 */
78 function mkdru_uninstall() {
79   // Drop table.
80   drupal_uninstall_schema('mkdru');
81   // Delete variables
82   variable_del('pz2_js_path');
83   variable_del('mkdru_defaults');
84 }