Project

General

Profile

Revision 6d8023f2

Added by Assos Assos over 5 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/taxonomy_menu/taxonomy_menu.install
9 9
 * Implements hook_uninstall().
10 10
 */
11 11
function taxonomy_menu_uninstall() {
12

  
13
  //remove menu items
12
  // Remove menu items.
14 13
  db_delete('menu_links')->condition('module', 'taxonomy_menu', '=')->execute();
15 14

  
16
  //rebuild the menus
15
  // Rebuild the menus.
17 16
  variable_set('menu_rebuild_needed', TRUE);
18 17

  
19
  // Delete variables
20
  $query = db_select('variable', 'v')->fields('v')->execute();
18
  // Gets array of more specific variables set by Taxonomy Menu module.
19
  // This prevents known issue https://www.drupal.org/node/1966684
20
  // where uninstalling Taxonomy Menu will delete variables related
21
  // to the Taxonomy Menu Block module.
22
  $variable_suffixes = array(
23
    'vocab_menu',
24
    'vocab_parent',
25
    'voc_item',
26
    'display_num',
27
    'hide_empty_terms',
28
    'expanded',
29
    'rebuild',
30
    'path',
31
    'menu_end_all',
32
    'display_descendants',
33
    'voc_name',
34
    'sync',
35
    'end_all',
36
    'flat',
37
    'max_depth',
38
    'term_item_description',
39
  );
40

  
41
  // Delete variables.
42
  $query = db_select('variable', 'v')
43
           ->fields('v', array('name', 'value'))
44
           ->condition('name', '%' . db_like('taxonomy_menu') . '%', 'LIKE')
45
           ->execute();
21 46
  $variables = $query->fetchAll();
22 47
  foreach ($variables as $variable) {
23
    if (strpos($variable->name, 'taxonomy_menu') !== FALSE) {
24
      variable_del($variable->name);
48
    // Add check to make sure we only delete variables for Taxonomy Menu,
49
    // not variables for Taxonomy Menu Block.
50
    foreach ($variable_suffixes as $suffix) {
51
      $taxonomy_menu_variable_name = 'taxonomy_menu_' . $suffix;
52
      if (strpos($variable->name, $taxonomy_menu_variable_name) !== FALSE) {
53
        variable_del($variable->name);
54
      }
25 55
    }
26 56
  }
27 57
}
28 58

  
29
/**
30
 * Implements hook_install().
31
 */
32
function taxonomy_menu_install() {
33
}
34

  
35 59
/**
36 60
 * Implements hook_schema().
37 61
 */
38 62
function taxonomy_menu_schema() {
39

  
40 63
  $schema['taxonomy_menu'] = array(
41 64
    'description' => 'Links a taxonomy term to a menu item.',
42 65
    'fields' => array(

Also available in: Unified diff