| 1 |
<?php
|
| 2 |
// $Id: sitenotes.install,v 1.9 2007/08/04 15:03:31 nancyw Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function sitenotes_install() {
|
| 8 |
watchdog('SiteNotes', 'sitenotes module installed');
|
| 9 |
// drupal_set_message(t('The Site Notes module was installed. You may want to go to the <a href="!settings">settings page now</a>.', array('!settings' => url('admin/build/sitenotes'))));
|
| 10 |
|
| 11 |
}
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Implementation of hook_update().
|
| 15 |
* This is update is needed to add weight to existing sitenotes nodes.
|
| 16 |
*/
|
| 17 |
function sitenotes_update_1() {
|
| 18 |
return array(update_sql("UPDATE {node} SET sticky=-100 WHERE type='sitenotes'"));
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_uninstall().
|
| 23 |
*/
|
| 24 |
function sitenotes_uninstall() {
|
| 25 |
|
| 26 |
// Remove all Site Note nodes.
|
| 27 |
$result = db_query('SELECT nid FROM {node} WHERE type = "sitenotes"');
|
| 28 |
while ($obj = db_fetch_object($result)) {
|
| 29 |
node_delete($obj->nid);
|
| 30 |
}
|
| 31 |
|
| 32 |
// Remove the node type.
|
| 33 |
node_type_delete('sitenotes');
|
| 34 |
|
| 35 |
// Remove all Site Note blocks.
|
| 36 |
db_query("DELETE FROM {blocks} WHERE module='sitenotes'");
|
| 37 |
|
| 38 |
// Remove variables.
|
| 39 |
variable_del('sitenotes_block_0');
|
| 40 |
variable_del('sitenotes_search');
|
| 41 |
|
| 42 |
// clear the cache tables (see http://drupal.org/node/64279#comment-211282)
|
| 43 |
cache_clear_all('*', 'cache', TRUE);
|
| 44 |
cache_clear_all('*', 'cache_filter', TRUE);
|
| 45 |
cache_clear_all('*', 'cache_page', TRUE);
|
| 46 |
|
| 47 |
watchdog('SiteNotes', 'sitenotes module removed');
|
| 48 |
}
|