r110695 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110694‎ | r110695 | r110696 >
Date:12:17, 4 February 2012
Author:cervidae
Status:deferred
Tags:
Comment:
Removed bug-causing and redundant things at $\olduser
Modified paths:
  • /trunk/extensions/ReassignEdits/ReassignEdits_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ReassignEdits/ReassignEdits_body.php
@@ -13,7 +13,7 @@
1414 */
1515
1616 if (!defined('MEDIAWIKI')) {
17 - echo "THIS IS NOT VALID ENTRY POINT";
 17+ echo "ReassignEdits extension";
1818 exit(1);
1919 }
2020
@@ -146,11 +146,10 @@
147147 }
148148
149149 // Get usernames by id
150 - $olduser = User::newFromName( $oldusername->getText() );
151150 $newuser = User::newFromName( $newusername->getText() );
152151
153152 // It won't be an object if for instance "|" is supplied as a value
154 - if ( !is_object( $olduser ) ) {
 153+ if ( !is_string( $oldusername->getText() ) ) {
155154 $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'reassignedits-error-invalid',
156155 $oldusername->getText() ) . "</div>" );
157156 return;
@@ -161,27 +160,6 @@
162161 return;
163162 }
164163
165 - // Check for the existence of lowercase oldusername in database
166 - if ( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) {
167 - // oldusername was entered as lowercase -> check for existence in table 'user'
168 - $dbr = wfGetDB( DB_SLAVE );
169 - $uid = $dbr->selectField( 'user', 'user_id',
170 - array( 'user_name' => $oldusername->getText() ),
171 - __METHOD__ );
172 - if ( $uid === false ) {
173 - if ( !$wgCapitalLinks ) {
174 - $uid = 0; // We are on a lowercase wiki but lowercase username does not exists
175 - } else {
176 - // We are on a standard uppercase wiki, use normal
177 - $uid = $olduser->idForName();
178 - $oldusername = Title::makeTitleSafe( NS_USER, $olduser->getName() );
179 - }
180 - }
181 - } else {
182 - // oldusername was entered as upperase -> standard procedure
183 - $uid = $olduser->idForName();
184 - }
185 -
186164 // Do the heavy lifting...
187165 $reassign = new ReassignEditsSQL( $oldusername->getText(), $newusername->getText() );
188166 if ( !$reassign->reassign() ) {

Status & tagging log