| 1 |
<?php |
<?php |
| 2 |
// $Id: tac_lite.install,v 1.2.2.1 2008/06/04 04:31:54 yogadex Exp $ |
// $Id: tac_lite.install,v 1.3 2008/06/04 05:02:11 yogadex Exp $ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* @file |
| 6 |
|
* Installation functions for tac_lite. |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
/** |
/** |
| 10 |
* Implementation of hook_install() |
* Implementation of hook_install(). |
| 11 |
* |
* |
| 12 |
* This function modifies the database as needed when tac_lite is installed. |
* Ensure that tac_lite hooks are invoked after taxonomy module hooks. |
| 13 |
*/ |
*/ |
| 14 |
function tac_lite_install() { |
function tac_lite_install() { |
| 15 |
// Ensure we come after taxonomy. |
$taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'")); |
| 16 |
db_query("UPDATE {system} SET weight = 9 WHERE name = 'tac_lite'"); |
db_query("UPDATE {system} SET weight = %d WHERE name = 'tac_lite'", $taxonomy_weight + 9); |
| 17 |
|
|
| 18 |
// Note that it is not necessary to rebuild the node access table here, as |
// Note that it is not necessary to rebuild the node access table here, as |
| 19 |
// that will be done when module settings are saved. |
// that will be done when module settings are saved. |
| 23 |
* Ensure that tac_lite hooks are invoked after taxonomy module hooks. |
* Ensure that tac_lite hooks are invoked after taxonomy module hooks. |
| 24 |
*/ |
*/ |
| 25 |
function tac_lite_update_1() { |
function tac_lite_update_1() { |
| 26 |
$ret[] = update_sql("UPDATE {system} SET weight = 9 WHERE name = 'tac_lite'"); |
$taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'")); |
| 27 |
|
$ret[] = update_sql("UPDATE {system} SET weight = ". ($taxonomy_weight + 9) ." WHERE name = 'tac_lite'"); |
| 28 |
return $ret; |
return $ret; |
| 29 |
} |
} |
| 30 |
|
|
| 31 |
/** |
/** |
| 32 |
* Ensure that the node_access table is thoroughly cleaned up. |
* Ensure that the node_access table is thoroughly cleaned up in Drupal 5 update. |
| 33 |
*/ |
*/ |
| 34 |
function tac_lite_update_2() { |
function tac_lite_update_2() { |
| 35 |
$ret = array(); |
$ret = array(); |
|
// node_access_rebuild function introduced in drupal 5 will ensure that the node_access |
|
|
// table is correct. |
|
| 36 |
node_access_rebuild(); |
node_access_rebuild(); |
| 37 |
$ret[] = array('success' => TRUE, // assume success |
// Assume success and return with message. |
| 38 |
'query' => t('Rebuilt node access table for tac_lite module.')); |
$ret[] = array( |
| 39 |
|
'success' => TRUE, |
| 40 |
|
'query' => t('Rebuilt node access table for tac_lite module.') |
| 41 |
|
); |
| 42 |
return $ret; |
return $ret; |
| 43 |
} |
} |
| 44 |
|
|
| 45 |
/** |
/** |
| 46 |
* Introducing schemes. Rename tac_lite_default_grants to tac_lite_grants_scheme_1. |
* Introducing schemes. Rename tac_lite_default_grants to tac_lite_grants_scheme_1. |
| 47 |
*/ |
*/ |
| 48 |
function tac_lite_update_3() { |
function tac_lite_update_3() { |
| 49 |
$ret = array(); |
$ret = array(); |
| 50 |
$ret[] = update_sql("UPDATE {variable} SET name='tac_lite_grants_scheme_1' WHERE name='tac_lite_default_grants'"); |
$ret[] = update_sql("UPDATE {variable} SET name='tac_lite_grants_scheme_1' WHERE name='tac_lite_default_grants'"); |
| 51 |
return $ret; |
return $ret; |
|
} |
|
|
|
|
|
|
|
|
?> |
|
| 52 |
|
} |