User login

Delete from Drupal variable table where name LIKE

delete from variable where LIKE drupal

There are occasions when the usual approach:
variable_del('cmt_example_variable');
won't work.

This is not recommended as a shortcut, and in fact even here is problematic should there ever be a module called cmt_teaser_

/**
* Implementation of hook_uninstall().
*/
function cmt_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'cmt_teaser_%'");
  cache_clear_all('variables', 'cache');
}

So this is bad practice, but I don't see

I'm not going to keep track of all the node types that ever were available to Community-Managed Taxonomy and might have had this variable created. I suppose I could just delete the variables for node types currently available to CMT and possibly leave a few variables, is better than the even slighter risk of deleting another modules variables?

Well, if anyone makes a module called cmt_teaser ... let Agaric know!

delete from variable where LIKE drupal

There are occasions when the usual approach:
variable_del('cmt_example_variable');
won't work.

This is not recommended as a shortcut, and in fact even here is problematic should there ever be a module called cmt_teaser_

/**
* Implementation of hook_uninstall().
*/
function cmt_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'cmt_teaser_%'");
  cache_clear_all('variables', 'cache');
}

So this is bad practice, but I don't see

I'm not going to keep track of all the node types that ever were available to Community-Managed Taxonomy and might have had this variable created. I suppose I could just delete the variables for node types currently available to CMT and possibly leave a few variables, is better than the even slighter risk of deleting another modules variables?

Well, if anyone makes a module called cmt_teaser ... let Agaric know!

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.