From 32f37bf938efe7a85b72ad2429e715269abc6fee Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 12 Jun 2011 10:49:48 +0200 Subject: [PATCH] [ticket/9892] Drop Q&A CAPTCHA tables if left in inconsistent state PHPBB3-9892 --- phpBB/install/database_update.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7bf41c8450..dce77a67d7 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1913,6 +1913,30 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + global $db_tools; + + // Recover from potentially broken Q&A CAPTCHA table on firebird + if ($db_tools->sql_layer == 'firebird') + { + if ($config['captcha_plugin'] == 'phpbb_captcha_qa') + { + setconfig('captcha_plugin', 'phpbb_captcha_nogd'); + } + + $tables = array( + $table_prefix . 'captcha_questions', + $table_prefix . 'captcha_answers', + $table_prefix . 'qa_confirm', + ); + foreach ($tables as $table) + { + if ($db_tools->sql_table_exists($table)) + { + $db_tools->sql_table_drop($table); + } + } + } + $no_updates = false; break; }