From 032c1ef39105c251c66ea77e5df01abb9cdeef27 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 11 Jun 2004 02:52:17 +0000 Subject: [PATCH] transactions, using updateArticle() instead of quickEdit() --- maintenance/archives/moveCustomMessages.inc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/maintenance/archives/moveCustomMessages.inc b/maintenance/archives/moveCustomMessages.inc index abab1a57f7..5438194690 100644 --- a/maintenance/archives/moveCustomMessages.inc +++ b/maintenance/archives/moveCustomMessages.inc @@ -7,7 +7,7 @@ function isTemplateInitialised() { } function moveCustomMessages( $phase ) { - global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang ; + global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang; global $targets, $template, $replaceCount; $wgUser = new User; @@ -15,6 +15,8 @@ function moveCustomMessages( $phase ) { $wgUser->setName( "Template namespace initialisation script" ); $wgUser->addRight( "bot" ); + wfIgnoreSQLErrors( true ); + # Compose DB key array $dbkeys = array(); @@ -59,6 +61,7 @@ function moveCustomMessages( $phase ) { if ( $phase == 0 || $phase == 2 ) { print "\nMoving pages...\n"; foreach ( $targets as $partial => $dummy ) { + wfQuery( "BEGIN", DB_WRITE ); $ot = Title::makeTitle( NS_MEDIAWIKI, $partial ); $nt = Title::makeTitle( NS_TEMPLATE, $partial ); print "$partial..."; @@ -73,6 +76,7 @@ function moveCustomMessages( $phase ) { $up = array_pop( $wgDeferredUpdateList ); $up->doUpdate(); } + wfQuery( "COMMIT", DB_WRITE ); } } @@ -93,6 +97,7 @@ function moveCustomMessages( $phase ) { $dest = Title::makeTitle( NS_MEDIAWIKI, $partial ); $linksTo = $dest->getLinksTo(); foreach( $linksTo as $source ) { + wfQuery( "BEGIN", DB_WRITE ); $pdbk = $source->getPrefixedDBkey(); if ( !array_key_exists( $pdbk, $completedTitles ) ) { $completedTitles[$pdbk] = 1; @@ -110,11 +115,17 @@ function moveCustomMessages( $phase ) { if ( $text != $row->cur_text ) { print "$pdbk\n"; $art = new Article( $source ); - $art->quickEdit( $text ); + $art->updateArticle( $text, "", false, false ); + # Do deferred updates + while ( count( $wgDeferredUpdateList ) ) { + $up = array_pop( $wgDeferredUpdateList ); + $up->doUpdate(); + } } else { print "($pdbk)\n"; } } + wfQuery( "COMMIT", DB_WRITE ); } } } -- 2.20.1