og_menu.install in Organic Groups Menu (OG Menu) 6.2
Same filename and directory in other branches
File
og_menu.installView source
<?php
/**
* Implementation of hook_schema()
*/
function og_menu_schema() {
$schema['og_menu'] = array(
'fields' => array(
'gid' => array(
'type' => 'int',
'not null' => TRUE,
),
'menu_name' => array(
'type' => 'varchar',
'length' => 128,
'default' => '',
),
),
'primary key' => array(
'gid',
'menu_name',
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function og_menu_install() {
drupal_install_schema('og_menu');
}
/**
* Implementation of hook_uninstall().
*/
function og_menu_uninstall() {
drupal_uninstall_schema('og_menu');
}
/**
* Implementation of hook_update_N().
*/
function og_menu_update_6200() {
drupal_install_schema('og_menu');
$result = db_query("SELECT * FROM {og_menu_groups}");
while ($menu = db_fetch_array($result)) {
db_query("INSERT INTO {og_menu} (gid, menu_name) VALUES (%d, '%s')", $menu['gid'], $menu['mid']);
}
db_query('DROP TABLE {og_menu_groups}');
}
/**
* Clear menu cache to ensure changes in hook_menu().
*/
function og_menu_update_6201() {
// No need to clear menu cache her, because all caches will be cleared anyway
// while finishing update process in update_finished().
}
Functions
Name | Description |
---|---|
og_menu_install | Implementation of hook_install(). |
og_menu_schema | Implementation of hook_schema() |
og_menu_uninstall | Implementation of hook_uninstall(). |
og_menu_update_6200 | Implementation of hook_update_N(). |
og_menu_update_6201 | Clear menu cache to ensure changes in hook_menu(). |