function advpoll_uninstall in Advanced Poll 6.2
Same name and namespace in other branches
- 8 advpoll.install \advpoll_uninstall()
- 5 advpoll.install \advpoll_uninstall()
- 6.3 advpoll.install \advpoll_uninstall()
- 6 advpoll.install \advpoll_uninstall()
- 7.3 advpoll.install \advpoll_uninstall()
- 7 advpoll.install \advpoll_uninstall()
- 7.2 advpoll.install \advpoll_uninstall()
Implementation of hook_uninstall().
File
- ./
advpoll.install, line 177 - Manage database installation and upgrading for advpoll.
Code
function advpoll_uninstall() {
// Needs to be included due to _advpoll_list_modes().
include_once './' . drupal_get_path('module', 'advpoll') . '/advpoll.module';
// Remove all advpoll content types and their variables.
$variables = array(
'choices',
'max_choices',
'algorithm',
'runtime',
'writeins',
'show_writeins',
'electoral_list',
'show_votes',
'view_results',
'use_question',
);
foreach (_advpoll_list_modes() as $mode) {
node_type_delete('advpoll_' . $mode['name']);
foreach ($variables as $variable) {
variable_del('advpoll_' . $variable . '_advpoll_' . $mode['name']);
}
}
// Remove all votes.
db_query("DELETE FROM {votingapi_vote} WHERE content_type = 'advpoll'");
// Remove all cache data.
db_query("DELETE FROM {votingapi_cache} WHERE content_type = 'advpoll'");
// Remove all advpoll nodes.
$result = db_query('SELECT nid FROM {advpoll}');
while ($obj = db_fetch_object($result)) {
node_delete($obj->nid);
}
// Remove all database tables.
drupal_uninstall_schema('advpoll');
}