add a damn deadlock loop on this thing
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 3 Oct 2008 22:23:03 +0000 (22:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 3 Oct 2008 22:23:03 +0000 (22:23 +0000)
maintenance/updateRestrictions.php

index fd4c271..7041e59 100644 (file)
@@ -66,7 +66,12 @@ function migrate_page_restrictions( $db ) {
                # We use insert() and not replace() as Article.php replaces
                # page_restrictions with '' when protected in the restrictions table
                if ( count( $batch ) ) {
-                       $db->insert( 'page_restrictions', $batch, __FUNCTION__, array( 'IGNORE' ) );
+                       $ok = $db->deadlockLoop(
+                               array( $db, 'insert' ),
+                               'page_restrictions', $batch, __FUNCTION__, array( 'IGNORE' ) );
+                       if( !$ok ) {
+                               throw new MWException( "Deadlock loop failed wtf :(" );
+                       }
                }
                $blockStart += BATCH_SIZE - 1;
                $blockEnd += BATCH_SIZE - 1;