Returning info from Drupal updates

Drupal update hooks can return info about queries run - and this is well documented.

If you want to return other informative messages about updates - just use the same format as returned by http://api.drupal.org/api/function/update_sql/6

<?php
array('success' => $result !== FALSE, 'query' => check_plain($sql));
?>

So you might have an update hook that looks like.

<?php
/**
*  Drush picks up notes from here
*  Will update myvar to new val because...
*/
function mymodule_update_6101(){
  
$items = array();
  
$myval = "foo":
  
variable_set('myvar', $myval');
   $items[] = array('
success' => TRUE, 'query = "updated variable myvar to $myval because...");
   return
$items;
}
?>

This way all changes can be logged to the update page.

Tags

Post new comment

Got something to add - just enter a comment
all other fields are optional.

Your email address will not be published.
  • 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>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image without spaces, also respect upper and lower case.