| 1 |
<?php |
<?php |
| 2 |
// $Id: category_menu.install,v 1.6 2008/07/21 17:48:50 jaza Exp $ |
// $Id: category_menu.install,v 1.7 2009/02/07 09:01:16 jaza Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 16 |
} |
} |
| 17 |
|
|
| 18 |
/** |
/** |
| 19 |
|
* Implementation of hook_disable(). |
| 20 |
|
*/ |
| 21 |
|
function category_menu_disable() { |
| 22 |
|
drupal_set_message(t('The <em>category_menu</em> module is now disabled. This means that generated menu items are no longer maintained. In order to avoid future problems with outdated menu items, it\'s highly recommended to either enable <em>category_menu</em>, or <a href="!url">uninstall</a> it entirely (removes all generated menu items).', array('!url' => url('admin/build/modules/uninstall'))), 'warning'); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
* Implementation of hook_uninstall(). |
* Implementation of hook_uninstall(). |
| 27 |
*/ |
*/ |
| 28 |
function category_menu_uninstall() { |
function category_menu_uninstall() { |
| 29 |
drupal_uninstall_schema('category_menu'); |
drupal_uninstall_schema('category_menu'); |
| 30 |
|
|
| 31 |
|
$types = node_get_types('names'); |
| 32 |
|
foreach ($types as $type => $name) { |
| 33 |
|
variable_del('category_menu_links_'. $type); |
| 34 |
|
} |
| 35 |
|
// Remove all generated menu links, as these are no longer maintained, |
| 36 |
|
// and user can't delete them (only just disable). |
| 37 |
|
db_query("DELETE FROM {menu_links} WHERE module = 'category_menu'"); |
| 38 |
|
menu_rebuild(); |
| 39 |
} |
} |
| 40 |
|
|
| 41 |
function category_menu_schema() { |
function category_menu_schema() { |
| 42 |
$schema['category_menu'] = array( |
$schema['category_menu'] = array( |
| 43 |
'description' => t('Stores menu settings for containers.'), |
'description' => 'Stores menu settings for containers.', |
| 44 |
'fields' => array( |
'fields' => array( |
| 45 |
'cid' => array( |
'cid' => array( |
| 46 |
'type' => 'int', |
'type' => 'int', |
| 47 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 48 |
'not null' => TRUE, |
'not null' => TRUE, |
| 49 |
'default' => 0, |
'default' => 0, |
| 50 |
'description' => t('Primary Key: The {category}.cid of the container.'), |
'description' => 'Primary Key: The {category}.cid of the container.', |
| 51 |
), |
), |
| 52 |
'links_for_cats' => array( |
'links_for_cats' => array( |
| 53 |
'type' => 'int', |
'type' => 'int', |
| 55 |
'not null' => TRUE, |
'not null' => TRUE, |
| 56 |
'default' => 0, |
'default' => 0, |
| 57 |
'size' => 'tiny', |
'size' => 'tiny', |
| 58 |
'description' => t('Whether or not generation of menu links for categories is enabled within the container. (0 = disabled, 1 = enabled)'), |
'description' => 'Whether or not generation of menu links for categories is enabled within the container. (0 = disabled, 1 = enabled)', |
| 59 |
), |
), |
| 60 |
'expanded_for_cats' => array( |
'expanded_for_cats' => array( |
| 61 |
'type' => 'int', |
'type' => 'int', |
| 63 |
'not null' => TRUE, |
'not null' => TRUE, |
| 64 |
'default' => 0, |
'default' => 0, |
| 65 |
'size' => 'tiny', |
'size' => 'tiny', |
| 66 |
'description' => t("Whether or not generated menu links for categories should be set to 'expanded' within the container. (0 = disabled, 1 = enabled)"), |
'description' => "Whether or not generated menu links for categories should be set to 'expanded' within the container. (0 = disabled, 1 = enabled)", |
| 67 |
), |
), |
| 68 |
'plid_for_container' => array( |
'plid_for_container' => array( |
| 69 |
'type' => 'int', |
'type' => 'int', |
| 70 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 71 |
'not null' => TRUE, |
'not null' => TRUE, |
| 72 |
'default' => 0, |
'default' => 0, |
| 73 |
'description' => t("The {menu_links}.mlid of a custom menu link to use as the parent of this container."), |
'description' => "The {menu_links}.mlid of a custom menu link to use as the parent of this container.", |
| 74 |
), |
), |
| 75 |
'menu_name' => array( |
'menu_name' => array( |
| 76 |
'type' => 'varchar', |
'type' => 'varchar', |
| 84 |
); |
); |
| 85 |
|
|
| 86 |
$schema['category_menu_map'] = array( |
$schema['category_menu_map'] = array( |
| 87 |
'description' => t('Stores mappings of containers, categories, and assigned nodes to generated menu links. Uniquely connects each such node to a link in {menu_links}'), |
'description' => 'Stores mappings of containers, categories, and assigned nodes to generated menu links. Uniquely connects each such node to a link in {menu_links}', |
| 88 |
'fields' => array( |
'fields' => array( |
| 89 |
'mlid' => array( |
'mlid' => array( |
| 90 |
'type' => 'int', |
'type' => 'int', |
| 91 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 92 |
'not null' => TRUE, |
'not null' => TRUE, |
| 93 |
'default' => 0, |
'default' => 0, |
| 94 |
'description' => t("The node's {menu_links}.mlid."), |
'description' => "The node's {menu_links}.mlid.", |
| 95 |
), |
), |
| 96 |
'nid' => array( |
'nid' => array( |
| 97 |
'type' => 'int', |
'type' => 'int', |
| 98 |
'unsigned' => TRUE, |
'unsigned' => TRUE, |
| 99 |
'not null' => TRUE, |
'not null' => TRUE, |
| 100 |
'default' => 0, |
'default' => 0, |
| 101 |
'description' => t("The node's {node}.nid."), |
'description' => "The node's {node}.nid.", |
| 102 |
), |
), |
| 103 |
), |
), |
| 104 |
'primary key' => array('mlid'), |
'primary key' => array('mlid'), |
| 158 |
|
|
| 159 |
return $ret; |
return $ret; |
| 160 |
} |
} |
| 161 |
|
|
| 162 |
|
/** |
| 163 |
|
* Ensure correct weight for category_menu module. |
| 164 |
|
*/ |
| 165 |
|
function category_menu_update_6002() { |
| 166 |
|
$ret = array(); |
| 167 |
|
$ret[] = update_sql("UPDATE {system} SET weight = 8 WHERE name = 'category_menu'"); |
| 168 |
|
return $ret; |
| 169 |
|
} |