function auto_menutitle_update_1000 in Auto Menu Title 6.2
SQL Updates to node table for menu states
1 call to auto_menutitle_update_1000()
- auto_menutitle_install in ./
auto_menutitle.install - Implementation of hook_install();
File
- ./
auto_menutitle.install, line 21 - auto_menutitle alters the menu_links table for storing menu settings. It also stores a number of variables in the variable table too. This file handles the install/uninstall of this data, cleanly.
Code
function auto_menutitle_update_1000() {
$ret = array();
db_add_field($ret, 'menu_links', 'automenu_state', array(
'description' => 'Toggle for saved auto menu titles.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
/* Upon first installing (or updating to 1000) the module, we check to see what menu links have the same text as there respective node, and set the auto menu title state flag.
Note: do we need to do something differently here for node versions?
*/
$result = db_query("SELECT * FROM {node} node LEFT JOIN {menu_links} menu_links ON node.title = menu_links.link_title WHERE link_path = concat(\"node/\", node.nid)");
while ($row = db_fetch_array($result)) {
$ret[] = update_sql("UPDATE {menu_links} SET automenu_state = '1' WHERE mlid = " . $row['mlid']);
}
return $ret;
}