From 94098f7e931db2efc354af97302c2f44af7bb4f5 Mon Sep 17 00:00:00 2001 From: Neil Drumm <drumm@3064.no-reply.drupal.org> Date: Fri, 1 Sep 2006 07:40:08 +0000 Subject: [PATCH] #81033 by webchick and neclimdul. Uninstall module API. --- includes/install.inc | 12 ++++++++++++ modules/aggregator/aggregator.install | 18 ++++++++++++++++++ modules/book/book.install | 10 ++++++++++ modules/contact/contact.install | 13 +++++++++++++ modules/drupal/drupal.install | 20 ++++++++++++++++++++ modules/forum/forum.install | 18 ++++++++++++++++++ modules/locale/locale.install | 12 ++++++++++++ modules/poll/poll.install | 12 ++++++++++++ modules/profile/profile.install | 12 ++++++++++++ modules/search/search.install | 14 ++++++++++++++ modules/statistics/statistics.install | 17 +++++++++++++++++ modules/system/system.install | 3 +++ 12 files changed, 161 insertions(+) diff --git a/includes/install.inc b/includes/install.inc index 087d02577d7e..9b19cf6658ad 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -350,6 +350,18 @@ function drupal_install_module($module) { } } +/** + * Calls the uninstall function and updates the system table for a given module. + * + * @param $module + * The module to uninstall. + */ +function drupal_uninstall_module($module) { + module_load_install($module); + module_invoke($module, 'uninstall'); + drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED); +} + /** * Verify the state of the specified file. * diff --git a/modules/aggregator/aggregator.install b/modules/aggregator/aggregator.install index 8a5d1612f24f..6c3220e4a00e 100644 --- a/modules/aggregator/aggregator.install +++ b/modules/aggregator/aggregator.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function aggregator_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -112,3 +115,18 @@ function aggregator_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function aggregator_uninstall() { + db_query('DROP TABLE {aggregator_category}'); + db_query('DROP TABLE {aggregator_category_feed}'); + db_query('DROP TABLE {aggregator_category_item}'); + db_query('DROP TABLE {aggregator_feed}'); + db_query('DROP TABLE {aggregator_item}'); + variable_del('aggregator_allowed_html_tags'); + variable_del('aggregator_summary_items'); + variable_del('aggregator_clear'); + variable_del('aggregator_category_selector'); +} diff --git a/modules/book/book.install b/modules/book/book.install index 43406e0a31fe..1051d53258e5 100644 --- a/modules/book/book.install +++ b/modules/book/book.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function book_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -28,3 +31,10 @@ function book_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function book_uninstall() { + db_query('DROP TABLE {book}'); +} diff --git a/modules/contact/contact.install b/modules/contact/contact.install index f7567a3de893..0e3679d44e74 100644 --- a/modules/contact/contact.install +++ b/modules/contact/contact.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function contact_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -30,3 +33,13 @@ function contact_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function contact_uninstall() { + db_query('DROP TABLE {contact}'); + variable_del('contact_default_status'); + variable_del('contact_form_information'); + variable_del('contact_hourly_threshold'); +} diff --git a/modules/drupal/drupal.install b/modules/drupal/drupal.install index f1c93d56c848..909c539de809 100644 --- a/modules/drupal/drupal.install +++ b/modules/drupal/drupal.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function drupal_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -52,3 +55,20 @@ function drupal_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function drupal_uninstall() { + db_query('DROP TABLE {client}'); + db_query('DROP TABLE {client_system}'); + variable_del('drupal_authentication_service'); + variable_del('drupal_directory'); + variable_del('drupal_register'); + variable_del('drupal_server'); + variable_del('drupal_system'); + variable_del('drupal_statistics'); + variable_del('drupal_client_service'); + variable_del('drupal_default_da_server'); + variable_del('drupal_default_da_server_only'); +} diff --git a/modules/forum/forum.install b/modules/forum/forum.install index 0d4815cb82d4..31ad02fa3a48 100644 --- a/modules/forum/forum.install +++ b/modules/forum/forum.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function forum_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -26,3 +29,18 @@ function forum_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function forum_uninstall() { + db_query('DROP TABLE {forum}'); + db_query("DELETE FROM {node} WHERE type = 'forum'"); + variable_del('forum_containers'); + variable_del('forum_nav_vocabulary'); + variable_del('forum_hot_topic'); + variable_del('forum_per_page'); + variable_del('forum_order'); + variable_del('forum_block_num_0'); + variable_del('forum_block_num_1'); +} diff --git a/modules/locale/locale.install b/modules/locale/locale.install index b818f1efa7eb..e61449cd1802 100644 --- a/modules/locale/locale.install +++ b/modules/locale/locale.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function locale_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -69,3 +72,12 @@ function locale_install() { } db_query("INSERT INTO {locales_meta} (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1')"); } + +/** + * Implementation of hook_uninstall(). + */ +function locale_uninstall() { + db_query('DROP TABLE {locales_meta}'); + db_query('DROP TABLE {locales_source}'); + db_query('DROP TABLE {locales_target}'); +} diff --git a/modules/poll/poll.install b/modules/poll/poll.install index d2863a731a50..733d71c658c5 100644 --- a/modules/poll/poll.install +++ b/modules/poll/poll.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function poll_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -63,3 +66,12 @@ function poll_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function poll_uninstall() { + db_query('DROP TABLE {poll}'); + db_query('DROP TABLE {poll_votes}'); + db_query('DROP TABLE {poll_choices}'); +} diff --git a/modules/profile/profile.install b/modules/profile/profile.install index df1c85c7ce48..51237ed1804c 100644 --- a/modules/profile/profile.install +++ b/modules/profile/profile.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function profile_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -63,3 +66,12 @@ function profile_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function profile_uninstall() { + db_query('DROP TABLE {profile_fields}'); + db_query('DROP TABLE {profile_values}'); + variable_del('profile_block_author_fields'); +} diff --git a/modules/search/search.install b/modules/search/search.install index 050ee704d8e3..2b0391a3a653 100644 --- a/modules/search/search.install +++ b/modules/search/search.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function search_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -58,3 +61,14 @@ function search_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function search_uninstall() { + db_query('DROP TABLE {search_dataset}'); + db_query('DROP TABLE {search_index}'); + db_query('DROP TABLE {search_total}'); + variable_del('minimum_word_size'); + variable_del('overlap_cjk'); +} diff --git a/modules/statistics/statistics.install b/modules/statistics/statistics.install index 8b5ed2be4dc6..e1e2c00a42c6 100644 --- a/modules/statistics/statistics.install +++ b/modules/statistics/statistics.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function statistics_install() { switch ($GLOBALS['db_type']) { case 'mysql': @@ -36,3 +39,17 @@ function statistics_install() { break; } } + +/** + * Implementation of hook_uninstall(). + */ +function statistics_uninstall() { + db_query('DROP TABLE {accesslog}'); + variable_del('statistics_count_content_views'); + variable_del('statistics_enable_access_log'); + variable_del('statistics_flush_accesslog_timer'); + variable_del('statistics_day_timestamp'); + variable_del('statistics_block_top_day_num'); + variable_del('statistics_block_top_all_num'); + variable_del('statistics_block_top_last_num'); +} diff --git a/modules/system/system.install b/modules/system/system.install index 78f486b393fc..1f8607224d21 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -1,6 +1,9 @@ <?php // $Id$ +/** + * Implementation of hook_install(). + */ function system_install() { switch ($GLOBALS['db_type']) { case 'mysql': -- GitLab