r91992 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91991‎ | r91992 | r91993 >
Date:19:58, 12 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r91832, fix 2 undefined $db for $dbw
Modified paths:
  • /trunk/extensions/Renameuser/renameUserCleanup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/renameUserCleanup.php
@@ -100,10 +100,10 @@
101101 public function updateTable($table,$usernamefield,$useridfield,$timestampfield,$olduser,$newuser,$dbw) {
102102 $doUid = 0;
103103
104 - $contribs = $dbw->selectField( $table, 'count(*)',
 104+ $contribs = $dbw->selectField( $table, 'count(*)',
105105 array( $usernamefield => $olduser->getName(), $useridfield => $newuser->getId() ), __METHOD__ );
106106 if ($contribs == 0) {
107 - $contribs = $dbw->selectField( $table, 'count(*)',
 107+ $contribs = $dbw->selectField( $table, 'count(*)',
108108 array( $usernamefield => $olduser->getName(), $useridfield => 0 ), __METHOD__ );
109109 if ($contribs > 0) {
110110 print("Found $contribs edits to be re-attributed from table $table but the uid present is 0 (should be ".$newuser->getId().")\n");
@@ -155,11 +155,11 @@
156156 return(0);
157157 }
158158 $dbw->begin();
159 - $result = $dbw->select( $table, $timestampfield, $selectConds , __METHOD__,
 159+ $result = $dbw->select( $table, $timestampfield, $selectConds , __METHOD__,
160160 array( 'ORDER BY' => $timestampfield.' DESC', 'LIMIT' => self::BATCH_SIZE ) );
161161 if (! $result) {
162162 print("There were rows for updating but now they are gone. Skipping.\n");
163 - $db->rollback();
 163+ $dbw->rollback();
164164 return(0);
165165 }
166166 $result->seek($result->numRows() -1 );
@@ -173,10 +173,10 @@
174174 }
175175 else {
176176 print("problem with the update, rolling back and exiting\n");
177 - $db->rollback();
 177+ $dbw->rollback();
178178 exit(1);
179179 }
180 - $contribs = User::edits( $olduser->getId() );
 180+ //$contribs = User::edits( $olduser->getId() );
181181 $contribs = $dbw->selectField( $table, 'count(*)', $selectConds, __METHOD__ );
182182 print("updated $rowsDone edits; $contribs edits remaining to be re-attributed\n");
183183 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91832fix issues after failed renameUser; this script will ask for lots of confirma...ariel14:20, 10 July 2011

Status & tagging log