Revert r35178 and normalize User's getID() and setID() methods to prettier getId...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 22 May 2008 16:39:43 +0000 (16:39 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 22 May 2008 16:39:43 +0000 (16:39 +0000)
This doesn't accomplish anything, of course, but if you're going to run around changing them, at least make em prettier eh? :)

26 files changed:
includes/EditPage.php
includes/LogPage.php
includes/PageHistory.php
includes/RecentChange.php
includes/Revision.php
includes/SpecialBlockip.php
includes/SpecialImport.php
includes/SpecialIpblocklist.php
includes/SpecialPreferences.php
includes/SpecialRecentchanges.php
includes/SpecialRecentchangeslinked.php
includes/SpecialUpload.php
includes/SpecialUserrights.php
includes/SpecialWatchlist.php
includes/Title.php
includes/User.php
includes/UserMailer.php
includes/WatchedItem.php
includes/WatchlistEditor.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryWatchlist.php
includes/filerepo/ICRepo.php
includes/filerepo/LocalFile.php
maintenance/changePassword.php
maintenance/cleanupSpam.php
maintenance/reassignEdits.inc.php

index 8df876a..cb25581 100644 (file)
@@ -870,7 +870,7 @@ class EditPage {
                                }
                        }
                }
-               $userid = $wgUser->getID();
+               $userid = $wgUser->getId();
 
                if ( $this->isConflict) {
                        wfDebug( "EditPage::editForm conflict! getting section '$this->section' for time '$this->edittime' (article time '" .
index 89e144b..f8e235e 100644 (file)
@@ -56,7 +56,7 @@ class LogPage {
                $fname = 'LogPage::saveContent';
 
                $dbw = wfGetDB( DB_MASTER );
-               $uid = $wgUser->getID();
+               $uid = $wgUser->getId();
                $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
 
                $this->timestamp = $now = wfTimestampNow();
index 8a09a3e..9f9bbbe 100644 (file)
@@ -473,7 +473,7 @@ class PageHistory {
                        'wl_notificationtimestamp',
                        array(  'wl_namespace' => $this->mTitle->getNamespace(),
                                'wl_title' => $this->mTitle->getDBkey(),
-                               'wl_user' => $wgUser->getID()
+                               'wl_user' => $wgUser->getId()
                        ),
                        __METHOD__ );
 
index 609f410..4b13b12 100644 (file)
@@ -223,7 +223,7 @@ class RecentChange
                if( $wgUseEnotif || $wgShowUpdatedMarker ) {
                        // Users
                        if( $this->mAttribs['rc_user'] ) {
-                               $editor = ($wgUser->getID() == $this->mAttribs['rc_user']) ? 
+                               $editor = ($wgUser->getId() == $this->mAttribs['rc_user']) ? 
                                        $wgUser : User::newFromID( $this->mAttribs['rc_user'] );
                        // Anons
                        } else {
@@ -289,7 +289,7 @@ class RecentChange
                        'rc_type'       => RC_EDIT,
                        'rc_minor'      => $minor ? 1 : 0,
                        'rc_cur_id'     => $title->getArticleID(),
-                       'rc_user'       => $user->getID(),
+                       'rc_user'       => $user->getId(),
                        'rc_user_text'  => $user->getName(),
                        'rc_comment'    => $comment,
                        'rc_this_oldid' => $newId,
@@ -343,7 +343,7 @@ class RecentChange
                        'rc_type'           => RC_NEW,
                        'rc_minor'          => $minor ? 1 : 0,
                        'rc_cur_id'         => $title->getArticleID(),
-                       'rc_user'           => $user->getID(),
+                       'rc_user'           => $user->getId(),
                        'rc_user_text'      => $user->getName(),
                        'rc_comment'        => $comment,
                        'rc_this_oldid'     => $newId,
@@ -394,7 +394,7 @@ class RecentChange
                        'rc_type'       => $overRedir ? RC_MOVE_OVER_REDIRECT : RC_MOVE,
                        'rc_minor'      => 0,
                        'rc_cur_id'     => $oldTitle->getArticleID(),
-                       'rc_user'       => $user->getID(),
+                       'rc_user'       => $user->getId(),
                        'rc_user_text'  => $user->getName(),
                        'rc_comment'    => $comment,
                        'rc_this_oldid' => 0,
@@ -452,7 +452,7 @@ class RecentChange
                        'rc_type'       => RC_LOG,
                        'rc_minor'      => 0,
                        'rc_cur_id'     => $target->getArticleID(),
-                       'rc_user'       => $user->getID(),
+                       'rc_user'       => $user->getId(),
                        'rc_user_text'  => $user->getName(),
                        'rc_comment'    => $logComment,
                        'rc_this_oldid' => 0,
index f801bed..0f8ba71 100644 (file)
@@ -332,7 +332,7 @@ class Revision {
                        $this->mPage      = isset( $row['page']       ) ? intval( $row['page']       ) : null;
                        $this->mTextId    = isset( $row['text_id']    ) ? intval( $row['text_id']    ) : null;
                        $this->mUserText  = isset( $row['user_text']  ) ? strval( $row['user_text']  ) : $wgUser->getName();
-                       $this->mUser      = isset( $row['user']       ) ? intval( $row['user']       ) : $wgUser->getID();
+                       $this->mUser      = isset( $row['user']       ) ? intval( $row['user']       ) : $wgUser->getId();
                        $this->mMinorEdit = isset( $row['minor_edit'] ) ? intval( $row['minor_edit'] ) : 0;
                        $this->mTimestamp = isset( $row['timestamp']  ) ? strval( $row['timestamp']  ) : wfTimestamp( TS_MW );
                        $this->mDeleted   = isset( $row['deleted']    ) ? intval( $row['deleted']    ) : 0;
index 0f503d2..2d3c50a 100644 (file)
@@ -314,9 +314,9 @@ class IPBlockForm {
                                # Username block
                                if ( $wgSysopUserBans ) {
                                        $user = User::newFromName( $this->BlockAddress );
-                                       if( !is_null( $user ) && $user->getID() ) {
+                                       if( !is_null( $user ) && $user->getId() ) {
                                                # Use canonical name
-                                               $userId = $user->getID();
+                                               $userId = $user->getId();
                                                $this->BlockAddress = $user->getName();
                                        } else {
                                                return array('nosuchusershort', htmlspecialchars( $user ? $user->getName() : $this->BlockAddress ) );
@@ -358,7 +358,7 @@ class IPBlockForm {
 
                # Create block
                # Note: for a user block, ipb_address is only for display purposes
-               $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
+               $block = new Block( $this->BlockAddress, $userId, $wgUser->getId(),
                        $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
                        $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
                        $this->BlockEmail);
index 5f5c63a..862b3e1 100644 (file)
@@ -351,7 +351,7 @@ class WikiRevision {
                # Sneak a single revision into place
                $user = User::newFromName( $this->getUser() );
                if( $user ) {
-                       $userId = intval( $user->getID() );
+                       $userId = intval( $user->getId() );
                        $userText = $user->getName();
                } else {
                        $userId = 0;
index d6807d2..3bca200 100644 (file)
@@ -249,7 +249,7 @@ class IPUnblockForm {
                        $conds['ipb_auto'] = 0;
                } else {
                        $user = User::newFromName( $this->ip );
-                       if ( $user && ( $id = $user->getID() ) != 0 ) {
+                       if ( $user && ( $id = $user->getId() ) != 0 ) {
                                $conds['ipb_user'] = $id;
                        } else {
                                // Uh...?
index 0d7e02a..89db891 100644 (file)
@@ -605,10 +605,10 @@ class PreferencesForm {
 
                $userInformationHtml =
                        $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
-                       $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getID() ) ) .
+                       $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getId() ) ) .
                        $this->tableRow(
                                wfMsgHtml( 'prefs-edits' ),
-                               $wgLang->formatNum( User::edits( $wgUser->getID() ) )
+                               $wgLang->formatNum( User::edits( $wgUser->getId() ) )
                        );
 
                if( wfRunHooks( 'PreferencesUserInformationPanel', array( $this, &$userInformationHtml ) ) ) {
index 7afd21f..e50fe02 100644 (file)
@@ -149,15 +149,15 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
        $hidem .= $forcebot ? ' AND rc_bot = 1' : '';
 
        if( $hidemyself ) {
-               if( $wgUser->getID() ) {
-                       $hidem .= ' AND rc_user != ' . $wgUser->getID();
+               if( $wgUser->getId() ) {
+                       $hidem .= ' AND rc_user != ' . $wgUser->getId();
                } else {
                        $hidem .= ' AND rc_user_text != ' . $dbr->addQuotes( $wgUser->getName() );
                }
        }
 
        // JOIN on watchlist for users
-       $uid = $wgUser->getID();
+       $uid = $wgUser->getId();
        if( $uid ) {
                $tables = array( 'recentchanges', 'watchlist' );
                $join_conds = array( 'watchlist' => array('LEFT JOIN',"wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace") );
index bec9b10..a6bf0e7 100644 (file)
@@ -82,7 +82,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
        list($recentchanges, $categorylinks, $pagelinks, $watchlist) =
            $dbr->tableNamesN( 'recentchanges', 'categorylinks', 'pagelinks', "watchlist" );
 
-       $uid = $wgUser->getID();
+       $uid = $wgUser->getId();
        // The fields we are selecting
        $fields = "rc_cur_id,rc_namespace,rc_title,
                rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor,rc_log_type,rc_log_action,rc_params,rc_deleted,
index 147db6c..03ff46e 100644 (file)
@@ -1655,7 +1655,7 @@ wgUploadAutoFill = {$autofill};
                if ( !$row )
                        return false;
 
-               return $user->getID() == $row->img_user;
+               return $user->getId() == $row->img_user;
        }
 
        /**
index 082ec69..1873b48 100644 (file)
@@ -141,7 +141,7 @@ class UserrightsPage extends SpecialPage {
 
                // Validate input set...
                $changeable = $this->changeableGroups();
-               if ($wgUser->getID() != 0 && $wgUser->getID() == $user->getID()) {
+               if ($wgUser->getId() != 0 && $wgUser->getId() == $user->getId()) {
                        $addable = array_merge($changeable['add'], $wgGroupsAddToSelf);
                        $removable = array_merge($changeable['remove'], $wgGroupsRemoveFromSelf);
                } else {
index f0bddf8..bb5e7ba 100644 (file)
@@ -44,7 +44,7 @@ function wfSpecialWatchlist( $par ) {
                return;
        }
 
-       $uid = $wgUser->getID();
+       $uid = $wgUser->getId();
        if( ($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) {
                $wgUser->clearAllNotifications( $uid );
                $wgOut->redirect( $specialTitle->getFullUrl() );
index 760eb3a..b8b5e1e 100644 (file)
@@ -1338,7 +1338,7 @@ class Title {
                                        , 'pt_create_perm' => $create_perm
                                        , 'pt_timestamp' => Block::encodeExpiry(wfTimestampNow(), $dbw)
                                        , 'pt_expiry' => $encodedExpiry
-                                       , 'pt_user' => $wgUser->getID(), 'pt_reason' => $reason ), __METHOD__  );
+                                       , 'pt_user' => $wgUser->getId(), 'pt_reason' => $reason ), __METHOD__  );
                } else {
                        $dbw->delete( 'protected_titles', array( 'pt_namespace' => $namespace,
                                'pt_title' => $title ), __METHOD__ );
index ea2c2f3..3eee728 100644 (file)
@@ -1252,7 +1252,7 @@ class User {
        /**
         * Get the user ID. Returns 0 if the user is anonymous or nonexistent.
         */
-       function getID() {
+       function getId() {
                if( $this->mId === null and $this->mName !== null
                and User::isIP( $this->mName ) ) {
                        // Special case, we know the user is anonymous
@@ -1267,7 +1267,7 @@ class User {
        /**
         * Set the user and reload all fields according to that ID
         */
-       function setID( $v ) {
+       function setId( $v ) {
                $this->mId = $v;
                $this->clearInstanceCache( 'id' );
        }
@@ -1997,7 +1997,7 @@ class User {
                        $title->getText() == $wgUser->getName())
                {
                        $watched = true;
-               } elseif ( $this->getID() == $wgUser->getID() ) {
+               } elseif ( $this->getId() == $wgUser->getId() ) {
                        $watched = $title->userIsWatching();
                } else {
                        $watched = true;
index fa11454..8e576bb 100644 (file)
@@ -342,12 +342,12 @@ class EmailNotification {
                                $targetUser = User::newFromName( $title->getText() );
                                if ( !$targetUser || $targetUser->isAnon() ) {
                                        wfDebug( __METHOD__.": user talk page edited, but user does not exist\n" );
-                               } elseif ( $targetUser->getID() == $editor->getID() ) {
+                               } elseif ( $targetUser->getId() == $editor->getId() ) {
                                        wfDebug( __METHOD__.": user edited their own talk page, no notification sent\n" );
                                } elseif( $targetUser->getOption( 'enotifusertalkpages' ) ) {
                                        wfDebug( __METHOD__.": sending talk page update notification\n" );
                                        $this->compose( $targetUser );
-                                       $userTalkId = $targetUser->getID();
+                                       $userTalkId = $targetUser->getId();
                                } else {
                                        wfDebug( __METHOD__.": talk page owner doesn't want notifications\n" );
                                }
index 51d1b88..ace50a5 100644 (file)
@@ -19,7 +19,7 @@ class WatchedItem {
                $wl = new WatchedItem;
                $wl->mUser = $user;
                $wl->mTitle = $title;
-               $wl->id = $user->getID();
+               $wl->id = $user->getId();
 # Patch (also) for email notification on page changes T.Gries/M.Arndt 11.09.2004
 # TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
 # The change results in talk-pages not automatically included in watchlists, when their parent page is included
index f442b04..4f64b78 100644 (file)
@@ -158,7 +158,7 @@ class WatchlistEditor {
         */
        private function countWatchlist( $user ) {
                $dbr = wfGetDB( DB_MASTER );
-               $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->getID() ), __METHOD__ );
+               $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->getId() ), __METHOD__ );
                $row = $dbr->fetchObject( $res );
                return ceil( $row->count / 2 ); // Paranoia
        }
@@ -177,7 +177,7 @@ class WatchlistEditor {
                        'watchlist',
                        '*',
                        array(
-                               'wl_user' => $user->getID(),
+                               'wl_user' => $user->getId(),
                        ),
                        __METHOD__
                );
@@ -203,7 +203,7 @@ class WatchlistEditor {
        private function getWatchlistInfo( $user ) {
                $titles = array();
                $dbr = wfGetDB( DB_MASTER );
-               $uid = intval( $user->getID() );
+               $uid = intval( $user->getId() );
                list( $watchlist, $page ) = $dbr->tableNamesN( 'watchlist', 'page' );
                $sql = "SELECT wl_namespace, wl_title, page_id, page_len, page_is_redirect
                        FROM {$watchlist} LEFT JOIN {$page} ON ( wl_namespace = page_namespace
@@ -254,7 +254,7 @@ class WatchlistEditor {
         */
        private function clearWatchlist( $user ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->delete( 'watchlist', array( 'wl_user' => $user->getID() ), __METHOD__ );
+               $dbw->delete( 'watchlist', array( 'wl_user' => $user->getId() ), __METHOD__ );
        }
 
        /**
@@ -274,13 +274,13 @@ class WatchlistEditor {
                                $title = Title::newFromText( $title );
                        if( $title instanceof Title ) {
                                $rows[] = array(
-                                       'wl_user' => $user->getID(),
+                                       'wl_user' => $user->getId(),
                                        'wl_namespace' => ( $title->getNamespace() & ~1 ),
                                        'wl_title' => $title->getDBkey(),
                                        'wl_notificationtimestamp' => null,
                                );
                                $rows[] = array(
-                                       'wl_user' => $user->getID(),
+                                       'wl_user' => $user->getId(),
                                        'wl_namespace' => ( $title->getNamespace() | 1 ),
                                        'wl_title' => $title->getDBkey(),
                                        'wl_notificationtimestamp' => null,
@@ -308,7 +308,7 @@ class WatchlistEditor {
                                $dbw->delete(
                                        'watchlist',
                                        array(
-                                               'wl_user' => $user->getID(),
+                                               'wl_user' => $user->getId(),
                                                'wl_namespace' => ( $title->getNamespace() & ~1 ),
                                                'wl_title' => $title->getDBkey(),
                                        ),
@@ -317,7 +317,7 @@ class WatchlistEditor {
                                $dbw->delete(
                                        'watchlist',
                                        array(
-                                               'wl_user' => $user->getID(),
+                                               'wl_user' => $user->getId(),
                                                'wl_namespace' => ( $title->getNamespace() | 1 ),
                                                'wl_title' => $title->getDBkey(),
                                        ),
index 633ba1f..3ad9177 100644 (file)
@@ -57,7 +57,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                global $wgUser;
                $result = $this->getResult();
                $vals = array();
-               $vals['id'] = $wgUser->getID();
+               $vals['id'] = $wgUser->getId();
                $vals['name'] = $wgUser->getName();
 
                if($wgUser->isAnon())
index bdeef14..80bdd5d 100644 (file)
@@ -122,7 +122,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        'recentchanges'
                ));
 
-               $userId = $wgUser->getID();
+               $userId = $wgUser->getId();
                $this->addWhere(array (
                        'wl_namespace = rc_namespace',
                        'wl_title = rc_title',
index 4c77ecb..c8009ee 100644 (file)
@@ -239,7 +239,7 @@ class ICFile extends LocalFile{
                                'img_minor_mime' => $minor,
                                'img_timestamp' => $timestamp,
                                'img_description' => $comment,
-                               'img_user' => $wgUser->getID(),
+                               'img_user' => $wgUser->getId(),
                                'img_user_text' => $wgUser->getName(),
                                'img_metadata' => $this->metadata,
                        ),
@@ -261,7 +261,7 @@ class ICFile extends LocalFile{
                                        'img_minor_mime' => $this->minor_mime,
                                        'img_timestamp' => $timestamp,
                                        'img_description' => $comment,
-                                       'img_user' => $wgUser->getID(),
+                                       'img_user' => $wgUser->getId(),
                                        'img_user_text' => $wgUser->getName(),
                                        'img_metadata' => $this->metadata,
                                ), array( /* WHERE */
index 7d0d548..228659c 100644 (file)
@@ -770,7 +770,7 @@ class LocalFile extends File
                        $props = $this->repo->getFileProps( $this->getVirtualUrl() );
                }
                $props['description'] = $comment;
-               $props['user'] = $wgUser->getID();
+               $props['user'] = $wgUser->getId();
                $props['user_text'] = $wgUser->getName();
                $props['timestamp'] = wfTimestamp( TS_MW );
                $this->setProps( $props );
@@ -806,7 +806,7 @@ class LocalFile extends File
                                'img_minor_mime' => $this->minor_mime,
                                'img_timestamp' => $timestamp,
                                'img_description' => $comment,
-                               'img_user' => $wgUser->getID(),
+                               'img_user' => $wgUser->getId(),
                                'img_user_text' => $wgUser->getName(),
                                'img_metadata' => $this->metadata,
                                'img_sha1' => $this->sha1
@@ -852,7 +852,7 @@ class LocalFile extends File
                                        'img_minor_mime' => $this->minor_mime,
                                        'img_timestamp' => $timestamp,
                                        'img_description' => $comment,
-                                       'img_user' => $wgUser->getID(),
+                                       'img_user' => $wgUser->getId(),
                                        'img_user_text' => $wgUser->getName(),
                                        'img_metadata' => $this->metadata,
                                        'img_sha1' => $this->sha1
@@ -1262,7 +1262,7 @@ class LocalFileDeleteBatch {
                global $wgUser;
                $dbw = $this->file->repo->getMasterDB();
                $encTimestamp = $dbw->addQuotes( $dbw->timestamp() );
-               $encUserId = $dbw->addQuotes( $wgUser->getID() );
+               $encUserId = $dbw->addQuotes( $wgUser->getId() );
                $encReason = $dbw->addQuotes( $this->reason );
                $encGroup = $dbw->addQuotes( 'deleted' );
                $ext = $this->file->getExtension();
index 0e657ca..a2af7b4 100644 (file)
@@ -40,7 +40,7 @@ class ChangePassword {
                }
 
                $this->user = User::newFromName( $user );
-               if ( !$this->user->getID() ) {
+               if ( !$this->user->getId() ) {
                        die ( "No such user: $user\n" );
                }
 
@@ -54,10 +54,10 @@ class ChangePassword {
 
                $this->dbw->update( 'user',
                        array(
-                               'user_password' => wfEncryptPassword( $this->user->getID(), $this->password )
+                               'user_password' => wfEncryptPassword( $this->user->getId(), $this->password )
                        ),
                        array(
-                               'user_id' => $this->user->getID()
+                               'user_id' => $this->user->getId()
                        ),
                        $fname
                );
index 793df5d..eb9bd91 100644 (file)
@@ -62,7 +62,7 @@ $username = wfMsg( 'spambot_username' );
 $fname = $username;
 $wgUser = User::newFromName( $username );
 // Create the user if necessary
-if ( !$wgUser->getID() ) {
+if ( !$wgUser->getId() ) {
        $wgUser->addToDatabase();
 }
 
index ce038ca..e68b4cf 100644 (file)
@@ -81,7 +81,7 @@ function reassignEdits( &$from, &$to, $rc = false, $report = false ) {
  * @return array
  */
 function userConditions( &$user, $idfield, $utfield ) {
-       return $user->getId() ? array( $idfield => $user->getID() ) : array( $utfield => $user->getName() );
+       return $user->getId() ? array( $idfield => $user->getId() ) : array( $utfield => $user->getName() );
 }
 
 /**