2006-07-13 13:14:25 +00:00
|
|
|
<?php
|
|
|
|
|
2009-05-13 19:42:18 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Install, update and uninstall functions for the book module.
|
|
|
|
*/
|
|
|
|
|
2006-09-01 07:40:08 +00:00
|
|
|
/**
|
2009-12-04 16:49:48 +00:00
|
|
|
* Implements hook_uninstall().
|
2006-09-01 07:40:08 +00:00
|
|
|
*/
|
|
|
|
function book_uninstall() {
|
2007-07-30 18:20:21 +00:00
|
|
|
// Delete menu links.
|
2010-06-23 19:05:15 +00:00
|
|
|
db_delete('menu_links')
|
|
|
|
->condition('module', 'book')
|
|
|
|
->execute();
|
2007-07-30 18:20:21 +00:00
|
|
|
menu_cache_clear_all();
|
2006-09-01 07:40:08 +00:00
|
|
|
}
|
2007-07-30 18:20:21 +00:00
|
|
|
|
2007-10-05 14:43:26 +00:00
|
|
|
/**
|
2009-12-04 16:49:48 +00:00
|
|
|
* Implements hook_schema().
|
2007-10-05 14:43:26 +00:00
|
|
|
*/
|
|
|
|
function book_schema() {
|
|
|
|
$schema['book'] = array(
|
2008-11-15 13:01:11 +00:00
|
|
|
'description' => 'Stores book outline information. Uniquely connects each node in the outline to a link in {menu_links}',
|
2007-10-05 14:43:26 +00:00
|
|
|
'fields' => array(
|
2007-10-10 11:39:35 +00:00
|
|
|
'mlid' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
2008-11-15 13:01:11 +00:00
|
|
|
'description' => "The book page's {menu_links}.mlid.",
|
2007-10-10 11:39:35 +00:00
|
|
|
),
|
|
|
|
'nid' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
2008-11-15 13:01:11 +00:00
|
|
|
'description' => "The book page's {node}.nid.",
|
2007-10-10 11:39:35 +00:00
|
|
|
),
|
|
|
|
'bid' => array(
|
|
|
|
'type' => 'int',
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'not null' => TRUE,
|
|
|
|
'default' => 0,
|
2008-11-15 13:01:11 +00:00
|
|
|
'description' => "The book ID is the {book}.nid of the top-level page.",
|
2007-10-10 11:39:35 +00:00
|
|
|
),
|
2007-10-05 14:43:26 +00:00
|
|
|
),
|
2007-12-18 12:59:22 +00:00
|
|
|
'primary key' => array('mlid'),
|
|
|
|
'unique keys' => array(
|
|
|
|
'nid' => array('nid'),
|
|
|
|
),
|
2007-10-05 14:43:26 +00:00
|
|
|
'indexes' => array(
|
2007-12-18 12:59:22 +00:00
|
|
|
'bid' => array('bid'),
|
2007-10-05 14:43:26 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|
2012-08-09 20:25:24 +00:00
|
|
|
|
|
|
|
/**
|
2013-01-04 18:29:51 +00:00
|
|
|
* Move the Book module settings from variables to config.
|
2012-08-09 20:25:24 +00:00
|
|
|
*
|
|
|
|
* @ingroup config_upgrade
|
|
|
|
*/
|
|
|
|
function book_update_8000() {
|
|
|
|
update_variables_to_config('book.settings', array(
|
|
|
|
'book_child_type' => 'child_type',
|
|
|
|
'book_block_mode' => 'block.navigation.mode',
|
|
|
|
));
|
2013-02-27 23:18:37 +00:00
|
|
|
$allowed_types = update_variable_get('book_allowed_types', FALSE);
|
|
|
|
if ($allowed_types) {
|
2013-03-10 19:27:34 +00:00
|
|
|
// Ensure consistent ordering of allowed_types.
|
|
|
|
// @see book_admin_settings_submit()
|
|
|
|
sort($allowed_types);
|
|
|
|
|
2013-09-16 03:58:06 +00:00
|
|
|
\Drupal::config('book.settings')
|
2013-03-10 19:27:34 +00:00
|
|
|
->set('allowed_types', $allowed_types)
|
2013-02-27 23:18:37 +00:00
|
|
|
->save();
|
|
|
|
}
|
|
|
|
|
2012-08-09 20:25:24 +00:00
|
|
|
}
|