r92149 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92148‎ | r92149 | r92150 >
Date:11:07, 14 July 2011
Author:ariel
Status:ok
Tags:
Comment:
search for older format log entries in case the new format ones aren't there, clean up check for existence
Modified paths:
  • /trunk/extensions/Renameuser/renameUserCleanup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/renameUserCleanup.php
@@ -67,12 +67,29 @@
6868 ),
6969 __METHOD__
7070 );
71 - if (! $result ) {
72 - print("No log entry found for a rename of ".$olduser->getName()." to ".$newuser->getName().", giving up\n");
73 - exit(1);
 71+ if (! $result || ! $result->numRows() ) {
 72+ // try the old format
 73+ $result = $dbr->select( 'logging', '*',
 74+ array( 'log_type' => 'renameuser',
 75+ 'log_action' => 'renameuser',
 76+ 'log_title' => $olduser->getName(),
 77+ ),
 78+ __METHOD__
 79+ );
 80+ if (! $result || ! $result->numRows() ) {
 81+ print("No log entry found for a rename of ".$olduser->getName()." to ".$newuser->getName().", giving up\n");
 82+ exit(1);
 83+ }
 84+ else {
 85+ foreach ( $result as $row ) {
 86+ print("Found possible log entry of the rename, please check: ".$row->log_title." with comment ".$row->log_comment." on $row->log_timestamp\n");
 87+ }
 88+ }
7489 }
75 - foreach ( $result as $row ) {
76 - print("Found log entry of the rename: ".$olduser->getName()." to ".$newuser->getName()." on $row->log_timestamp\n");
 90+ else {
 91+ foreach ( $result as $row ) {
 92+ print("Found log entry of the rename: ".$olduser->getName()." to ".$newuser->getName()." on $row->log_timestamp\n");
 93+ }
7794 }
7895 if ($result->numRows() > 1) {
7996 print("More than one rename entry found in the log, not sure what to do. Continue anyways? [N/y] ");
@@ -91,7 +108,7 @@
92109 $this->updateTable('logging', 'log_user_text', 'log_user', 'log_timestamp', $olduser, $newuser, $dbw);
93110 $this->updateTable('image', 'img_user_text', 'img_user', 'img_timestamp', $olduser, $newuser, $dbw);
94111 $this->updateTable('oldimage', 'oi_user_text', 'oi_user', 'oi_timestamp', $olduser, $newuser, $dbw);
95 -# FIXME: updateTable('filearchive', 'fa_user_text','fa_user', 'fa_timestamp', $olduser, $newuser, $dbw); (not indexed yet)
 112+ $this->updateTable('filearchive', 'fa_user_text','fa_user', 'fa_timestamp', $olduser, $newuser, $dbw);
96113 print "Done!\n";
97114 exit(0);
98115 }

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