In paranoia's hook_drush_sql_sync_sanitize implementation (paranoia_drush_sql_sync_sanitize()) in paranoia.drush.inc the watchdog table gets truncated. This only makes sense if the dblog module is enabled. If dblog is not enabled, this causes an error which prevents subsequent sanitization operations from being executed:

ERROR 1146 (42S02) at line 1: Table 'watchdog' doesn't exist

I propose that paranoia should only truncate the watchdog table if module_exists('dblog');. I will submit a patch shortly with a proposed implementation.

Comments

jamesharv’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB

Patch attached.

greggles’s picture

Makes sense to me.

greggles’s picture

StatusFileSize
new1000 bytes

How about this style?

My theory is that someone might have watchdog enabled and then disable it and there's data in the table even if the module is not enabled.

greggles’s picture

Title: During sanitize, only truncate watchdog table if module enabled » During sanitize, only truncate watchdog table if table exists
greggles’s picture

Status: Needs review » Fixed
greggles’s picture

Turns out that neither module_exists nor db_table_exists work because they are not yet included. Manually bootstrapping works.

http://drupalcode.org/project/paranoia.git/commit/80fc22e

rgristroph’s picture

I can confirm that without #6 "drush sql-sanitize" gives me an error, and with it, the sql-sanitize works. The error I get without that patch is:

PHP Fatal error: Call to undefined function db_table_exists() in /XXXXXX/docroot/sites/all/modules/contrib/paranoia/paranoia.drush.inc on line 27
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function db_table_exists() in
/XXXXXX/docroot/sites/all/modules/contrib/paranoia/paranoia.drush.inc,
line 27

I get that error using the 7.x-1.1 version of paranoia without the patch.

--Rob

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

greggles’s picture

Turns out I didn't actually commit the patch from #6.

Now actually done: http://drupalcode.org/project/paranoia.git/commit/480a372 Will make a new release.

greggles’s picture