r66544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66543‎ | r66544 | r66545 >
Date:18:00, 16 May 2010
Author:siebrand
Status:ok
Tags:
Comment:
Stylize.php, update indentation, remove trailing whitespace.

Mainly to cover up my not updating indentation after copying wfRenameuserOnContribsLink() in r66543 from AbuseFilter, as spotted by ialex.
Modified paths:
  • /trunk/extensions/Renameuser/RenameUserJob.php (modified) (history)
  • /trunk/extensions/Renameuser/Renameuser.i18n.php (modified) (history)
  • /trunk/extensions/Renameuser/Renameuser.php (modified) (history)
  • /trunk/extensions/Renameuser/Renameuser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/RenameUserJob.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /**
54 * Custom job to perform updates on tables in busier environments
65 */
@@ -26,15 +25,15 @@
2726 # Conditions like "*_user_text = 'x'
2827 $conds = array( $column => $oldname );
2928 # If user ID given, add that to condition to avoid rename collisions.
30 - if( isset($userID) ) {
 29+ if ( isset( $userID ) ) {
3130 $conds[$uidColumn] = $userID;
3231 }
3332 # Bound by timestamp if given
34 - if( isset($timestampColumn) ) {
 33+ if ( isset( $timestampColumn ) ) {
3534 $conds[] = "$timestampColumn >= '$minTimestamp'";
3635 $conds[] = "$timestampColumn <= '$maxTimestamp'";
3736 # Otherwise, bound by key (B/C)
38 - } else if( isset($uniqueKey) ) {
 37+ } else if ( isset( $uniqueKey ) ) {
3938 $conds[$uniqueKey] = $keyId;
4039 } else {
4140 wfDebug( 'RenameUserJob::run - invalid job row given' ); // this shouldn't happen
@@ -47,11 +46,11 @@
4847 __METHOD__
4948 );
5049 # Special case: revisions may be deleted while renaming...
51 - if( $table == 'revision' && isset($timestampColumn) ) {
 50+ if ( $table == 'revision' && isset( $timestampColumn ) ) {
5251 $actual = $dbw->affectedRows();
5352 # If some revisions were not renamed, they may have been deleted.
5453 # Do a pass on the archive table to get these straglers...
55 - if( $actual < $count ) {
 54+ if ( $actual < $count ) {
5655 $dbw->update( 'archive',
5756 array( 'ar_user_text' => $newname ),
5857 array( 'ar_user_text' => $oldname,
@@ -59,17 +58,17 @@
6059 // No user,rev_id index, so use timestamp to bound
6160 // the rows. This can use the user,timestamp index.
6261 "ar_timestamp >= '$minTimestamp'",
63 - "ar_timestamp <= '$maxTimestamp'"),
 62+ "ar_timestamp <= '$maxTimestamp'" ),
6463 __METHOD__
6564 );
6665 }
6766 }
6867 # Special case: revisions may be restored while renaming...
69 - if( $table == 'archive' && isset($timestampColumn) ) {
 68+ if ( $table == 'archive' && isset( $timestampColumn ) ) {
7069 $actual = $dbw->affectedRows();
7170 # If some revisions were not renamed, they may have been restored.
7271 # Do a pass on the revision table to get these straglers...
73 - if( $actual < $count ) {
 72+ if ( $actual < $count ) {
7473 $dbw->update( 'revision',
7574 array( 'rev_user_text' => $newname ),
7675 array( 'rev_user_text' => $oldname,
@@ -77,12 +76,11 @@
7877 // No user,rev_id index, so use timestamp to bound
7978 // the rows. This can use the user,timestamp index.
8079 "rev_timestamp >= '$minTimestamp'",
81 - "rev_timestamp <= '$maxTimestamp'"),
 80+ "rev_timestamp <= '$maxTimestamp'" ),
8281 __METHOD__
8382 );
8483 }
8584 }
8685 return true;
8786 }
88 -
89 -}
\ No newline at end of file
 87+}
Index: trunk/extensions/Renameuser/Renameuser_body.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 if ( !defined( 'MEDIAWIKI' ) ) {
54 echo "RenameUser extension\n";
65 exit( 1 );
@@ -13,7 +12,6 @@
1413 * user accounts
1514 */
1615 class SpecialRenameuser extends SpecialPage {
17 -
1816 /**
1917 * Constructor
2018 */
@@ -33,11 +31,11 @@
3432 $this->setHeaders();
3533 $wgOut->addWikiMsg( 'renameuser-summary' );
3634
37 - if( !$wgUser->isAllowed( 'renameuser' ) ) {
 35+ if ( !$wgUser->isAllowed( 'renameuser' ) ) {
3836 $wgOut->permissionRequired( 'renameuser' );
3937 return;
4038 }
41 - if( wfReadOnly() ) {
 39+ if ( wfReadOnly() ) {
4240 $wgOut->readOnlyPage();
4341 return;
4442 }
@@ -54,13 +52,13 @@
5553 // If nothing given for these flags, assume they are checked
5654 // unless this is a POST submission.
5755 $move_checked = true;
58 - if( $wgRequest->wasPosted() ) {
59 - if( !$wgRequest->getCheck( 'movepages' ) ) {
 56+ if ( $wgRequest->wasPosted() ) {
 57+ if ( !$wgRequest->getCheck( 'movepages' ) ) {
6058 $move_checked = false;
6159 }
6260 }
6361 $warnings = array();
64 - if( $oun && $nun && !$wgRequest->getCheck( 'confirmaction' ) ) {
 62+ if ( $oun && $nun && !$wgRequest->getCheck( 'confirmaction' ) ) {
6563 wfRunHooks( 'RenameUserWarning', array( $oun, $nun, &$warnings ) );
6664 }
6765
@@ -95,21 +93,21 @@
9694 "</td>
9795 </tr>"
9896 );
99 - if( $wgUser->isAllowed( 'move' ) ) {
 97+ if ( $wgUser->isAllowed( 'move' ) ) {
10098 $wgOut->addHTML( "
10199 <tr>
102100 <td>&nbsp;
103101 </td>
104102 <td class='mw-input'>" .
105 - Xml::checkLabel( wfMsg( 'renameusermove' ), 'movepages', 'movepages',
 103+ Xml::checkLabel( wfMsg( 'renameusermove' ), 'movepages', 'movepages',
106104 $move_checked, array( 'tabindex' => '4' ) ) .
107105 "</td>
108106 </tr>"
109107 );
110108 }
111 - if( $warnings ) {
 109+ if ( $warnings ) {
112110 $warningsHtml = array();
113 - foreach( $warnings as $warning )
 111+ foreach ( $warnings as $warning )
114112 $warningsHtml[] = is_array( $warning ) ?
115113 call_user_func_array( 'wfMsgWikiHtml', $warning ) :
116114 wfMsgHtml( $warning );
@@ -118,8 +116,8 @@
119117 <td class='mw-label'>" . wfMsgWikiHtml( 'renameuserwarnings' ) . "
120118 </td>
121119 <td class='mw-input'>" .
122 - '<ul style="color: red; font-weight: bold"><li>'.
123 - implode( '</li><li>', $warningsHtml ).'</li></ul>'.
 120+ '<ul style="color: red; font-weight: bold"><li>' .
 121+ implode( '</li><li>', $warningsHtml ) . '</li></ul>' .
124122 "</td>
125123 </tr>"
126124 );
@@ -128,7 +126,7 @@
129127 <td>&nbsp;
130128 </td>
131129 <td class='mw-input'>" .
132 - Xml::checkLabel( wfMsg( 'renameuserconfirm' ), 'confirmaction', 'confirmaction',
 130+ Xml::checkLabel( wfMsg( 'renameuserconfirm' ), 'confirmaction', 'confirmaction',
133131 false, array( 'tabindex' => '6' ) ) .
134132 "</td>
135133 </tr>"
@@ -139,10 +137,10 @@
140138 <td>&nbsp;
141139 </td>
142140 <td class='mw-submit'>" .
143 - Xml::submitButton( wfMsg( 'renameusersubmit' ), array( 'name' => 'submit',
 141+ Xml::submitButton( wfMsg( 'renameusersubmit' ), array( 'name' => 'submit',
144142 'tabindex' => '7', 'id' => 'submit' ) ) .
145143 ' ' .
146 - Xml::submitButton( wfMsg( 'blocklogpage' ), array ( 'name' => 'submit-showBlockLog',
 144+ Xml::submitButton( wfMsg( 'blocklogpage' ), array ( 'name' => 'submit-showBlockLog',
147145 'id' => 'submit-showBlockLog', 'tabindex' => '8' ) ) .
148146 "</td>
149147 </tr>" .
@@ -153,35 +151,35 @@
154152 );
155153
156154 // Show block log if requested
157 - if( $showBlockLog && is_object( $oldusername ) ) {
 155+ if ( $showBlockLog && is_object( $oldusername ) ) {
158156 $this->showLogExtract( $oldusername, 'block', $wgOut ) ;
159157 return;
160158 }
161159
162 - if( $wgRequest->getText( 'token' ) === '' ) {
 160+ if ( $wgRequest->getText( 'token' ) === '' ) {
163161 # They probably haven't even submitted the form, so don't go further.
164162 return;
165 - } elseif( $warnings ) {
 163+ } elseif ( $warnings ) {
166164 # Let user read warnings
167165 return;
168 - } elseif( !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) {
 166+ } elseif ( !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) {
169167 $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameuser-error-request' ) . "</div>" );
170168 return;
171 - } elseif( !is_object( $oldusername ) ) {
 169+ } elseif ( !is_object( $oldusername ) ) {
172170 $wgOut->addWikiText(
173171 "<div class=\"errorbox\">"
174172 . wfMsg( 'renameusererrorinvalid', $wgRequest->getText( 'oldusername' ) )
175173 . "</div>"
176174 );
177175 return;
178 - } elseif( !is_object( $newusername ) ) {
 176+ } elseif ( !is_object( $newusername ) ) {
179177 $wgOut->addWikiText(
180178 "<div class=\"errorbox\">"
181179 . wfMsg( 'renameusererrorinvalid', $wgRequest->getText( 'newusername' ) )
182180 . "</div>"
183181 );
184182 return;
185 - } elseif( $oldusername->getText() == $newusername->getText() ) {
 183+ } elseif ( $oldusername->getText() == $newusername->getText() ) {
186184 $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameuser-error-same-user' ) . "</div>" );
187185 return;
188186 }
@@ -191,27 +189,27 @@
192190 $newuser = User::newFromName( $newusername->getText(), 'creatable' );
193191
194192 // It won't be an object if for instance "|" is supplied as a value
195 - if( !is_object( $olduser ) ) {
196 - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid',
 193+ if ( !is_object( $olduser ) ) {
 194+ $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid',
197195 $oldusername->getText() ) . "</div>" );
198196 return;
199197 }
200 - if( !is_object( $newuser ) || !User::isCreatableName( $newuser->getName() ) ) {
201 - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid',
 198+ if ( !is_object( $newuser ) || !User::isCreatableName( $newuser->getName() ) ) {
 199+ $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid',
202200 $newusername->getText() ) . "</div>" );
203201 return;
204202 }
205203
206204 // Check for the existence of lowercase oldusername in database.
207205 // Until r19631 it was possible to rename a user to a name with first character as lowercase
208 - if( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) {
 206+ if ( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) {
209207 // oldusername was entered as lowercase -> check for existence in table 'user'
210208 $dbr = wfGetDB( DB_SLAVE );
211 - $uid = $dbr->selectField( 'user', 'user_id',
212 - array( 'user_name' => $oldusername->getText() ),
 209+ $uid = $dbr->selectField( 'user', 'user_id',
 210+ array( 'user_name' => $oldusername->getText() ),
213211 __METHOD__ );
214 - if( $uid === false ) {
215 - if( !$wgCapitalLinks ) {
 212+ if ( $uid === false ) {
 213+ if ( !$wgCapitalLinks ) {
216214 $uid = 0; // We are on a lowercase wiki but lowercase username does not exists
217215 } else {
218216 // We are on a standard uppercase wiki, use normal
@@ -224,14 +222,14 @@
225223 $uid = $olduser->idForName();
226224 }
227225
228 - if( $uid == 0 ) {
229 - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrordoesnotexist' ,
 226+ if ( $uid == 0 ) {
 227+ $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrordoesnotexist' ,
230228 $oldusername->getText() ) . "</div>" );
231229 return;
232230 }
233231
234 - if( $newuser->idForName() != 0 ) {
235 - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorexists',
 232+ if ( $newuser->idForName() != 0 ) {
 233+ $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorexists',
236234 $newusername->getText() ) . "</div>" );
237235 return;
238236 }
@@ -240,9 +238,9 @@
241239 $contribs = User::edits( $uid );
242240
243241 // Check edit count
244 - if( !$wgUser->isAllowed( 'siteadmin' ) ) {
 242+ if ( !$wgUser->isAllowed( 'siteadmin' ) ) {
245243 if ( RENAMEUSER_CONTRIBLIMIT != 0 && $contribs > RENAMEUSER_CONTRIBLIMIT ) {
246 - $wgOut->addWikiText( "<div class=\"errorbox\">" .
 244+ $wgOut->addWikiText( "<div class=\"errorbox\">" .
247245 wfMsg( 'renameusererrortoomany',
248246 $oldusername->getText(),
249247 $wgLang->formatNum( $contribs ),
@@ -254,29 +252,29 @@
255253 }
256254
257255 // Give other affected extensions a chance to validate or abort
258 - if( !wfRunHooks( 'RenameUserAbort', array( $uid, $oldusername->getText(), $newusername->getText() ) ) ) {
 256+ if ( !wfRunHooks( 'RenameUserAbort', array( $uid, $oldusername->getText(), $newusername->getText() ) ) ) {
259257 return;
260258 }
261259
262260 // Do the heavy lifting...
263261 $rename = new RenameuserSQL( $oldusername->getText(), $newusername->getText(), $uid );
264 - if( !$rename->rename() ) {
 262+ if ( !$rename->rename() ) {
265263 return;
266264 }
267 -
 265+
268266 // If this user is renaming his/herself, make sure that Title::moveTo()
269267 // doesn't make a bunch of null move edits under the old name!
270 - if( $wgUser->getId() == $uid ) {
 268+ if ( $wgUser->getId() == $uid ) {
271269 $wgUser->setName( $newusername->getText() );
272270 }
273271
274272 // Log this rename
275273 $log = new LogPage( 'renameuser' );
276 - $log->addEntry( 'renameuser', $oldusername, wfMsgExt( 'renameuser-log', array( 'parsemag', 'content' ),
 274+ $log->addEntry( 'renameuser', $oldusername, wfMsgExt( 'renameuser-log', array( 'parsemag', 'content' ),
277275 $wgContLang->formatNum( $contribs ), $reason ), $newusername->getText() );
278276
279277 // Move any user pages
280 - if( $wgRequest->getCheck( 'movepages' ) && $wgUser->isAllowed( 'move' ) ) {
 278+ if ( $wgRequest->getCheck( 'movepages' ) && $wgUser->isAllowed( 'move' ) ) {
281279 $dbr = wfGetDB( DB_SLAVE );
282280 $oldkey = $oldusername->getDBkey();
283281 $pages = $dbr->select(
@@ -284,8 +282,8 @@
285283 array( 'page_namespace', 'page_title' ),
286284 array(
287285 'page_namespace IN (' . NS_USER . ',' . NS_USER_TALK . ')',
288 - '(page_title LIKE ' .
289 - $dbr->addQuotes( $dbr->escapeLike( $oldusername->getDBkey() ) . '/%' ) .
 286+ '(page_title LIKE ' .
 287+ $dbr->addQuotes( $dbr->escapeLike( $oldusername->getDBkey() ) . '/%' ) .
290288 ' OR page_title = ' . $dbr->addQuotes( $oldusername->getDBkey() ) . ')'
291289 ),
292290 __METHOD__
@@ -295,16 +293,16 @@
296294 $skin =& $wgUser->getSkin();
297295 while ( $row = $dbr->fetchObject( $pages ) ) {
298296 $oldPage = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
299 - $newPage = Title::makeTitleSafe( $row->page_namespace,
 297+ $newPage = Title::makeTitleSafe( $row->page_namespace,
300298 preg_replace( '!^[^/]+!', $newusername->getDBkey(), $row->page_title ) );
301299 # Do not autodelete or anything, title must not exist
302300 if ( $newPage->exists() && !$oldPage->isValidMoveTarget( $newPage ) ) {
303301 $link = $skin->makeKnownLinkObj( $newPage );
304302 $output .= '<li class="mw-renameuser-pe">' . wfMsgHtml( 'renameuser-page-exists', $link ) . '</li>';
305303 } else {
306 - $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log',
 304+ $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log',
307305 $oldusername->getText(), $newusername->getText() ) );
308 - if( $success === true ) {
 306+ if ( $success === true ) {
309307 $oldLink = $skin->makeKnownLinkObj( $oldPage, '', 'redirect=no' );
310308 $newLink = $skin->makeKnownLinkObj( $newPage );
311309 $output .= '<li class="mw-renameuser-pm">' . wfMsgHtml( 'renameuser-page-moved', $oldLink, $newLink ) . '</li>';
@@ -315,12 +313,12 @@
316314 }
317315 }
318316 }
319 - if( $output )
 317+ if ( $output )
320318 $wgOut->addHTML( '<ul>' . $output . '</ul>' );
321319 }
322 -
 320+
323321 // Output success message stuff :)
324 - $wgOut->addWikiText( "<div class=\"successbox\">" . wfMsg( 'renameusersuccess', $oldusername->getText(),
 322+ $wgOut->addWikiText( "<div class=\"successbox\">" . wfMsg( 'renameusersuccess', $oldusername->getText(),
325323 $newusername->getText() ) . "</div><br style=\"clear:both\" />" );
326324 }
327325
@@ -332,7 +330,6 @@
333331 }
334332
335333 class RenameuserSQL {
336 -
337334 /**
338335 * The old username
339336 *
@@ -371,33 +368,33 @@
372369 * @param string $old The old username
373370 * @param string $new The new username
374371 */
375 - function RenameuserSQL($old, $new, $uid) {
 372+ function RenameuserSQL( $old, $new, $uid ) {
376373 $this->old = $old;
377374 $this->new = $new;
378375 $this->uid = $uid;
379 -
 376+
380377 $this->tables = array(); // Immediate updates
381 - $this->tables['image'] = array('img_user_text','img_user');
382 - $this->tables['oldimage'] = array('oi_user_text','oi_user');
 378+ $this->tables['image'] = array( 'img_user_text', 'img_user' );
 379+ $this->tables['oldimage'] = array( 'oi_user_text', 'oi_user' );
383380 # FIXME: $this->tables['filearchive'] = array('fa_user_text','fa_user'); (not indexed yet)
384381 $this->tablesJob = array(); // Slow updates
385382 // If this user has a large number of edits, use the jobqueue
386 - if( User::edits($this->uid) > RENAMEUSER_CONTRIBJOB ) {
387 - $this->tablesJob['revision'] = array('rev_user_text','rev_user','rev_timestamp');
388 - $this->tablesJob['archive'] = array('ar_user_text','ar_user','ar_timestamp');
389 - $this->tablesJob['logging'] = array('log_user_text','log_user','log_timestamp');
 383+ if ( User::edits( $this->uid ) > RENAMEUSER_CONTRIBJOB ) {
 384+ $this->tablesJob['revision'] = array( 'rev_user_text', 'rev_user', 'rev_timestamp' );
 385+ $this->tablesJob['archive'] = array( 'ar_user_text', 'ar_user', 'ar_timestamp' );
 386+ $this->tablesJob['logging'] = array( 'log_user_text', 'log_user', 'log_timestamp' );
390387 } else {
391 - $this->tables['revision'] = array('rev_user_text','rev_user');
392 - $this->tables['archive'] = array('ar_user_text','ar_user');
393 - $this->tables['logging'] = array('log_user_text','log_user');
 388+ $this->tables['revision'] = array( 'rev_user_text', 'rev_user' );
 389+ $this->tables['archive'] = array( 'ar_user_text', 'ar_user' );
 390+ $this->tables['logging'] = array( 'log_user_text', 'log_user' );
394391 }
395392 // Recent changes is pretty hot, deadlocks occur if done all at once
396 - if( wfQueriesMustScale() ) {
397 - $this->tablesJob['recentchanges'] = array('rc_user_text','rc_user','rc_timestamp');
 393+ if ( wfQueriesMustScale() ) {
 394+ $this->tablesJob['recentchanges'] = array( 'rc_user_text', 'rc_user', 'rc_timestamp' );
398395 } else {
399 - $this->tables['recentchanges'] = array('rc_user_text','rc_user');
 396+ $this->tables['recentchanges'] = array( 'rc_user_text', 'rc_user' );
400397 }
401 -
 398+
402399 wfRunHooks( 'RenameUserSQL', array( $this ) );
403400 }
404401
@@ -416,11 +413,11 @@
417414 // this avoids users still being logged in and making new edits while
418415 // being renamed, which leaves edits at the old name.
419416 $dbw->update( 'user',
420 - array( 'user_name' => $this->new, 'user_touched' => $dbw->timestamp() ),
 417+ array( 'user_name' => $this->new, 'user_touched' => $dbw->timestamp() ),
421418 array( 'user_name' => $this->old ),
422419 __METHOD__
423420 );
424 - if( !$dbw->affectedRows() ) {
 421+ if ( !$dbw->affectedRows() ) {
425422 return false;
426423 }
427424 // Reset token to break login with central auth systems.
@@ -450,8 +447,8 @@
451448 'log_title' => $oldTitle->getDBkey() ),
452449 __METHOD__ );
453450 // Do immediate updates!
454 - foreach( $this->tables as $table => $fieldSet ) {
455 - list($nameCol,$userCol) = $fieldSet;
 451+ foreach ( $this->tables as $table => $fieldSet ) {
 452+ list( $nameCol, $userCol ) = $fieldSet;
456453 $dbw->update( $table,
457454 array( $nameCol => $this->new ),
458455 array( $nameCol => $this->old, $userCol => $this->uid ),
@@ -465,7 +462,7 @@
466463 // is not really FIFO, so we might end up with a bunch of edits
467464 // randomly mixed between the two new names. Some sort of rename
468465 // lock might be in order...
469 - foreach( $this->tablesJob as $table => $params ) {
 466+ foreach ( $this->tablesJob as $table => $params ) {
470467 $userTextC = $params[0]; // some *_user_text column
471468 $userIDC = $params[1]; // some *_user column
472469 $timestampC = $params[2]; // some *_timestamp column
@@ -494,7 +491,7 @@
495492 $jobParams['minTimestamp'] = '0';
496493 $jobParams['maxTimestamp'] = '0';
497494 $jobParams['count'] = 0;
498 -
 495+
499496 // Insert into queue!
500497 $jobRows = 0;
501498 $done = false;
@@ -504,7 +501,7 @@
505502 $row = $dbw->fetchObject( $res );
506503 if ( !$row ) {
507504 # If there are any job rows left, add it to the queue as one job
508 - if( $jobRows > 0 ) {
 505+ if ( $jobRows > 0 ) {
509506 $jobParams['count'] = $jobRows;
510507 $jobs[] = Job::factory( 'renameUser', $oldTitle, $jobParams );
511508 $jobParams['minTimestamp'] = '0';
@@ -517,7 +514,7 @@
518515 }
519516 # If we are adding the first item, since the ORDER BY is ASC, set
520517 # the min timestamp
521 - if( $jobRows == 0 ) {
 518+ if ( $jobRows == 0 ) {
522519 $jobParams['minTimestamp'] = $row->$timestampC;
523520 }
524521 # Keep updating the last timestamp, so it should be correct when the last item is added.
@@ -525,7 +522,7 @@
526523 # Update nice counter
527524 $jobRows++;
528525 # Once a job has $jobSize rows, add it to the queue
529 - if( $jobRows >= $jobSize ) {
 526+ if ( $jobRows >= $jobSize ) {
530527 $jobParams['count'] = $jobRows;
531528 $jobs[] = Job::factory( 'renameUser', $oldTitle, $jobParams );
532529 $jobParams['minTimestamp'] = '0';
Index: trunk/extensions/Renameuser/Renameuser.i18n.php
@@ -3,7 +3,7 @@
44 * Internationalisation file for extension Renameuser.
55 *
66 * @addtogroup Extensions
7 -*/
 7+ */
88
99 $messages = array();
1010
@@ -42,7 +42,7 @@
4343 'renameuser-move-log' => 'Automatically moved page while renaming the user "[[User:$1|$1]]" to "[[User:$2|$2]]"',
4444
4545 'right-renameuser' => 'Rename users',
46 -
 46+
4747 'renameuser-renamed-notice' => 'This user has been renamed.
4848 The rename log is provided below for reference.', # Supports GENDER
4949 );
@@ -3392,7 +3392,7 @@
33933393 'renameusererrorexists' => '"<nowiki>$1</nowiki>" ulanyjysy eýýäm bar.',
33943394 'renameusererrorinvalid' => '"<nowiki>$1</nowiki>" ulanyjy ady nädogry.',
33953395 'renameusererrortoomany' => '"<nowiki>$1</nowiki>" ulanyjysynyň $2 {{PLURAL:$2|goşandy|goşandy}} bar, $3 gowrak {{PLURAL:$3|goşandy|goşandy}} bar bolan ulanyjyny saýtyň işleýişine ýaramaz täsir eder.',
3396 - 'renameuser-error-request' => 'Talaby almak bilen baglanyşykyly bir probleme ýüze çykdy.
 3396+ 'renameuser-error-request' => 'Talaby almak bilen baglanyşykyly bir probleme ýüze çykdy.
33973397 Yza gaýdyp gaýtadan synanyşyp görüň.',
33983398 'renameuser-error-same-user' => 'Ulanyja öňküsi ýaly bir ada täzeden geçirip bilmeýärsiňiz.',
33993399 'renameusersuccess' => 'Ulanyjy "<nowiki>$1</nowiki>" täze ada geçirildi: "<nowiki>$2</nowiki>".',
Index: trunk/extensions/Renameuser/Renameuser.php
@@ -1,5 +1,5 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die();
 3+if ( !defined( 'MEDIAWIKI' ) ) die();
44 /**
55 * A Special Page extension to rename users, runnable by users with renameuser
66 * righs
@@ -23,7 +23,7 @@
2424 );
2525
2626 # Internationalisation file
27 -$dir = dirname(__FILE__) . '/';
 27+$dir = dirname( __FILE__ ) . '/';
2828 $wgExtensionMessagesFiles['Renameuser'] = $dir . 'Renameuser.i18n.php';
2929 $wgExtensionAliasesFiles['Renameuser'] = $dir . 'Renameuser.alias.php';
3030
@@ -39,11 +39,11 @@
4040 $wgLogTypes[] = 'renameuser';
4141 $wgLogNames['renameuser'] = 'renameuserlogpage';
4242 $wgLogHeaders['renameuser'] = 'renameuserlogpagetext';
43 -#$wgLogActions['renameuser/renameuser'] = 'renameuserlogentry';
 43+# $wgLogActions['renameuser/renameuser'] = 'renameuserlogentry';
4444 $wgLogActionsHandlers['renameuser/renameuser'] = 'wfRenameUserLogActionText'; // deal with old breakage
4545
46 -function wfRenameUserLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks=false ) {
47 - if( !$title || $title->getNamespace() !== NS_USER ) {
 46+function wfRenameUserLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) {
 47+ if ( !$title || $title->getNamespace() !== NS_USER ) {
4848 $rv = ''; // handled in comment, the old way
4949 } else {
5050 $titleLink = $skin ?
@@ -56,7 +56,7 @@
5757 }
5858
5959 $wgAutoloadClasses['SpecialRenameuser'] = dirname( __FILE__ ) . '/Renameuser_body.php';
60 -$wgAutoloadClasses['RenameUserJob'] = dirname(__FILE__) . '/RenameUserJob.php';
 60+$wgAutoloadClasses['RenameUserJob'] = dirname( __FILE__ ) . '/RenameUserJob.php';
6161 $wgSpecialPages['Renameuser'] = 'SpecialRenameuser';
6262 $wgSpecialPageGroups['Renameuser'] = 'users';
6363 $wgJobClasses['renameUser'] = 'RenameUserJob';
@@ -70,23 +70,23 @@
7171 if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) {
7272 // Get the title for the base userpage
7373 $page = Title::makeTitle( NS_USER, str_replace( ' ', '_', $title->getBaseText() ) )->getPrefixedDBkey();
74 - LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false,
 74+ LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false,
7575 'msgKey' => array( 'renameuser-renamed-notice', $title->getBaseText() ) ) );
7676 }
7777 return true;
7878 }
7979
8080 function wfRenameuserOnContribsLink( $id, $nt, &$tools ) {
81 - global $wgUser;
 81+ global $wgUser;
8282
83 - if ( $wgUser->isAllowed( 'renameuser' ) ) {
84 - $sk = $wgUser->getSkin();
85 - $tools[] = $sk->link(
86 - SpecialPage::getTitleFor( 'Renameuser' ),
87 - wfMsg( 'renameuser-linkoncontribs' ),
88 - array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ),
89 - array( 'oldusername' => $nt->getText() )
90 - );
91 - }
92 - return true;
 83+ if ( $wgUser->isAllowed( 'renameuser' ) ) {
 84+ $sk = $wgUser->getSkin();
 85+ $tools[] = $sk->link(
 86+ SpecialPage::getTitleFor( 'Renameuser' ),
 87+ wfMsg( 'renameuser-linkoncontribs' ),
 88+ array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ),
 89+ array( 'oldusername' => $nt->getText() )
 90+ );
 91+ }
 92+ return true;
9393 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r66543Add a contributions tool link.siebrand17:48, 16 May 2010

Status & tagging log