X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=mkdru.install;h=56b8d4b27b6d853b9a71387d73a7d1abb5380071;hb=bfbf487d0a960af59d12fd8bff4518996667454f;hp=cdbf86b3ec40aa0799b55242cb57b1de8244224e;hpb=66f3bea850ee445427da4ec46e18d4374dd3e953;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.install b/mkdru.install index cdbf86b..56b8d4b 100644 --- a/mkdru.install +++ b/mkdru.install @@ -6,21 +6,21 @@ */ /** -* Implementation of hook_schema(). +* Implements hook_schema(). */ function mkdru_schema() { $schema['mkdru'] = array( - 'description' => t('Stores settings for mkdru nodes.'), + 'description' => 'Stores settings for mkdru nodes.', 'fields' => array( 'nid' => array( - 'description' => t('The primary identifier for a node.'), + 'description' => 'The primary identifier for a node.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'vid' => array( - 'description' => t('The current {node_revisions}.vid version identifier.'), + 'description' => 'The current {node_revisions}.vid version identifier.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, @@ -29,32 +29,42 @@ function mkdru_schema() { 'pz2_path' => array( 'type' => 'text', 'not null' => TRUE, - 'description' => t('Path to Pazpar2 or Service Proxy.') + 'description' => 'Path to Pazpar2 or Service Proxy.', ), 'use_sessions' => array( - 'description' => t('Session handling toggle.'), + 'description' => 'Session handling toggle.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'source_max' => array( - 'description' => t('Number of sources to display'), + 'description' => 'Number of sources to display', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'author_max' => array( - 'description' => t('Number of authors to display'), + 'description' => 'Number of authors to display', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'subject_max' => array( - 'description' => t('Number of subjects to display'), + 'description' => 'Number of subjects to display', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), + 'sp_user' => array( + 'type' => 'text', + 'not null' => FALSE, + 'description' => 'Service Proxy username' + ), + 'sp_pass' => array( + 'type' => 'text', + 'not null' => FALSE, + 'description' => 'Service Proxy password' + ), ), 'primary key' => array('nid', 'vid'), 'unique keys' => array('vid' => array('vid')), @@ -64,21 +74,30 @@ function mkdru_schema() { } /** -* Implementation of hook_install(). +* Implements hook_install(). */ function mkdru_install() { // Disable comments by default - variable_set('comment_mkdru', COMMENT_NODE_DISABLED); - // Create table. - drupal_install_schema('mkdru'); + variable_set('comment_mkdru', COMMENT_NODE_HIDDEN); + // Facets + $facets = array('source', 'subject', 'author'); + variable_set('mkdru_facets', $facets); + // Restrict facet block visibility + foreach ($facets as $facet) { + db_insert('block_node_type') + ->fields(array( + 'module' => 'mkdru', + 'delta' => 'mkdru_facet_' . $facet, + 'type' => 'mkdru'))->execute(); + } } /** -* Implementation of hook_uninstall(). +* Implements hook_uninstall(). */ function mkdru_uninstall() { - // Drop table. - drupal_uninstall_schema('mkdru'); // Delete variables variable_del('pz2_js_path'); -} + // Clear block visibility + db_delete('block_node_type')->condition('module', 'mkdru')->execute(); +} \ No newline at end of file