[development] Debugging updates

Gordon Heydon gordon at heydon.com.au
Fri Oct 19 15:05:00 UTC 2007


What I usually do is turn off js and then I can just use var_dump() to
print to the page, or you can just return the messages as errors from
the hook_update_n() like

$ret[] = array(
  'success' => false,
  'query' => t('Default currency needs to be set before the update can
continue. Use the <a href="!link">Receipt type settings</a> to set the
default currenecy', array('!link' =>

I used this in e-Commerce to stop the update (with a little extra code
to remove the additional updates), but it should not interfer


Karen Stevenson wrote:
> Does anyone have ideas for ways to debug update functions in the
> install file figure out what's going on when they don't work as
> expected or when I get reports of problems?
> Is there any way to see the query logs that the devel module creates
> from within updates? If I use update_sql() I can tell what queries
> ran, but there are times when I need to use db_query() instead and I
> can get no clue to what is going on when that runs. And I can't find
> any way to display messages back to myself or see results of
> print_r() or any of the other things I do elsewhere to debug scripts.
> I've tried to execute the update() script directly from within a
> normal page, but that won't work either.
> Ideas welcome!
> Karen
> !DSPAM:1000,4718c26495981804284693!

More information about the development mailing list