summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-09-05 08:19:15 +0200
committerByron Jones <bjones@mozilla.com>2013-09-05 08:19:15 +0200
commit1b6f172daa92499f2a2bd7a9341f6617abc5e0e2 (patch)
tree3433009b08e1d6f90ab9e03540ad89929de679e0 /contrib
parent31ffd236e011d56a6065f47693e9bc091104a94e (diff)
downloadbugzilla-1b6f172daa92499f2a2bd7a9341f6617abc5e0e2.tar.gz
bugzilla-1b6f172daa92499f2a2bd7a9341f6617abc5e0e2.tar.xz
Bug 912479: merge-users.pl causes foreign key constraint errors in the user-profile tables
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/merge-users.pl7
1 files changed, 7 insertions, 0 deletions
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();