hook_uninstall patch
kourge - January 20, 2008 - 05:20
| Project: | CiviCRM Count Block |
| Version: | HEAD |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | kourge |
| Status: | needs work |
Jump to:
Description
This is a hook_uninstall patch that should get rid of any traces of civicrm_countblock should it be uninstalled.
List of Destruction:
- Variables
- civicrm_countblock_num
- civicrm_countblock_block.0
- civicrm_countblock_precision.0
- civicrm_countblock_group.0
- civicrm_countblock_cache.0
- civicrm_countblock_block.1
- civicrm_countblock_precision.1
- civicrm_countblock_group.1
- civicrm_countblock_cache.1
- civicrm_countblock_block.2
- civicrm_countblock_precision.2
- civicrm_countblock_group.2
- civicrm_countblock_cache.2
- civicrm_countblock_block.3
- civicrm_countblock_precision.3
- civicrm_countblock_group.3
- civicrm_countblock_cache.3
- civicrm_countblock_block.4
- civicrm_countblock_precision.4
- civicrm_countblock_group.4
- civicrm_countblock_cache.4
- civicrm_countblock_block.5
- civicrm_countblock_precision.5
- civicrm_countblock_group.5
- civicrm_countblock_cache.5
- civicrm_countblock_block.6
- civicrm_countblock_precision.6
- civicrm_countblock_group.6
- civicrm_countblock_cache.6
- civicrm_countblock_block.7
- civicrm_countblock_precision.7
- civicrm_countblock_group.7
- civicrm_countblock_cache.7
- civicrm_countblock_block.8
- civicrm_countblock_precision.8
- civicrm_countblock_group.8
- civicrm_countblock_cache.8
- civicrm_countblock_block.9
- civicrm_countblock_precision.9
- civicrm_countblock_group.9
- civicrm_countblock_cache.9
| Attachment | Size |
|---|---|
| civicrm_countblock_uninstall.patch | 651 bytes |

#1
Looks good to me! (reviewed)
#2
While this works fine, it performs a SQL query (see variable_del) for every single variable and delta, many of which aren't set.
You might look at how corsix is doing this for views_filterblock #211943. While his implementation isn't quite finished, I think it's a better way of doing this. (The helper function isn't necessary, and I'm not suggesting that you use a helper function, I'm suggesting that you look at looping through the existing variables to figure out what to delete.)