node_access_example.install
<?php
// $Id: node_access_example.install,v 1.1.2.2 2008/06/06 21:51:21 darrenoh Exp $
/**
* Implementation of hook_install().
*/
function node_access_example_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("
CREATE TABLE {node_access_example} (
nid int(10) unsigned NOT NULL default '0' PRIMARY KEY,
private int,
KEY node_example_nid (nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;
");
break;
case 'pgsql':
db_query("
CREATE TABLE {node_access_example} (
nid int NOT NULL default '0',
private int,
PRIMARY KEY (nid));
");
break;
}
}
/**
* Implementation of hook_enable().
*
* A node access module needs to force a rebuild of the node access table
* when it is enabled to ensure that things are set up.
*/
function node_access_example_enable() {
node_access_rebuild();
}
/**
* Implementation of hook_disable().
*
* A node access module needs to force a rebuild of the node access table
* when it is disabled to ensure that its entries are removed from the table.
*/
function node_access_example_disable() {
node_access_example_disabling(TRUE);
node_access_rebuild();
}
/**
* Implementation of hook_uninstall().
*/
function node_access_example_uninstall() {
if (db_table_exists('node_access_example')) {
db_query("DROP TABLE {node_access_example}");
}
}