Index: trunk/extensions/Renameuser/renameUserCleanup.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | * http://www.gnu.org/copyleft/gpl.html |
22 | 22 | * |
23 | 23 | * @ingroup Maintenance |
24 | | - * @author Ariel Glenn <ariel@wikimedia.orf> |
| 24 | + * @author Ariel Glenn <ariel@wikimedia.org> |
25 | 25 | */ |
26 | 26 | |
27 | 27 | $IP = getenv( 'MW_INSTALL_PATH' ); |
— | — | @@ -42,6 +42,7 @@ |
43 | 43 | $this->output( "Rename User Cleanup starting...\n\n" ); |
44 | 44 | $olduser = User::newFromName( $this->getOption( 'olduser' ) ); |
45 | 45 | $newuser = User::newFromName( $this->getOption( 'newuser' ) ); |
| 46 | + |
46 | 47 | if ( !$newuser->getId() ) { |
47 | 48 | $this->error( "No such user: " . $this->getOption( 'newuser' ), true ); |
48 | 49 | exit(1); |
— | — | @@ -79,8 +80,14 @@ |
80 | 81 | __METHOD__ |
81 | 82 | ); |
82 | 83 | 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 | + } |
85 | 92 | } |
86 | 93 | else { |
87 | 94 | foreach ( $result as $row ) { |
— | — | @@ -93,7 +100,7 @@ |
94 | 101 | print("Found log entry of the rename: ".$olduser->getName()." to ".$newuser->getName()." on $row->log_timestamp\n"); |
95 | 102 | } |
96 | 103 | } |
97 | | - if ($result->numRows() > 1) { |
| 104 | + if ($result && $result->numRows() > 1) { |
98 | 105 | print("More than one rename entry found in the log, not sure what to do. Continue anyways? [N/y] "); |
99 | 106 | $stdin = fopen ("php://stdin","rt"); |
100 | 107 | $line = fgets($stdin); |