Uninstalling module and deletion variables

sysname - July 22, 2009 - 06:41
Project:Acidfree Albums
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

Uninstall module will delete all variables which names contains 's'. All variables of ALL existing modules & themes.

This statement db_query("DELETE FROM {variable} WHERE name LIKE '%%s%'", 'acidfree');
is equal to DELETE FROM {variable} WHERE name LIKE '%s%'

Need to be

  variable_del('acidfree_variable_name_1);
  variable_del('acidfree_variable_name_2);
  variable_del('acidfree_variable_name_3);

Sorry for my bad English.

#1

kari.nies - July 25, 2009 - 00:49

Subscribing and hoping for a solution. I really want to uninstall this module.

#2

sysname - August 1, 2009 - 05:47

file 'acidfree.install'

ORIGIN

<?php
function acidfree_uninstall() {
   
db_query('DROP TABLE {acidfree_album}');
   
db_query("DELETE FROM {variable} WHERE name LIKE '%%s%'", 'acidfree');
   
taxonomy_del_vocabulary(variable_get('acidfree_vocab_id', 0));
   
db_query("DELETE FROM {blocks} WHERE module = '%s'", 'acidfree');
}
?>

Minimal changes:
-change order of 2nd and 3rd strings
-corrected SQL statement in NEW 3rd string.

<?php
function acidfree_uninstall() {
   
db_query('DROP TABLE {acidfree_album}');
   
taxonomy_del_vocabulary(variable_get('acidfree_vocab_id', 0));
   
db_query("DELETE FROM {variable} WHERE name LIKE '%acidfree%'");
   
db_query("DELETE FROM {blocks} WHERE module = '%s'", 'acidfree');
}
?>

#3

kari.nies - August 5, 2009 - 00:21

That seems to have done the trick. Thank you very much for the update!

 
 

Drupal is a registered trademark of Dries Buytaert.