r101975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101974‎ | r101975 | r101976 >
Date:11:10, 4 November 2011
Author:ariel
Status:ok
Tags:
Comment:
typo in email; ability to override result of check for rename of user in logs
Modified paths:
  • /trunk/extensions/Renameuser/renameUserCleanup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/renameUserCleanup.php
@@ -20,7 +20,7 @@
2121 * http://www.gnu.org/copyleft/gpl.html
2222 *
2323 * @ingroup Maintenance
24 - * @author Ariel Glenn <ariel@wikimedia.orf>
 24+ * @author Ariel Glenn <ariel@wikimedia.org>
2525 */
2626
2727 $IP = getenv( 'MW_INSTALL_PATH' );
@@ -42,6 +42,7 @@
4343 $this->output( "Rename User Cleanup starting...\n\n" );
4444 $olduser = User::newFromName( $this->getOption( 'olduser' ) );
4545 $newuser = User::newFromName( $this->getOption( 'newuser' ) );
 46+
4647 if ( !$newuser->getId() ) {
4748 $this->error( "No such user: " . $this->getOption( 'newuser' ), true );
4849 exit(1);
@@ -79,8 +80,14 @@
8081 __METHOD__
8182 );
8283 if (! $result || ! $result->numRows() ) {
83 - print("No log entry found for a rename of ".$olduser->getName()." to ".$newuser->getName().", giving up\n");
84 - exit(1);
 84+ print("No log entry found for a rename of ".$olduser->getName()." to ".$newuser->getName().", proceed anyways??? [N/y] ");
 85+ $stdin = fopen ("php://stdin","rt");
 86+ $line = fgets($stdin);
 87+ fclose($stdin);
 88+ if ( $line[0] != "Y" && $line[0] != "y" ) {
 89+ print("Exiting at user's request\n");
 90+ exit(1);
 91+ }
8592 }
8693 else {
8794 foreach ( $result as $row ) {
@@ -93,7 +100,7 @@
94101 print("Found log entry of the rename: ".$olduser->getName()." to ".$newuser->getName()." on $row->log_timestamp\n");
95102 }
96103 }
97 - if ($result->numRows() > 1) {
 104+ if ($result && $result->numRows() > 1) {
98105 print("More than one rename entry found in the log, not sure what to do. Continue anyways? [N/y] ");
99106 $stdin = fopen ("php://stdin","rt");
100107 $line = fgets($stdin);

Status & tagging log