Index: trunk/extensions/Renameuser/renameUserCleanup.php |
— | — | @@ -67,12 +67,29 @@ |
68 | 68 | ), |
69 | 69 | __METHOD__ |
70 | 70 | ); |
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 | + } |
74 | 89 | } |
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 | + } |
77 | 94 | } |
78 | 95 | if ($result->numRows() > 1) { |
79 | 96 | print("More than one rename entry found in the log, not sure what to do. Continue anyways? [N/y] "); |
— | — | @@ -91,7 +108,7 @@ |
92 | 109 | $this->updateTable('logging', 'log_user_text', 'log_user', 'log_timestamp', $olduser, $newuser, $dbw); |
93 | 110 | $this->updateTable('image', 'img_user_text', 'img_user', 'img_timestamp', $olduser, $newuser, $dbw); |
94 | 111 | $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); |
96 | 113 | print "Done!\n"; |
97 | 114 | exit(0); |
98 | 115 | } |