Remove dependencies (Hasse's patch)
[mkdru-moved-to-drupal.org.git] / mkdru.install
index e69de29..fa08343 100644 (file)
@@ -0,0 +1,86 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Install, update and uninstall functions.
+ */
+
+/**
+* Implements hook_schema().
+*/
+function mkdru_schema() {
+  $schema['mkdru'] = array(
+    'description' => 'Stores settings for mkdru nodes.',
+    'fields' => array(
+      'nid' => array(
+        'description' => 'The primary identifier for a node.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+       ),
+      'vid' => array(
+        'description' => 'The current {node_revisions}.vid version identifier.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'settings' => array(
+        'type' => 'text',
+        'not null' => TRUE,
+        'description' => 'Metasearch settings',
+      ),
+    ),
+    'primary key' => array('nid', 'vid'),
+    'unique keys' => array('vid' => array('vid')),
+    'indexes' => array('nid' => array('nid')),
+  );
+  return $schema;
+}
+
+/**
+* Implements hook_install().
+*/
+function mkdru_install() {
+  // Disable comments by default
+  variable_set('comment_mkdru', defined(COMMENT_NODE_HIDDEN) ? COMMENT_NODE_HIDDEN : NULL);
+
+
+  // Default settings
+  $settings['title'] = "";
+  $settings['pz2_path'] = "/pazpar2/search.pz2";
+  $settings['use_sessions'] = 1;
+  $settings['sp']['user'] = "";
+  $settings['sp']['pass'] = "";
+  $settings['facets']['source']['displayName'] = "Source";
+  $settings['facets']['source']['pz2Name'] = "xtargets";
+  $settings['facets']['source']['limiter'] = NULL;
+  $settings['facets']['source']['multiLimit'] = NULL;
+  $settings['facets']['source']['max'] = 10;
+  $settings['facets']['source']['orderWeight'] = 1;
+  $settings['facets']['subject']['displayName'] = "Subject";
+  $settings['facets']['subject']['pz2Name'] = "subject";
+  $settings['facets']['subject']['limiter'] = "su";
+  $settings['facets']['subject']['multiLimit'] = TRUE;
+  $settings['facets']['subject']['max'] = 10;
+  $settings['facets']['subject']['orderWeight'] = 2;
+  $settings['facets']['author']['displayName'] = "Author";
+  $settings['facets']['author']['pz2Name'] = "author";
+  $settings['facets']['author']['limiter'] = "au";
+  $settings['facets']['author']['multiLimit'] = FALSE;
+  $settings['facets']['author']['max'] = 10;
+  $settings['facets']['author']['orderWeight'] = 3;
+  variable_set('mkdru_defaults', $settings);
+}
+
+/**
+* Implements hook_uninstall().
+*/
+function mkdru_uninstall() {
+  // Delete variables
+  variable_del('pz2_js_path');
+  variable_del('mkdru_defaults');
+  // Clear block visibility
+  db_delete('block_node_type')->condition('module', 'mkdru')->execute();
+}