tac_lite.install in Taxonomy Access Control Lite 6
Same filename and directory in other branches
Installation functions for tac_lite.
File
tac_lite.installView source
<?php
/**
* @file
* Installation functions for tac_lite.
*/
/**
* Implementation of hook_install().
*
* Ensure that tac_lite hooks are invoked after taxonomy module hooks.
*/
function tac_lite_install() {
$taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
db_query("UPDATE {system} SET weight = %d WHERE name = 'tac_lite'", $taxonomy_weight + 9);
// Note that it is not necessary to rebuild the node access table here, as
// that will be done when module settings are saved.
}
/**
* Ensure that tac_lite hooks are invoked after taxonomy module hooks.
*/
function tac_lite_update_1() {
$taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
$ret[] = update_sql("UPDATE {system} SET weight = " . ($taxonomy_weight + 9) . " WHERE name = 'tac_lite'");
return $ret;
}
/**
* Ensure that the node_access table is thoroughly cleaned up in Drupal 5 update.
*/
function tac_lite_update_2() {
$ret = array();
node_access_rebuild();
// Would batch mode help here?
// Assume success and return with message.
$ret[] = array(
'success' => TRUE,
'query' => t('Rebuilt node access table for tac_lite module.'),
);
return $ret;
}
/**
* Introducing schemes. Rename tac_lite_default_grants to tac_lite_grants_scheme_1.
*/
function tac_lite_update_3() {
$ret = array();
$ret[] = update_sql("UPDATE {variable} SET name='tac_lite_grants_scheme_1' WHERE name='tac_lite_default_grants'");
return $ret;
}
/**
* Start of updates to Drupal 6.x-1.2. Start using Drupal standard
* update numbers.
*/
/**
* Rename permission from "administer_tac_lite" to "administer
* tac_lite" for UI consistency.
*/
function tac_lite_update_6001() {
$ret = array();
$result = db_query("SELECT * FROM {permission} WHERE perm LIKE '%administer_tac_lite%'");
while ($permission = db_fetch_object($result)) {
$perm = str_replace('administer_tac_lite', 'administer tac_lite', $permission->perm);
$ret[] = update_sql("UPDATE {permission} SET perm = '" . db_escape_string($perm) . "' WHERE rid =" . $permission->rid);
}
return $ret;
}
Functions
Name | Description |
---|---|
tac_lite_install | Implementation of hook_install(). |
tac_lite_update_1 | Ensure that tac_lite hooks are invoked after taxonomy module hooks. |
tac_lite_update_2 | Ensure that the node_access table is thoroughly cleaned up in Drupal 5 update. |
tac_lite_update_3 | Introducing schemes. Rename tac_lite_default_grants to tac_lite_grants_scheme_1. |
tac_lite_update_6001 | Rename permission from "administer_tac_lite" to "administer tac_lite" for UI consistency. |