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

AttachmentSize
views_filterblock_uninstall.patch860 bytes

#1

douggreen - January 19, 2008 - 19:29

@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

corsix - January 19, 2008 - 21:44

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

dmitrig01 - January 21, 2008 - 15:08
Status:needs review» reviewed & tested by the community

Agreed, this was a good choice.

#4

douggreen - January 22, 2008 - 15:13
Status:reviewed & tested by the community» needs work

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

corsix - January 22, 2008 - 16:20
Status:needs work» needs review

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.

AttachmentSize
views_filterblock_uninstall_2.patch 954 bytes

#6

douggreen - January 22, 2008 - 16:54
Status:needs review» fixed

Committed, Thanks!

#7

Anonymous (not verified) - February 5, 2008 - 17:02
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.