dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ce00cb8
)
Update migrateUserGroup to deal with primary key issue
author
Mark A. Hershberger
<mah@everybody.org>
Wed, 20 Jun 2012 19:52:58 +0000
(15:52 -0400)
committer
Max Semenik
<maxsem.wiki@gmail.com>
Fri, 29 Jun 2012 19:39:25 +0000
(23:39 +0400)
Update migrateUserGroup so that if a user is in both the old group and
the new group, the script still succeeds. Otherwise, it will fail
with violations to the PRIMARY KEY index on the user_groups table.
Change-Id: I7bfda03f5735633d03b81092dad29d73293cd182
maintenance/migrateUserGroup.php
patch
|
blob
|
history
diff --git
a/maintenance/migrateUserGroup.php
b/maintenance/migrateUserGroup.php
index
297aaf3
..
e6eea66
100644
(file)
--- a/
maintenance/migrateUserGroup.php
+++ b/
maintenance/migrateUserGroup.php
@@
-54,7
+54,15
@@
class MigrateUserGroup extends Maintenance {
$dbw->update( 'user_groups',
array( 'ug_group' => $newGroup ),
array( 'ug_group' => $oldGroup,
- "ug_user BETWEEN $blockStart AND $blockEnd" )
+ "ug_user BETWEEN $blockStart AND $blockEnd" ),
+ __METHOD__,
+ array( 'IGNORE' )
+ );
+ $count += $dbw->affectedRows();
+ $dbw->delete( 'user_groups',
+ array( 'ug_group' => $oldGroup,
+ "ug_user BETWEEN $blockStart AND $blockEnd" ),
+ __METHOD__
);
$count += $dbw->affectedRows();
$dbw->commit( __METHOD__ );