Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The patch deletes all page title variables in once after uninstalling the module. It also uses the D7 database abstraction layer API. What do you think ?
Comment | File | Size | Author |
---|---|---|---|
page_title_uninstall.patch | 1.25 KB | hles |
Comments
Comment #1
nicholasThompsonI have toyed with this idea before.
We assume that any variable prefixed with page_title is related to the Page Title module. Is this safe? What if another module overlaps our namespace? Yeah, that's unlikely (and stupid of the other module), but does that give us to right to wipe their settings?
An alternative is to migrate all settings into a single variable - much the same way GlobalRedirect has recently done. See here (GlobalRedirect.module 1.1.2.4.2.5.2.32 line 322).
This has several advantages:
Arguably this is a separate conversation to the "
DELETE FROM {variables} WHERE name LIKE "page_title%"
"... but I think it's something we should be working towards.Comment #2
hles CreditAttribution: hles commentedpage_title namespace might be more subject to overlaps than other modules because page and title are very common words, so i think it was not such a good idea after all.
I didn't know about that GlobalRedirect implementation, sounds good to me. As this is a minor issue because uninstall just works fine, i guess there's no hurry to work on that then.
Comment #3
nicholasThompsonFor reference: http://drupalcode.org/viewvc/drupal/contributions/modules/globalredirect...
Advantages:
variable_get
Comment #4
Dave ReidI'm not a huge fan of this for uninstall. It can potentially clobber modules that extend page_title, and doesn't follow the pattern of core by taking care of your own variables individually (no core module uninstalls their variables this way).
Another side note is that if you merge your variables into one giant array variable then it becomes significantly harder if not impossible to override variables using the $conf global in your site's settings.php file.
Comment #5
nicholasThompsonAh. Yes. That is a fair point. I'd not considered the impact on
$conf
. Would it be sensible to look for 'page_title_conf_override' in variable_get as a key which should only be set from settings.php?