GHOP #155: Write hook_uninstall: Task 1

douggreen - January 17, 2008 - 15:03
Project:Coder
Version:5.x-2.x-dev
Component:Code
Category:task
Priority:normal
Assigned:kourge
Status:closed
Description

Task Description:

This isn't specific to coder, but to a multitude of modules.

Check that all of the listed modules below have .install files, that they have a hook_uninstall. and that the hook_uninstall deletes all tables and variables (using variable_del). It should delete any tables that are created in hook_install. And it should delete any variables that are created. Variables are usually created through the call to variable_set, but they can also be created through the settings forms (look for the function that defines system_settings_form).

You don't need a local sandbox, but having one would be best. It's always best to run the code before submitting a patch. But since this is a fairly repetitive task, and in most cases you'll be creating a new .install file, the local sandbox isn't a "hard" requirement.

A sample hook_uninstall, taken from phpass, is:

function phpass_uninstall() {
  db_query("DROP TABLE {user_phpass}");
  variable_del('user_hash_method');
  variable_del('user_hash_strength');
  variable_del('user_hash_portable');
}

Before you start on any one module, you should check the modules issue queue to make sure that a patch hasn't been submitted. Please add a comment to this issue when you complete a module. I'll also try to check them off in the module description, as the issues are marked RTBC or Fixed.

This is two GHOP tasks (see also Task 2).

Task 1:

  1. CiviCRM Active User
  2. CiviCRM Count Block
  3. CiviCRM Theme
  4. Coder
  5. Short Form

Coder is the only big module in Task 1. You'll need to look at _coder_settings_form(). Three of the modules are related to CiviCRM. You don't absolutely need CiviCRM to complete this task, but learning about CiviCRM would be a good thing.

Deliverables:

  • create a Drupal issue against each module and submit a patch file for 5.x. If there is already a .install file, then be sure to submit the patch against the latest version on the DRUPAL-5 or DRUPAL-5--2 branches. You'll need to know how to create a patch file that adds a new file. The deliverable is not complete until the issue is reviewed and the status is set to either RTBC or Fixed (i.e., committed).
  • If a module is up-to-date and doesn't need a patch file, add a comment to this issue, saying that you checked the module and that it doesn't need to be patched.

Resources:

Primary Contact: Doug Green

#1

aclight - January 17, 2008 - 16:02
Title:GHOP #xx: Write hook_uninstall for a multitude of modules: Task 1» GHOP #155: Write hook_uninstall: Task 1

The official GHOP task related to this issue can be found at http://code.google.com/p/google-highly-open-participation-drupal/issues/...

Also, changed title to reflect the number of the corrected task.

#2

kourge - January 20, 2008 - 07:38
Assigned to:Anonymous» kourge
Status:active» patch (code needs review)
  1. CiviCRM Active User issue
  2. CiviCRM Count Block issue
  3. CiviCRM Theme issue
  4. Coder issue (already exists)
  5. Short Form issue

#3

dmitrig01 - January 21, 2008 - 04:22
Status:patch (code needs review)» fixed

Reviewed and set to RTBC for all of them

#4

douggreen - January 22, 2008 - 15:24
Status:fixed» patch (code needs work)

I reviewed all of the patches and committed most of them, but still think that the civicrm_countblock needs some work.

#5

douggreen - February 26, 2008 - 12:52
Status:patch (code needs work)» closed

Even though the civicrm_countblock issue wasn't completely resolved, because GHOP is over I'm closing this task (and leaving the civicrm_countblock issue open).

 
 

Drupal is a registered trademark of Dries Buytaert.