http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66544
Revision: 66544 Author: siebrand Date: 2010-05-16 18:00:45 +0000 (Sun, 16 May 2010) Log Message: ----------- 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 trunk/extensions/Renameuser/Renameuser.i18n.php trunk/extensions/Renameuser/Renameuser.php trunk/extensions/Renameuser/Renameuser_body.php Modified: trunk/extensions/Renameuser/RenameUserJob.php =================================================================== --- trunk/extensions/Renameuser/RenameUserJob.php 2010-05-16 17:48:22 UTC (rev 66543) +++ trunk/extensions/Renameuser/RenameUserJob.php 2010-05-16 18:00:45 UTC (rev 66544) @@ -1,5 +1,4 @@ <?php - /** * Custom job to perform updates on tables in busier environments */ @@ -26,15 +25,15 @@ # Conditions like "*_user_text = 'x' $conds = array( $column => $oldname ); # If user ID given, add that to condition to avoid rename collisions. - if( isset($userID) ) { + if ( isset( $userID ) ) { $conds[$uidColumn] = $userID; } # Bound by timestamp if given - if( isset($timestampColumn) ) { + if ( isset( $timestampColumn ) ) { $conds[] = "$timestampColumn >= '$minTimestamp'"; $conds[] = "$timestampColumn <= '$maxTimestamp'"; # Otherwise, bound by key (B/C) - } else if( isset($uniqueKey) ) { + } else if ( isset( $uniqueKey ) ) { $conds[$uniqueKey] = $keyId; } else { wfDebug( 'RenameUserJob::run - invalid job row given' ); // this shouldn't happen @@ -47,11 +46,11 @@ __METHOD__ ); # Special case: revisions may be deleted while renaming... - if( $table == 'revision' && isset($timestampColumn) ) { + if ( $table == 'revision' && isset( $timestampColumn ) ) { $actual = $dbw->affectedRows(); # If some revisions were not renamed, they may have been deleted. # Do a pass on the archive table to get these straglers... - if( $actual < $count ) { + if ( $actual < $count ) { $dbw->update( 'archive', array( 'ar_user_text' => $newname ), array( 'ar_user_text' => $oldname, @@ -59,17 +58,17 @@ // No user,rev_id index, so use timestamp to bound // the rows. This can use the user,timestamp index. "ar_timestamp >= '$minTimestamp'", - "ar_timestamp <= '$maxTimestamp'"), + "ar_timestamp <= '$maxTimestamp'" ), __METHOD__ ); } } # Special case: revisions may be restored while renaming... - if( $table == 'archive' && isset($timestampColumn) ) { + if ( $table == 'archive' && isset( $timestampColumn ) ) { $actual = $dbw->affectedRows(); # If some revisions were not renamed, they may have been restored. # Do a pass on the revision table to get these straglers... - if( $actual < $count ) { + if ( $actual < $count ) { $dbw->update( 'revision', array( 'rev_user_text' => $newname ), array( 'rev_user_text' => $oldname, @@ -77,12 +76,11 @@ // No user,rev_id index, so use timestamp to bound // the rows. This can use the user,timestamp index. "rev_timestamp >= '$minTimestamp'", - "rev_timestamp <= '$maxTimestamp'"), + "rev_timestamp <= '$maxTimestamp'" ), __METHOD__ ); } } return true; } - -} \ No newline at end of file +} Modified: trunk/extensions/Renameuser/Renameuser.i18n.php =================================================================== --- trunk/extensions/Renameuser/Renameuser.i18n.php 2010-05-16 17:48:22 UTC (rev 66543) +++ trunk/extensions/Renameuser/Renameuser.i18n.php 2010-05-16 18:00:45 UTC (rev 66544) @@ -3,7 +3,7 @@ * Internationalisation file for extension Renameuser. * * @addtogroup Extensions -*/ + */ $messages = array(); @@ -42,7 +42,7 @@ 'renameuser-move-log' => 'Automatically moved page while renaming the user "[[User:$1|$1]]" to "[[User:$2|$2]]"', 'right-renameuser' => 'Rename users', - + 'renameuser-renamed-notice' => 'This user has been renamed. The rename log is provided below for reference.', # Supports GENDER ); @@ -3392,7 +3392,7 @@ 'renameusererrorexists' => '"<nowiki>$1</nowiki>" ulanyjysy eýýäm bar.', 'renameusererrorinvalid' => '"<nowiki>$1</nowiki>" ulanyjy ady nädogry.', '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.', - 'renameuser-error-request' => 'Talaby almak bilen baglanyşykyly bir probleme ýüze çykdy. + 'renameuser-error-request' => 'Talaby almak bilen baglanyşykyly bir probleme ýüze çykdy. Yza gaýdyp gaýtadan synanyşyp görüň.', 'renameuser-error-same-user' => 'Ulanyja öňküsi ýaly bir ada täzeden geçirip bilmeýärsiňiz.', 'renameusersuccess' => 'Ulanyjy "<nowiki>$1</nowiki>" täze ada geçirildi: "<nowiki>$2</nowiki>".', Modified: trunk/extensions/Renameuser/Renameuser.php =================================================================== --- trunk/extensions/Renameuser/Renameuser.php 2010-05-16 17:48:22 UTC (rev 66543) +++ trunk/extensions/Renameuser/Renameuser.php 2010-05-16 18:00:45 UTC (rev 66544) @@ -1,5 +1,5 @@ <?php -if (!defined('MEDIAWIKI')) die(); +if ( !defined( 'MEDIAWIKI' ) ) die(); /** * A Special Page extension to rename users, runnable by users with renameuser * righs @@ -23,7 +23,7 @@ ); # Internationalisation file -$dir = dirname(__FILE__) . '/'; +$dir = dirname( __FILE__ ) . '/'; $wgExtensionMessagesFiles['Renameuser'] = $dir . 'Renameuser.i18n.php'; $wgExtensionAliasesFiles['Renameuser'] = $dir . 'Renameuser.alias.php'; @@ -39,11 +39,11 @@ $wgLogTypes[] = 'renameuser'; $wgLogNames['renameuser'] = 'renameuserlogpage'; $wgLogHeaders['renameuser'] = 'renameuserlogpagetext'; -#$wgLogActions['renameuser/renameuser'] = 'renameuserlogentry'; +# $wgLogActions['renameuser/renameuser'] = 'renameuserlogentry'; $wgLogActionsHandlers['renameuser/renameuser'] = 'wfRenameUserLogActionText'; // deal with old breakage -function wfRenameUserLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks=false ) { - if( !$title || $title->getNamespace() !== NS_USER ) { +function wfRenameUserLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) { + if ( !$title || $title->getNamespace() !== NS_USER ) { $rv = ''; // handled in comment, the old way } else { $titleLink = $skin ? @@ -56,7 +56,7 @@ } $wgAutoloadClasses['SpecialRenameuser'] = dirname( __FILE__ ) . '/Renameuser_body.php'; -$wgAutoloadClasses['RenameUserJob'] = dirname(__FILE__) . '/RenameUserJob.php'; +$wgAutoloadClasses['RenameUserJob'] = dirname( __FILE__ ) . '/RenameUserJob.php'; $wgSpecialPages['Renameuser'] = 'SpecialRenameuser'; $wgSpecialPageGroups['Renameuser'] = 'users'; $wgJobClasses['renameUser'] = 'RenameUserJob'; @@ -70,23 +70,23 @@ if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) { // Get the title for the base userpage $page = Title::makeTitle( NS_USER, str_replace( ' ', '_', $title->getBaseText() ) )->getPrefixedDBkey(); - LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false, + LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false, 'msgKey' => array( 'renameuser-renamed-notice', $title->getBaseText() ) ) ); } return true; } function wfRenameuserOnContribsLink( $id, $nt, &$tools ) { - global $wgUser; + global $wgUser; - if ( $wgUser->isAllowed( 'renameuser' ) ) { - $sk = $wgUser->getSkin(); - $tools[] = $sk->link( - SpecialPage::getTitleFor( 'Renameuser' ), - wfMsg( 'renameuser-linkoncontribs' ), - array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ), - array( 'oldusername' => $nt->getText() ) - ); - } - return true; + if ( $wgUser->isAllowed( 'renameuser' ) ) { + $sk = $wgUser->getSkin(); + $tools[] = $sk->link( + SpecialPage::getTitleFor( 'Renameuser' ), + wfMsg( 'renameuser-linkoncontribs' ), + array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ), + array( 'oldusername' => $nt->getText() ) + ); + } + return true; } Modified: trunk/extensions/Renameuser/Renameuser_body.php =================================================================== --- trunk/extensions/Renameuser/Renameuser_body.php 2010-05-16 17:48:22 UTC (rev 66543) +++ trunk/extensions/Renameuser/Renameuser_body.php 2010-05-16 18:00:45 UTC (rev 66544) @@ -1,5 +1,4 @@ <?php - if ( !defined( 'MEDIAWIKI' ) ) { echo "RenameUser extension\n"; exit( 1 ); @@ -13,7 +12,6 @@ * user accounts */ class SpecialRenameuser extends SpecialPage { - /** * Constructor */ @@ -33,11 +31,11 @@ $this->setHeaders(); $wgOut->addWikiMsg( 'renameuser-summary' ); - if( !$wgUser->isAllowed( 'renameuser' ) ) { + if ( !$wgUser->isAllowed( 'renameuser' ) ) { $wgOut->permissionRequired( 'renameuser' ); return; } - if( wfReadOnly() ) { + if ( wfReadOnly() ) { $wgOut->readOnlyPage(); return; } @@ -54,13 +52,13 @@ // If nothing given for these flags, assume they are checked // unless this is a POST submission. $move_checked = true; - if( $wgRequest->wasPosted() ) { - if( !$wgRequest->getCheck( 'movepages' ) ) { + if ( $wgRequest->wasPosted() ) { + if ( !$wgRequest->getCheck( 'movepages' ) ) { $move_checked = false; } } $warnings = array(); - if( $oun && $nun && !$wgRequest->getCheck( 'confirmaction' ) ) { + if ( $oun && $nun && !$wgRequest->getCheck( 'confirmaction' ) ) { wfRunHooks( 'RenameUserWarning', array( $oun, $nun, &$warnings ) ); } @@ -95,21 +93,21 @@ "</td> </tr>" ); - if( $wgUser->isAllowed( 'move' ) ) { + if ( $wgUser->isAllowed( 'move' ) ) { $wgOut->addHTML( " <tr> <td> </td> <td class='mw-input'>" . - Xml::checkLabel( wfMsg( 'renameusermove' ), 'movepages', 'movepages', + Xml::checkLabel( wfMsg( 'renameusermove' ), 'movepages', 'movepages', $move_checked, array( 'tabindex' => '4' ) ) . "</td> </tr>" ); } - if( $warnings ) { + if ( $warnings ) { $warningsHtml = array(); - foreach( $warnings as $warning ) + foreach ( $warnings as $warning ) $warningsHtml[] = is_array( $warning ) ? call_user_func_array( 'wfMsgWikiHtml', $warning ) : wfMsgHtml( $warning ); @@ -118,8 +116,8 @@ <td class='mw-label'>" . wfMsgWikiHtml( 'renameuserwarnings' ) . " </td> <td class='mw-input'>" . - '<ul style="color: red; font-weight: bold"><li>'. - implode( '</li><li>', $warningsHtml ).'</li></ul>'. + '<ul style="color: red; font-weight: bold"><li>' . + implode( '</li><li>', $warningsHtml ) . '</li></ul>' . "</td> </tr>" ); @@ -128,7 +126,7 @@ <td> </td> <td class='mw-input'>" . - Xml::checkLabel( wfMsg( 'renameuserconfirm' ), 'confirmaction', 'confirmaction', + Xml::checkLabel( wfMsg( 'renameuserconfirm' ), 'confirmaction', 'confirmaction', false, array( 'tabindex' => '6' ) ) . "</td> </tr>" @@ -139,10 +137,10 @@ <td> </td> <td class='mw-submit'>" . - Xml::submitButton( wfMsg( 'renameusersubmit' ), array( 'name' => 'submit', + Xml::submitButton( wfMsg( 'renameusersubmit' ), array( 'name' => 'submit', 'tabindex' => '7', 'id' => 'submit' ) ) . ' ' . - Xml::submitButton( wfMsg( 'blocklogpage' ), array ( 'name' => 'submit-showBlockLog', + Xml::submitButton( wfMsg( 'blocklogpage' ), array ( 'name' => 'submit-showBlockLog', 'id' => 'submit-showBlockLog', 'tabindex' => '8' ) ) . "</td> </tr>" . @@ -153,35 +151,35 @@ ); // Show block log if requested - if( $showBlockLog && is_object( $oldusername ) ) { + if ( $showBlockLog && is_object( $oldusername ) ) { $this->showLogExtract( $oldusername, 'block', $wgOut ) ; return; } - if( $wgRequest->getText( 'token' ) === '' ) { + if ( $wgRequest->getText( 'token' ) === '' ) { # They probably haven't even submitted the form, so don't go further. return; - } elseif( $warnings ) { + } elseif ( $warnings ) { # Let user read warnings return; - } elseif( !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { + } elseif ( !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameuser-error-request' ) . "</div>" ); return; - } elseif( !is_object( $oldusername ) ) { + } elseif ( !is_object( $oldusername ) ) { $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', $wgRequest->getText( 'oldusername' ) ) . "</div>" ); return; - } elseif( !is_object( $newusername ) ) { + } elseif ( !is_object( $newusername ) ) { $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', $wgRequest->getText( 'newusername' ) ) . "</div>" ); return; - } elseif( $oldusername->getText() == $newusername->getText() ) { + } elseif ( $oldusername->getText() == $newusername->getText() ) { $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameuser-error-same-user' ) . "</div>" ); return; } @@ -191,27 +189,27 @@ $newuser = User::newFromName( $newusername->getText(), 'creatable' ); // It won't be an object if for instance "|" is supplied as a value - if( !is_object( $olduser ) ) { - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', + if ( !is_object( $olduser ) ) { + $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', $oldusername->getText() ) . "</div>" ); return; } - if( !is_object( $newuser ) || !User::isCreatableName( $newuser->getName() ) ) { - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', + if ( !is_object( $newuser ) || !User::isCreatableName( $newuser->getName() ) ) { + $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorinvalid', $newusername->getText() ) . "</div>" ); return; } // Check for the existence of lowercase oldusername in database. // Until r19631 it was possible to rename a user to a name with first character as lowercase - if( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) { + if ( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) { // oldusername was entered as lowercase -> check for existence in table 'user' $dbr = wfGetDB( DB_SLAVE ); - $uid = $dbr->selectField( 'user', 'user_id', - array( 'user_name' => $oldusername->getText() ), + $uid = $dbr->selectField( 'user', 'user_id', + array( 'user_name' => $oldusername->getText() ), __METHOD__ ); - if( $uid === false ) { - if( !$wgCapitalLinks ) { + if ( $uid === false ) { + if ( !$wgCapitalLinks ) { $uid = 0; // We are on a lowercase wiki but lowercase username does not exists } else { // We are on a standard uppercase wiki, use normal @@ -224,14 +222,14 @@ $uid = $olduser->idForName(); } - if( $uid == 0 ) { - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrordoesnotexist' , + if ( $uid == 0 ) { + $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrordoesnotexist' , $oldusername->getText() ) . "</div>" ); return; } - if( $newuser->idForName() != 0 ) { - $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorexists', + if ( $newuser->idForName() != 0 ) { + $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrorexists', $newusername->getText() ) . "</div>" ); return; } @@ -240,9 +238,9 @@ $contribs = User::edits( $uid ); // Check edit count - if( !$wgUser->isAllowed( 'siteadmin' ) ) { + if ( !$wgUser->isAllowed( 'siteadmin' ) ) { if ( RENAMEUSER_CONTRIBLIMIT != 0 && $contribs > RENAMEUSER_CONTRIBLIMIT ) { - $wgOut->addWikiText( "<div class=\"errorbox\">" . + $wgOut->addWikiText( "<div class=\"errorbox\">" . wfMsg( 'renameusererrortoomany', $oldusername->getText(), $wgLang->formatNum( $contribs ), @@ -254,29 +252,29 @@ } // Give other affected extensions a chance to validate or abort - if( !wfRunHooks( 'RenameUserAbort', array( $uid, $oldusername->getText(), $newusername->getText() ) ) ) { + if ( !wfRunHooks( 'RenameUserAbort', array( $uid, $oldusername->getText(), $newusername->getText() ) ) ) { return; } // Do the heavy lifting... $rename = new RenameuserSQL( $oldusername->getText(), $newusername->getText(), $uid ); - if( !$rename->rename() ) { + if ( !$rename->rename() ) { return; } - + // If this user is renaming his/herself, make sure that Title::moveTo() // doesn't make a bunch of null move edits under the old name! - if( $wgUser->getId() == $uid ) { + if ( $wgUser->getId() == $uid ) { $wgUser->setName( $newusername->getText() ); } // Log this rename $log = new LogPage( 'renameuser' ); - $log->addEntry( 'renameuser', $oldusername, wfMsgExt( 'renameuser-log', array( 'parsemag', 'content' ), + $log->addEntry( 'renameuser', $oldusername, wfMsgExt( 'renameuser-log', array( 'parsemag', 'content' ), $wgContLang->formatNum( $contribs ), $reason ), $newusername->getText() ); // Move any user pages - if( $wgRequest->getCheck( 'movepages' ) && $wgUser->isAllowed( 'move' ) ) { + if ( $wgRequest->getCheck( 'movepages' ) && $wgUser->isAllowed( 'move' ) ) { $dbr = wfGetDB( DB_SLAVE ); $oldkey = $oldusername->getDBkey(); $pages = $dbr->select( @@ -284,8 +282,8 @@ array( 'page_namespace', 'page_title' ), array( 'page_namespace IN (' . NS_USER . ',' . NS_USER_TALK . ')', - '(page_title LIKE ' . - $dbr->addQuotes( $dbr->escapeLike( $oldusername->getDBkey() ) . '/%' ) . + '(page_title LIKE ' . + $dbr->addQuotes( $dbr->escapeLike( $oldusername->getDBkey() ) . '/%' ) . ' OR page_title = ' . $dbr->addQuotes( $oldusername->getDBkey() ) . ')' ), __METHOD__ @@ -295,16 +293,16 @@ $skin =& $wgUser->getSkin(); while ( $row = $dbr->fetchObject( $pages ) ) { $oldPage = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); - $newPage = Title::makeTitleSafe( $row->page_namespace, + $newPage = Title::makeTitleSafe( $row->page_namespace, preg_replace( '!^[^/]+!', $newusername->getDBkey(), $row->page_title ) ); # Do not autodelete or anything, title must not exist if ( $newPage->exists() && !$oldPage->isValidMoveTarget( $newPage ) ) { $link = $skin->makeKnownLinkObj( $newPage ); $output .= '<li class="mw-renameuser-pe">' . wfMsgHtml( 'renameuser-page-exists', $link ) . '</li>'; } else { - $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log', + $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log', $oldusername->getText(), $newusername->getText() ) ); - if( $success === true ) { + if ( $success === true ) { $oldLink = $skin->makeKnownLinkObj( $oldPage, '', 'redirect=no' ); $newLink = $skin->makeKnownLinkObj( $newPage ); $output .= '<li class="mw-renameuser-pm">' . wfMsgHtml( 'renameuser-page-moved', $oldLink, $newLink ) . '</li>'; @@ -315,12 +313,12 @@ } } } - if( $output ) + if ( $output ) $wgOut->addHTML( '<ul>' . $output . '</ul>' ); } - + // Output success message stuff :) - $wgOut->addWikiText( "<div class=\"successbox\">" . wfMsg( 'renameusersuccess', $oldusername->getText(), + $wgOut->addWikiText( "<div class=\"successbox\">" . wfMsg( 'renameusersuccess', $oldusername->getText(), $newusername->getText() ) . "</div><br style=\"clear:both\" />" ); } @@ -332,7 +330,6 @@ } class RenameuserSQL { - /** * The old username * @@ -371,33 +368,33 @@ * @param string $old The old username * @param string $new The new username */ - function RenameuserSQL($old, $new, $uid) { + function RenameuserSQL( $old, $new, $uid ) { $this->old = $old; $this->new = $new; $this->uid = $uid; - + $this->tables = array(); // Immediate updates - $this->tables['image'] = array('img_user_text','img_user'); - $this->tables['oldimage'] = array('oi_user_text','oi_user'); + $this->tables['image'] = array( 'img_user_text', 'img_user' ); + $this->tables['oldimage'] = array( 'oi_user_text', 'oi_user' ); # FIXME: $this->tables['filearchive'] = array('fa_user_text','fa_user'); (not indexed yet) $this->tablesJob = array(); // Slow updates // If this user has a large number of edits, use the jobqueue - if( User::edits($this->uid) > RENAMEUSER_CONTRIBJOB ) { - $this->tablesJob['revision'] = array('rev_user_text','rev_user','rev_timestamp'); - $this->tablesJob['archive'] = array('ar_user_text','ar_user','ar_timestamp'); - $this->tablesJob['logging'] = array('log_user_text','log_user','log_timestamp'); + if ( User::edits( $this->uid ) > RENAMEUSER_CONTRIBJOB ) { + $this->tablesJob['revision'] = array( 'rev_user_text', 'rev_user', 'rev_timestamp' ); + $this->tablesJob['archive'] = array( 'ar_user_text', 'ar_user', 'ar_timestamp' ); + $this->tablesJob['logging'] = array( 'log_user_text', 'log_user', 'log_timestamp' ); } else { - $this->tables['revision'] = array('rev_user_text','rev_user'); - $this->tables['archive'] = array('ar_user_text','ar_user'); - $this->tables['logging'] = array('log_user_text','log_user'); + $this->tables['revision'] = array( 'rev_user_text', 'rev_user' ); + $this->tables['archive'] = array( 'ar_user_text', 'ar_user' ); + $this->tables['logging'] = array( 'log_user_text', 'log_user' ); } // Recent changes is pretty hot, deadlocks occur if done all at once - if( wfQueriesMustScale() ) { - $this->tablesJob['recentchanges'] = array('rc_user_text','rc_user','rc_timestamp'); + if ( wfQueriesMustScale() ) { + $this->tablesJob['recentchanges'] = array( 'rc_user_text', 'rc_user', 'rc_timestamp' ); } else { - $this->tables['recentchanges'] = array('rc_user_text','rc_user'); + $this->tables['recentchanges'] = array( 'rc_user_text', 'rc_user' ); } - + wfRunHooks( 'RenameUserSQL', array( $this ) ); } @@ -416,11 +413,11 @@ // this avoids users still being logged in and making new edits while // being renamed, which leaves edits at the old name. $dbw->update( 'user', - array( 'user_name' => $this->new, 'user_touched' => $dbw->timestamp() ), + array( 'user_name' => $this->new, 'user_touched' => $dbw->timestamp() ), array( 'user_name' => $this->old ), __METHOD__ ); - if( !$dbw->affectedRows() ) { + if ( !$dbw->affectedRows() ) { return false; } // Reset token to break login with central auth systems. @@ -450,8 +447,8 @@ 'log_title' => $oldTitle->getDBkey() ), __METHOD__ ); // Do immediate updates! - foreach( $this->tables as $table => $fieldSet ) { - list($nameCol,$userCol) = $fieldSet; + foreach ( $this->tables as $table => $fieldSet ) { + list( $nameCol, $userCol ) = $fieldSet; $dbw->update( $table, array( $nameCol => $this->new ), array( $nameCol => $this->old, $userCol => $this->uid ), @@ -465,7 +462,7 @@ // is not really FIFO, so we might end up with a bunch of edits // randomly mixed between the two new names. Some sort of rename // lock might be in order... - foreach( $this->tablesJob as $table => $params ) { + foreach ( $this->tablesJob as $table => $params ) { $userTextC = $params[0]; // some *_user_text column $userIDC = $params[1]; // some *_user column $timestampC = $params[2]; // some *_timestamp column @@ -494,7 +491,7 @@ $jobParams['minTimestamp'] = '0'; $jobParams['maxTimestamp'] = '0'; $jobParams['count'] = 0; - + // Insert into queue! $jobRows = 0; $done = false; @@ -504,7 +501,7 @@ $row = $dbw->fetchObject( $res ); if ( !$row ) { # If there are any job rows left, add it to the queue as one job - if( $jobRows > 0 ) { + if ( $jobRows > 0 ) { $jobParams['count'] = $jobRows; $jobs[] = Job::factory( 'renameUser', $oldTitle, $jobParams ); $jobParams['minTimestamp'] = '0'; @@ -517,7 +514,7 @@ } # If we are adding the first item, since the ORDER BY is ASC, set # the min timestamp - if( $jobRows == 0 ) { + if ( $jobRows == 0 ) { $jobParams['minTimestamp'] = $row->$timestampC; } # Keep updating the last timestamp, so it should be correct when the last item is added. @@ -525,7 +522,7 @@ # Update nice counter $jobRows++; # Once a job has $jobSize rows, add it to the queue - if( $jobRows >= $jobSize ) { + if ( $jobRows >= $jobSize ) { $jobParams['count'] = $jobRows; $jobs[] = Job::factory( 'renameUser', $oldTitle, $jobParams ); $jobParams['minTimestamp'] = '0'; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs