| 1 |
<?php |
<?php |
| 2 |
// $Id: xmlsitemap_menu.install,v 1.1.4.2 2008/11/28 10:16:31 kiam Exp $ |
// $Id: xmlsitemap_menu.install,v 1.1.4.3 2008/11/28 16:12:48 kiam Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 28 |
* Implementation of hook_install(). |
* Implementation of hook_install(). |
| 29 |
*/ |
*/ |
| 30 |
function xmlsitemap_menu_install() { |
function xmlsitemap_menu_install() { |
|
$t = get_t(); |
|
| 31 |
$id = db_result(db_query_range("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", 'menu-xmlsitemap'), 0, 1); |
$id = db_result(db_query_range("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", 'menu-xmlsitemap'), 0, 1); |
| 32 |
if ($id === FALSE) { |
if ($id === FALSE) { |
| 33 |
db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES (%d, '%s', '%s')", 'menu-xmlsitemap', $t('XML Sitemap'), $t('The menu from where <em>XML Sitemap: Menu</em> looks for the menus to add to the sitemap.')); |
db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'menu-xmlsitemap', t('XML Sitemap'), t('The menu from where <em>XML Sitemap: Menu</em> looks for the menus to add to the sitemap.')); |
| 34 |
menu_rebuild(); |
menu_rebuild(); |
| 35 |
} |
} |
| 36 |
} |
} |
| 37 |
|
|
| 38 |
/** |
/** |
| 39 |
* Implementation of hook_update_N(). |
* Implementation of hook_update_N(). |
| 40 |
* Remove a variable used in the previous version of the module. |
*/ |
|
*/ |
|
| 41 |
function xmlsitemap_menu_update_6000() { |
function xmlsitemap_menu_update_6000() { |
| 42 |
$ret = array(); |
$ret = array(); |
|
$t = get_t(); |
|
| 43 |
$result = @update_sql("DELETE FROM {variable} WHERE name = 'xmlsitemap_menu_custom_menu'"); |
$result = @update_sql("DELETE FROM {variable} WHERE name = 'xmlsitemap_menu_custom_menu'"); |
| 44 |
if ($result['success']) { |
if ($result['success']) { |
| 45 |
$ret[] = $result; |
$ret[] = $result; |
| 46 |
} |
} |
| 47 |
$id = db_result(db_query_range("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", 'menu-xmlsitemap'), 0, 1); |
$id = db_result(db_query_range("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", 'menu-xmlsitemap'), 0, 1); |
| 48 |
if ($id === FALSE) { |
if ($id === FALSE) { |
| 49 |
$result = update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES (%d, '%s', '%s')", 'menu-xmlsitemap', $t('XML Sitemap'), $t('The menu from where <em>XML Sitemap: Menu</em> looks for the menus to add to the sitemap.')); |
$result = update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'menu-xmlsitemap', $t('XML Sitemap'), $t('The menu from where <em>XML Sitemap: Menu</em> looks for the menus to add to the sitemap.')); |
| 50 |
if ($result['success']) { |
if ($result['success']) { |
| 51 |
menu_rebuild(); |
menu_rebuild(); |
| 52 |
} |
} |
| 57 |
|
|
| 58 |
/** |
/** |
| 59 |
* Implementation of hook_update_N(). |
* Implementation of hook_update_N(). |
| 60 |
*/ |
*/ |
| 61 |
function xmlsitemap_menu_update_6100() { |
function xmlsitemap_menu_update_6100() { |
| 62 |
return array(); |
return array(); |
| 63 |
} |
} |
| 64 |
|
|
| 65 |
/** |
/** |
| 66 |
|
* Implementation of hook_update_N(). |
| 67 |
|
*/ |
| 68 |
|
function xmlsitemap_menu_update_6101() { |
| 69 |
|
return xmlsitemap_menu_update_6000(); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
/** |
| 73 |
* Implementation of hook_uninstall(). |
* Implementation of hook_uninstall(). |
| 74 |
*/ |
*/ |
| 75 |
function xmlsitemap_menu_uninstall() { |
function xmlsitemap_menu_uninstall() { |
| 76 |
@db_query("DELETE FROM {menu_links} WHERE menu_name = '%s'", 'menu-xmlsitemap'); |
db_query("DELETE FROM {menu_links} WHERE menu_name LIKE 'menu-xmlsitemap%'"); |
| 77 |
@db_query("DELETE FROM {menu_custom} WHERE menu_name = '%s'", 'menu-xmlsitemap'); |
db_query("DELETE FROM {menu_custom} WHERE menu_name LIKE 'menu-xmlsitemap%'"); |
| 78 |
db_query("DELETE FROM {variable} WHERE name LIKE 'xmlsitemap\_menu\_%'"); |
db_query("DELETE FROM {variable} WHERE name LIKE 'xmlsitemap\_menu\_%'"); |
| 79 |
} |
} |