Drupal.org explicitly licenses as GPLv2 and frowns upon including a LICENSE
[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       'settings' => array(
30         'type' => 'text',
31         'not null' => TRUE,
32         'description' => 'Metasearch settings',
33       ),
34     ),
35     'primary key' => array('nid', 'vid'),
36     'unique keys' => array('vid' => array('vid')),
37     'indexes' => array('nid' => array('nid')),
38   );
39   return $schema;
40 }
41
42 /**
43 * Implements hook_install().
44 */
45 function mkdru_install() {
46   // Disable comments by default
47   variable_set('comment_mkdru', COMMENT_NODE_DISABLED);
48   // Create table.
49   drupal_install_schema('mkdru');
50   // Default settings
51   $settings['pz2_path'] = "/pazpar2/search.pz2";
52   $settings['use_sessions'] = 1;
53   $settings['sp']['user'] = "";
54   $settings['sp']['pass'] = "";
55   $settings['facets']['source']['displayName'] = "Source";
56   $settings['facets']['source']['pz2Name'] = "xtargets";
57   $settings['facets']['source']['limiter'] = NULL;
58   $settings['facets']['source']['multiLimit'] = NULL;
59   $settings['facets']['source']['max'] = 10;
60   $settings['facets']['source']['orderWeight'] = 1;
61   $settings['facets']['subject']['displayName'] = "Subject";
62   $settings['facets']['subject']['pz2Name'] = "subject";
63   $settings['facets']['subject']['limiter'] = "su";
64   $settings['facets']['subject']['multiLimit'] = TRUE;
65   $settings['facets']['subject']['max'] = 10;
66   $settings['facets']['subject']['orderWeight'] = 2;
67   $settings['facets']['author']['displayName'] = "Author";
68   $settings['facets']['author']['pz2Name'] = "author";
69   $settings['facets']['author']['limiter'] = "au";
70   $settings['facets']['author']['multiLimit'] = FALSE;
71   $settings['facets']['author']['max'] = 10;
72   $settings['facets']['author']['orderWeight'] = 3;
73   variable_set('mkdru_defaults', $settings);
74   variable_set('mkdru_ding', $settings);
75 }
76
77 /**
78 * Implements hook_uninstall().
79 */
80 function mkdru_uninstall() {
81   // Drop table.
82   drupal_uninstall_schema('mkdru');
83   // Delete variables
84   variable_del('pz2_js_path');
85   variable_del('mkdru_defaults');
86   variable_del('mkdru_ding');
87 }