From 1b6f172daa92499f2a2bd7a9341f6617abc5e0e2 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 5 Sep 2013 14:19:15 +0800 Subject: Bug 912479: merge-users.pl causes foreign key constraint errors in the user-profile tables --- contrib/merge-users.pl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'contrib') diff --git a/contrib/merge-users.pl b/contrib/merge-users.pl index ee6ec8628..99fe3fef0 100755 --- a/contrib/merge-users.pl +++ b/contrib/merge-users.pl @@ -50,6 +50,7 @@ use Bugzilla; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::User; +use Bugzilla::Hook; use Getopt::Long; use Pod::Usage; @@ -156,6 +157,9 @@ foreach my $table (qw(logincookies tokens profiles)) { # Start the transaction $dbh->bz_start_transaction(); +# BMO - pre-work hook +Bugzilla::Hook::process('merge_users_before', { old_id => $old_id, new_id => $new_id }); + # Delete old records from logincookies and tokens tables. $dbh->do('DELETE FROM logincookies WHERE userid = ?', undef, $old_id); $dbh->do('DELETE FROM tokens WHERE userid = ?', undef, $old_id); @@ -234,6 +238,9 @@ $dbh->do('DELETE FROM profiles WHERE userid = ?', undef, $old_id); my $user = new Bugzilla::User($new_id); $user->derive_regexp_groups(); +# BMO - post-work hook +Bugzilla::Hook::process('merge_users_after', { old_id => $old_id, new_id => $new_id }); + # Commit the transaction $dbh->bz_commit_transaction(); -- cgit v1.2.3-24-g4f1b