hook_uninstall implementation
corsix - January 19, 2008 - 16:10
| Project: | Views Filter Block |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Provides a hook_uninstall which:
* Deletes all variables "views_filterblock_view.$delta"
* Deletes variable views_filterblock_num
| Attachment | Size |
|---|---|
| views_filterblock_uninstall.patch | 860 bytes |

#1
@corix, first Thanks! (This was part of a (GHOP Task).
Second, why did you choose to iterate $conf instead of just calling variable_get('views_filterblock_num') and using that number?
#2
If you were to set it to say 5 blocks, and configure all five, then decide that you only need 3, then using views_filterblock_num would only get rid of the first 3, leaving the latter two.
#3
Agreed, this was a good choice.
#4
I agree that it's a good choice, but I still don't like the code. You're doing a strlen() for each key in that loop, when this is something that you know outside the loop. I'd probably get the length up front, and then use
substr($key, 0, $len) == $prefix. "strncmp" is a sooo C/C++.#5
Agreed, strlen should be done outside the loop. I'm unhappy about using substr, as it causes a new string to be created (you can tell I have a C/C++ background, can't you?), but it is more the PHP way.
#6
Committed, Thanks!
#7
Automatically closed -- issue fixed for two weeks with no activity.