[development] Process in code when experiencing an install error in a custom module

Earnie Boyd earnie at users.sourceforge.net
Mon Oct 8 12:06:12 UTC 2012

On Mon, Oct 8, 2012 at 7:59 AM, Jeff Greenberg
<listmail.ayendesigns at gmail.com> wrote:
> Right. One example is simply losing the database connection in the middle of
> the process. Basically, for whatever cause the installation is unable to
> finish, I am typically then left in a position where I cannot uninstall the
> module and cannot reinstall it because of spurious db entries. And since
> Drupal doesn't really care which type of db tables are being created (and at
> some point, which type of db), depending on db transactions and rollback is
> not viable.

You could always check to see if the table exists and if it does drop
it first.  But if the Drupal system table row already states installed
you're really SOL with the failed install anyway and must manually
reset the column in the system table.  Another step that could be
performed is a variable_set() which indicates a successful
installation so that you can filter the drop based on whether or not
the install occurred successfully once.  Make sure to variable_del()
on uninstall.

-- https://sites.google.com/site/earnieboyd

More information about the development mailing list