[development] low hanging fruit for Drupal 6: variable defaults

Peter Wolanin pwolanin at gmail.com
Thu May 3 19:52:36 UTC 2007


If you are concerned about cleaning up unused variables, this simple
patch for cleaning up unused node-type variables should also be added
to the mix:   http://drupal.org/node/104572

-Peter

---------- Forwarded message ----------
From: "Greg Knaddison - GVS" <Greg at GrowingVentureSolutions.com>
To: development at drupal.org, "Mohammed Sameer" <msameer at foolab.org>
Date: Thu, 3 May 2007 12:55:58 -0600
Subject: Re: [development] low hanging fruit for Drupal 6: variable defaults
On 5/3/07, Mohammed Sameer <msameer at foolab.org> wrote:
>
> If we have it as a hook then we don't really need to clean them up in hook_uninstall() because
> drupal can invoke the variables defaults hook, get the list of variables and simply delete
> them from the "registry". We now only have one problem. hook uninstall runs when the module
> is unloaded but then, we can implement the extra hook in the .install file ?
>
> Hope I'm not talking nonsense ;-)
>

I think it makes at least some sense.  My experience from looking at
hook_uninstall solutions is that lots of variables get left around.
The proposed hook_settings() would create some basic variables.    It
would probably not know about _all_ of the variables that the module
may create.  Many variable names are based on variables: e.g.
modulename_contenttype_something.  My solution for that has been to
delete all rows from variable table that start with modulename_  I
think if you try to delete specific variables I think you'll end up
leaving lots of unused keys around.

The realm idea would help a lot with the cleanup, but is not "low
hanging fruit" IMO.

Greg


More information about the development mailing list