123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the print_epub module.
- *
- * @ingroup print
- */
- /**
- * Implements hook_enable().
- */
- function print_epub_enable() {
- $t = get_t();
- // Module weight
- db_update('system')
- ->fields(array(
- 'weight' => 4,
- ))
- ->condition('type', 'module')
- ->condition('name', 'print_epub')
- ->execute();
- }
- /**
- * Implements hook_uninstall().
- */
- function print_epub_uninstall() {
- variable_del('print_epub_display_sys_urllist');
- variable_del('print_epub_filename');
- variable_del('print_epub_images_via_file');
- variable_del('print_epub_link_text');
- variable_del('print_epub_link_text_enabled');
- variable_del('print_epub_epub_tool');
- variable_del('print_epub_book_link');
- variable_del('print_epub_link_class');
- variable_del('print_epub_link_pos');
- variable_del('print_epub_link_teaser');
- variable_del('print_epub_link_use_alias');
- variable_del('print_epub_show_link');
- variable_del('print_epub_sys_link_pages');
- variable_del('print_epub_sys_link_visibility');
- $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_epub\_display\_%'");
- foreach ($settings as $variable) {
- variable_del($variable->name);
- }
- }
- /**
- * Implements hook_schema().
- */
- function print_epub_schema() {
- $schema['print_epub_node_conf'] = array(
- 'description' => 'EPUB version node-specific configuration settings',
- 'fields' => array(
- 'nid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The {node}.nid of the node.',
- ),
- 'link' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- 'size' => 'tiny',
- 'description' => 'Show link',
- ),
- 'comments' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- 'size' => 'tiny',
- 'description' => 'Show link in individual comments',
- ),
- 'url_list' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 1,
- 'size' => 'tiny',
- 'description' => 'Show Printer-friendly URLs list',
- ),
- ),
- 'primary key' => array('nid'),
- );
- $schema['print_epub_page_counter'] = array(
- 'description' => 'EPUB version access counter',
- 'fields' => array(
- 'path' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'description' => 'Page path',
- ),
- 'totalcount' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'big',
- 'description' => 'Number of page accesses',
- ),
- 'timestamp' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Last access',
- ),
- ),
- 'primary key' => array('path'),
- );
- return $schema;
- }
- /**
- * Remove hardcoded numeric deltas from all blocks
- */
- function print_epub_update_7000(&$sandbox) {
- $renamed_deltas = array(
- 'print_epub' => array(
- '0' => 'print_epub-top',
- ),
- );
- update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
- if (variable_get('print_epub_filename', '') == '[site-name] - [title] - [mod-yyyy]-[mod-mm]-[mod-dd]') {
- variable_set('print_epub_filename', '[site:name] - [node:title] - [node:changed:custom:Y-m-d]');
- }
- }
- /**
- * Enable block and help area links
- */
- function print_epub_update_7202(&$sandbox) {
- $link_pos = variable_get('print_epub_link_pos', drupal_json_decode('{ "link": "link", "block": "block", "help": "help" }'));
- $link_pos['block'] = 'block';
- $link_pos['help'] = 'help';
- variable_set('print_epub_link_pos', $link_pos);
- }
- /**
- * Increase size of the path field in the print_epub_page_counter table
- */
- function print_epub_update_7203(&$sandbox) {
- db_drop_primary_key('print_epub_page_counter');
- db_change_field('print_epub_page_counter', 'path', 'path',
- array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'Page path'),
- array('primary key' => array('path')));
- }
|