From af2177edfd9b108eca8598f9ace57672f0521942 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 16 Aug 2005 23:36:16 +0000 Subject: [PATCH] Code cleanup: normalize case for intval(), strval(), floatval() calls. --- config/index.php | 4 +-- includes/Article.php | 6 ++-- includes/DateFormatter.php | 10 +++---- includes/Group.php | 4 +-- includes/Image.php | 10 +++---- includes/ImagePage.php | 2 +- includes/Linker.php | 2 +- includes/QueryPage.php | 2 +- includes/Revision.php | 42 +++++++++++++-------------- includes/Sanitizer.php | 2 +- includes/SearchEngine.php | 4 +-- includes/Skin.php | 2 +- includes/SkinTemplate.php | 6 ++-- includes/SpecialImport.php | 2 +- includes/SpecialSearch.php | 2 +- includes/Title.php | 10 +++---- includes/User.php | 6 ++-- includes/WebRequest.php | 4 +-- includes/normal/UtfNormal.php | 4 +-- includes/normal/UtfNormalBench.php | 2 +- includes/normal/UtfNormalGenerate.php | 2 +- includes/normal/UtfNormalTest.php | 4 +-- irc/rcdumper.php | 2 +- maintenance/FiveUpgrade.inc | 2 +- maintenance/benchmarkPurge.php | 2 +- maintenance/cleanupDupes.inc | 2 +- maintenance/dumpBackup.php | 2 +- maintenance/importDump.php | 2 +- maintenance/importLogs.inc | 2 +- maintenance/importPhase2.php | 4 +-- maintenance/rebuildrecentchanges.inc | 6 ++-- maintenance/updaters.inc | 2 +- maintenance/userDupes.inc | 2 +- tests/SearchEngineTest.php | 2 +- 34 files changed, 81 insertions(+), 81 deletions(-) diff --git a/config/index.php b/config/index.php index 8d99bb3aa4..8952fce936 100644 --- a/config/index.php +++ b/config/index.php @@ -271,9 +271,9 @@ if( empty( $memlimit ) || $memlimit == -1 ) { print "
  • PHP is configured with no memory_limit.
  • \n"; } else { print "
  • PHP's memory_limit is " . htmlspecialchars( $memlimit ) . ". If this is too low, installation may fail! "; - $n = IntVal( $memlimit ); + $n = intval( $memlimit ); if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) { - $n = IntVal( $m[1] * (1024*1024) ); + $n = intval( $m[1] * (1024*1024) ); } if( $n < 20*1024*1024 ) { print "Attempting to raise limit to 20M... "; diff --git a/includes/Article.php b/includes/Article.php index 6515a27cac..c318ce1b4d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -249,7 +249,7 @@ class Article { # Query variables :P $oldid = $wgRequest->getVal( 'oldid' ); if ( isset( $oldid ) ) { - $oldid = IntVal( $oldid ); + $oldid = intval( $oldid ); if ( $wgRequest->getVal( 'direction' ) == 'next' ) { $nextid = $this->mTitle->getNextRevisionID( $oldid ); if ( $nextid ) { @@ -329,7 +329,7 @@ class Article { function pageDataFromId( &$dbr, $id ) { return $this->pageData( $dbr, array( - 'page_id' => IntVal( $id ) ) ); + 'page_id' => intval( $id ) ) ); } /** @@ -1996,7 +1996,7 @@ class Article { } # Get the last edit not by this guy - $user = IntVal( $current->getUser() ); + $user = intval( $current->getUser() ); $user_text = $dbw->addQuotes( $current->getUserText() ); $s = $dbw->selectRow( 'revision', array( 'rev_id', 'rev_timestamp' ), diff --git a/includes/DateFormatter.php b/includes/DateFormatter.php index f5cad86fe1..eee039aa68 100755 --- a/includes/DateFormatter.php +++ b/includes/DateFormatter.php @@ -193,14 +193,14 @@ class DateFormatter break; case 'j': # ordinary day of month if ( !isset($bits['j']) ) { - $text .= IntVal( $bits['d'] ); + $text .= intval( $bits['d'] ); } else { $text .= $bits['j']; } break; case 'F': # long month if ( !isset( $bits['F'] ) ) { - $m = IntVal($bits['m']); + $m = intval($bits['m']); if ( $m > 12 || $m < 1 ) { $fail = true; } else { @@ -259,7 +259,7 @@ class DateFormatter function makeIsoYear( $year ) { # Assumes the year is in a nice format, as enforced by the regex if ( substr( $year, -2 ) == 'BC' ) { - $num = IntVal(substr( $year, 0, -3 )) - 1; + $num = intval(substr( $year, 0, -3 )) - 1; # PHP bug note: sprintf( "%04d", -1 ) fails poorly $text = sprintf( '-%04d', $num ); @@ -274,9 +274,9 @@ class DateFormatter */ function makeNormalYear( $iso ) { if ( $iso{0} == '-' ) { - $text = (IntVal( substr( $iso, 1 ) ) + 1) . ' BC'; + $text = (intval( substr( $iso, 1 ) ) + 1) . ' BC'; } else { - $text = IntVal( $iso ); + $text = intval( $iso ); } return $text; } diff --git a/includes/Group.php b/includes/Group.php index cfaeb46fef..e820135b3e 100644 --- a/includes/Group.php +++ b/includes/Group.php @@ -47,7 +47,7 @@ class Group { } // be sure it's an integer - $this->id = IntVal($this->id); + $this->id = intval($this->id); if($this->id) { // By ID @@ -341,7 +341,7 @@ class Group { function getId() { return $this->id; } function setId($id) { - $this->id = IntVal($id); + $this->id = intval($id); $this->dataLoaded = false; } diff --git a/includes/Image.php b/includes/Image.php index 1314b4a028..a741aabde4 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -916,7 +916,7 @@ class Image global $wgUseSquid, $wgInternalServer; global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath; - $width = IntVal( $width ); + $width = intval( $width ); $this->load(); if ( ! $this->exists() ) @@ -1288,8 +1288,8 @@ class Image array( 'img_name' => $this->name, 'img_size'=> $this->size, - 'img_width' => IntVal( $this->width ), - 'img_height' => IntVal( $this->height ), + 'img_width' => intval( $this->width ), + 'img_height' => intval( $this->height ), 'img_bits' => $this->bits, 'img_media_type' => $this->type, 'img_major_mime' => $major, @@ -1634,12 +1634,12 @@ function wfScaleSVGUnit( $length ) { '%' => 2.0, // Fake it! ); if( preg_match( '/^(\d+)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) { - $length = FloatVal( $matches[1] ); + $length = floatval( $matches[1] ); $unit = $matches[2]; return round( $length * $unitLength[$unit] ); } else { // Assume pixels - return round( FloatVal( $length ) ); + return round( floatval( $length ) ); } } diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 9d1c2858ea..4d090d5222 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -139,7 +139,7 @@ class ImagePage extends Article { if( $wgUser->getOption( 'imagesize' ) == '' ) { $sizeSel = User::getDefaultOption( 'imagesize' ); } else { - $sizeSel = IntVal( $wgUser->getOption( 'imagesize' ) ); + $sizeSel = intval( $wgUser->getOption( 'imagesize' ) ); } if( !isset( $wgImageLimits[$sizeSel] ) ) { $sizeSel = User::getDefaultOption( 'imagesize' ); diff --git a/includes/Linker.php b/includes/Linker.php index 81c290c745..322a5177ff 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -332,7 +332,7 @@ class Linker { */ function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { global $wgUser; - $threshold = IntVal( $wgUser->getOption( 'stubthreshold' ) ); + $threshold = intval( $wgUser->getOption( 'stubthreshold' ) ); if( $size < $threshold ) { return $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix ); } else { diff --git a/includes/QueryPage.php b/includes/QueryPage.php index d6ec7688ba..b7ff539853 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -332,7 +332,7 @@ class QueryPage { if( !isset( $row->title ) ) { return NULL; } - $title = Title::MakeTitle( IntVal( $row->namespace ), $row->title ); + $title = Title::MakeTitle( intval( $row->namespace ), $row->title ); if( $title ) { if( isset( $row->timestamp ) ) { $date = $row->timestamp; diff --git a/includes/Revision.php b/includes/Revision.php index 0e1761169b..03baf4b3c0 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -24,7 +24,7 @@ class Revision { function newFromId( $id ) { return Revision::newFromConds( array( 'page_id=rev_page', - 'rev_id' => IntVal( $id ) ) ); + 'rev_id' => intval( $id ) ) ); } /** @@ -40,7 +40,7 @@ class Revision { */ function newFromTitle( &$title, $id = 0 ) { if( $id ) { - $matchId = IntVal( $id ); + $matchId = intval( $id ); } else { $matchId = 'page_latest'; } @@ -64,14 +64,14 @@ class Revision { */ function loadFromPageId( &$db, $pageid, $id = 0 ) { if( $id ) { - $matchId = IntVal( $id ); + $matchId = intval( $id ); } else { $matchId = 'page_latest'; } $ret = Revision::loadFromConds( $db, array( "rev_id=$matchId", - 'rev_page' => IntVal( $pageid ), + 'rev_page' => intval( $pageid ), 'page_id=rev_page' ) ); return $ret; } @@ -89,7 +89,7 @@ class Revision { */ function loadFromTitle( &$db, $title, $id = 0 ) { if( $id ) { - $matchId = IntVal( $id ); + $matchId = intval( $id ); } else { $matchId = 'page_latest'; } @@ -240,15 +240,15 @@ class Revision { */ function Revision( $row ) { if( is_object( $row ) ) { - $this->mId = IntVal( $row->rev_id ); - $this->mPage = IntVal( $row->rev_page ); - $this->mTextId = IntVal( $row->rev_text_id ); + $this->mId = intval( $row->rev_id ); + $this->mPage = intval( $row->rev_page ); + $this->mTextId = intval( $row->rev_text_id ); $this->mComment = $row->rev_comment; $this->mUserText = $row->rev_user_text; - $this->mUser = IntVal( $row->rev_user ); - $this->mMinorEdit = IntVal( $row->rev_minor_edit ); + $this->mUser = intval( $row->rev_user ); + $this->mMinorEdit = intval( $row->rev_minor_edit ); $this->mTimestamp = $row->rev_timestamp; - $this->mDeleted = IntVal( $row->rev_deleted ); + $this->mDeleted = intval( $row->rev_deleted ); $this->mCurrent = ( $row->rev_id == $row->page_latest ); $this->mTitle = Title::makeTitle( $row->page_namespace, @@ -263,18 +263,18 @@ class Revision { // Build a new revision to be saved... global $wgUser; - $this->mId = isset( $row['id'] ) ? IntVal( $row['id'] ) : null; - $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->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; + $this->mId = isset( $row['id'] ) ? intval( $row['id'] ) : null; + $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->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; // Enforce spacing trimming on supplied text - $this->mComment = isset( $row['comment'] ) ? trim( StrVal( $row['comment'] ) ) : null; - $this->mText = isset( $row['text'] ) ? rtrim( StrVal( $row['text'] ) ) : null; + $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null; + $this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null; $this->mTitle = null; # Load on demand if needed $this->mCurrent = false; diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index b9b3b50212..c2604bab4d 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -727,7 +727,7 @@ class Sanitizer { } function decCharReference( $codepoint ) { - $point = IntVal( $codepoint ); + $point = intval( $codepoint ); if( Sanitizer::validateCodepoint( $point ) ) { return sprintf( '&#%d;', $point ); } else { diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index b335a38aaf..abc4d58663 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -129,8 +129,8 @@ class SearchEngine { * @access public */ function setLimitOffset( $limit, $offset = 0 ) { - $this->limit = IntVal( $limit ); - $this->offset = IntVal( $offset ); + $this->limit = intval( $limit ); + $this->offset = intval( $offset ); } /** diff --git a/includes/Skin.php b/includes/Skin.php index 3481aa591e..35b7e7dfcb 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -318,7 +318,7 @@ END; $red = "&redirect={$redirect}"; } if ( !empty($oldid) && ! isset( $diff ) ) { - $oid = "&oldid=" . IntVal( $oldid ); + $oid = "&oldid=" . intval( $oldid ); } $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" ); $s = 'document.location = "' .$s .'";'; diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index daf9f5b686..a3d8073f46 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -564,7 +564,7 @@ class SkinTemplate extends Skin { wfProfileIn( "$fname-edit" ); if ( $this->mTitle->userCanEdit() ) { - $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.IntVal( $oldid ) : false; + $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.intval( $oldid ) : false; $istalk = $this->mTitle->isTalkPage(); $istalkclass = $istalk?' istalk':''; $content_actions['edit'] = array( @@ -581,7 +581,7 @@ class SkinTemplate extends Skin { ); } } else { - $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.IntVal( $oldid ) : ''; + $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.intval( $oldid ) : ''; $content_actions['viewsource'] = array( 'class' => ($action == 'edit') ? 'selected' : false, 'text' => wfMsg('viewsource'), @@ -664,7 +664,7 @@ class SkinTemplate extends Skin { if( $wgUser->isLoggedIn() || $wgValidationForAnons ) { # and $action != 'submit' ) { # Validate tab. TODO: add validation to logged-in user rights if($wgUseValidation && ( $action == "" || $action=='view' ) ){ # && $wgUser->isAllowed('validate')){ - if ( $oldid ) $oid = IntVal( $oldid ) ; # Use the oldid + if ( $oldid ) $oid = intval( $oldid ) ; # Use the oldid else {# Trying to get the current article revision through this weird stunt $tid = $this->mTitle->getArticleID(); diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index 07b2df54af..5765a505bf 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -181,7 +181,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; diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index 4981c74819..265ded6dba 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -337,7 +337,7 @@ class SpecialSearch { $lines = explode( "\n", $text ); - $max = IntVal( $contextchars ) + 1; + $max = intval( $contextchars ) + 1; $pat1 = "/(.*)($terms)(.{0,$max})/i"; $lineno = 0; diff --git a/includes/Title.php b/includes/Title.php index 3a7be81c65..d95db8c3d9 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -216,7 +216,7 @@ class Title { $t =& new Title(); $t->mInterwiki = ''; $t->mFragment = ''; - $t->mNamespace = IntVal( $ns ); + $t->mNamespace = intval( $ns ); $t->mDbkeyform = str_replace( ' ', '_', $title ); $t->mArticleID = ( $ns >= 0 ) ? -1 : 0; $t->mUrlform = wfUrlencode( $t->mDbkeyform ); @@ -2014,8 +2014,8 @@ wfdebug("title: articleid = ".$this->mArticleID."\n"); function getPreviousRevisionID( $revision ) { $dbr =& wfGetDB( DB_SLAVE ); return $dbr->selectField( 'revision', 'rev_id', - 'rev_page=' . IntVal( $this->getArticleId() ) . - ' AND rev_id<' . IntVal( $revision ) . ' ORDER BY rev_id DESC' ); + 'rev_page=' . intval( $this->getArticleId() ) . + ' AND rev_id<' . intval( $revision ) . ' ORDER BY rev_id DESC' ); } /** @@ -2027,8 +2027,8 @@ wfdebug("title: articleid = ".$this->mArticleID."\n"); function getNextRevisionID( $revision ) { $dbr =& wfGetDB( DB_SLAVE ); return $dbr->selectField( 'revision', 'rev_id', - 'rev_page=' . IntVal( $this->getArticleId() ) . - ' AND rev_id>' . IntVal( $revision ) . ' ORDER BY rev_id' ); + 'rev_page=' . intval( $this->getArticleId() ) . + ' AND rev_id>' . intval( $revision ) . ' ORDER BY rev_id' ); } /** diff --git a/includes/User.php b/includes/User.php index ad9b7e1231..4b55c832bc 100644 --- a/includes/User.php +++ b/includes/User.php @@ -516,7 +516,7 @@ class User { } } else { wfDebug( "$fname: adding record for $key $summary\n" ); - $wgMemc->add( $key, 1, IntVal( $period ) ); + $wgMemc->add( $key, 1, intval( $period ) ); } $wgMemc->incr( $key ); } @@ -596,7 +596,7 @@ class User { return new User(); } } else if ( isset( $_COOKIE["{$wgDBname}UserID"] ) ) { - $sId = IntVal( $_COOKIE["{$wgDBname}UserID"] ); + $sId = intval( $_COOKIE["{$wgDBname}UserID"] ); $_SESSION['wsUserID'] = $sId; } else { return new User(); @@ -660,7 +660,7 @@ class User { } # Paranoia - $this->mId = IntVal( $this->mId ); + $this->mId = intval( $this->mId ); /** Anonymous user */ if( !$this->mId ) { diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 31195ebe55..87fc0232ac 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -172,7 +172,7 @@ class WebRequest { * @return int */ function getInt( $name, $default = 0 ) { - return IntVal( $this->getVal( $name, $default ) ); + return intval( $this->getVal( $name, $default ) ); } /** @@ -185,7 +185,7 @@ class WebRequest { function getIntOrNull( $name ) { $val = $this->getVal( $name ); return is_numeric( $val ) - ? IntVal( $val ) + ? intval( $val ) : null; } diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 55f420eddd..c6183b556b 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -573,8 +573,8 @@ class UtfNormal { | (ord( $c{1} ) & 0x3f) << 6 | (ord( $c{2} ) & 0x3f) ) - UNICODE_HANGUL_FIRST; - $l = IntVal( $index / UNICODE_HANGUL_NCOUNT ); - $v = IntVal( ($index % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT); + $l = intval( $index / UNICODE_HANGUL_NCOUNT ); + $v = intval( ($index % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT); $t = $index % UNICODE_HANGUL_TCOUNT; $out .= "\xe1\x84" . chr( 0x80 + $l ) . "\xe1\x85" . chr( 0xa1 + $v ); if( $t >= 25 ) { diff --git a/includes/normal/UtfNormalBench.php b/includes/normal/UtfNormalBench.php index dbf69f46b7..a504eefa33 100644 --- a/includes/normal/UtfNormalBench.php +++ b/includes/normal/UtfNormalBench.php @@ -97,7 +97,7 @@ function benchmarkForm( &$u, &$data, $form ) { sort( $deltas ); $delta = $deltas[0]; # Take shortest time - $rate = IntVal( strlen( $data ) / $delta ); + $rate = intval( strlen( $data ) / $delta ); $same = (0 == strcmp( $data, $out ) ); printf( " %20s %6.1fms %8d bytes/s (%s)\n", $form, $delta*1000.0, $rate, ($same ? 'no change' : 'changed' ) ); diff --git a/includes/normal/UtfNormalGenerate.php b/includes/normal/UtfNormalGenerate.php index efe25de564..1c00e2b64d 100644 --- a/includes/normal/UtfNormalGenerate.php +++ b/includes/normal/UtfNormalGenerate.php @@ -99,7 +99,7 @@ while( false !== ($line = fgets( $in ) ) ) { $source = codepointToUtf8( hexdec( $codepoint ) ); if( $canonicalCombiningClass != 0 ) { - $combiningClass[$source] = IntVal( $canonicalCombiningClass ); + $combiningClass[$source] = intval( $canonicalCombiningClass ); } if( $decompositionMapping === '' ) continue; diff --git a/includes/normal/UtfNormalTest.php b/includes/normal/UtfNormalTest.php index 90c2ea15df..0bbc801f2b 100644 --- a/includes/normal/UtfNormalTest.php +++ b/includes/normal/UtfNormalTest.php @@ -141,8 +141,8 @@ if( $ok ) { ## ------ function reportResults( &$total, &$success, &$failure ) { - $percSucc = IntVal( $success * 100 / $total ); - $percFail = IntVal( $failure * 100 / $total ); + $percSucc = intval( $success * 100 / $total ); + $percFail = intval( $failure * 100 / $total ); print "\n"; print "$success tests successful ($percSucc%)\n"; print "$failure tests failed ($percFail%)\n\n"; diff --git a/irc/rcdumper.php b/irc/rcdumper.php index 2adbd5057a..32f46d7af2 100644 --- a/irc/rcdumper.php +++ b/irc/rcdumper.php @@ -89,7 +89,7 @@ while (1) { if ((isset($highest) && ($a > $highest)) || (isset($lowest) && $a <= $lowest)) continue; $user = str_replace($bad, $empty, $row->rc_user_text); - $lastid = IntVal($row->rc_last_oldid); + $lastid = intval($row->rc_last_oldid); $flag = ($row->rc_minor ? "M" : "") . ($row->rc_new ? "N" : ""); $stupid_urlencode = array("%2F", "%3A"); $haha_take_that = array("/", ":"); diff --git a/maintenance/FiveUpgrade.inc b/maintenance/FiveUpgrade.inc index 4c8fcbc797..42e5efbfd7 100644 --- a/maintenance/FiveUpgrade.inc +++ b/maintenance/FiveUpgrade.inc @@ -375,7 +375,7 @@ class FiveUpgrade { INDEX usertext_timestamp (rev_user_text,rev_timestamp) ) TYPE=InnoDB", $fname ); - $maxold = IntVal( $this->dbw->selectField( 'old', 'max(old_id)', '', $fname ) ); + $maxold = intval( $this->dbw->selectField( 'old', 'max(old_id)', '', $fname ) ); $this->log( "Last old record is {$maxold}" ); global $wgLegacySchemaConversion; diff --git a/maintenance/benchmarkPurge.php b/maintenance/benchmarkPurge.php index 9f45433aa0..45552c1b3b 100644 --- a/maintenance/benchmarkPurge.php +++ b/maintenance/benchmarkPurge.php @@ -52,7 +52,7 @@ if( !$wgUseSquid ) { printf( "There are %d defined squid servers:\n", count( $wgSquidServers ) ); #echo implode( "\n", $wgSquidServers ) . "\n"; if( isset( $options['count'] ) ) { - $lengths = array( IntVal( $options['count'] ) ); + $lengths = array( intval( $options['count'] ) ); } else { $lengths = array( 1, 10, 100 ); } diff --git a/maintenance/cleanupDupes.inc b/maintenance/cleanupDupes.inc index 12c296fe55..8b1ea5ee0f 100644 --- a/maintenance/cleanupDupes.inc +++ b/maintenance/cleanupDupes.inc @@ -47,7 +47,7 @@ END echo "Just a demo...\n"; } while( $row = $dbw->fetchObject( $res ) ) { - $ns = IntVal( $row->cur_namespace ); + $ns = intval( $row->cur_namespace ); $title = $dbw->addQuotes( $row->cur_title ); # Get the first responding ID; that'll be the one we keep. diff --git a/maintenance/dumpBackup.php b/maintenance/dumpBackup.php index b934120b57..c7266e9868 100644 --- a/maintenance/dumpBackup.php +++ b/maintenance/dumpBackup.php @@ -133,7 +133,7 @@ if( isset( $options['quiet'] ) ) { $dumper->reporting = false; } if( isset( $options['report'] ) ) { - $dumper->reportingInterval = IntVal( $options['report'] ); + $dumper->reportingInterval = intval( $options['report'] ); } if( isset( $options['server'] ) ) { $dumper->server = $options['server']; diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 314c44c148..21894a62a4 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -115,7 +115,7 @@ if( isset( $options['quiet'] ) ) { $reader->reporting = false; } if( isset( $options['report'] ) ) { - $reader->reportingInterval = IntVal( $options['report'] ); + $reader->reportingInterval = intval( $options['report'] ); } if( isset( $options['dry-run'] ) ) { $reader->dryRun = true; diff --git a/maintenance/importLogs.inc b/maintenance/importLogs.inc index c31f1c772c..1ce9b73830 100644 --- a/maintenance/importLogs.inc +++ b/maintenance/importLogs.inc @@ -116,7 +116,7 @@ class LogImporter { 'log_type' => $this->type, 'log_action' => preg_replace( '!^.*/!', '', $action ), 'log_timestamp' => $date, - 'log_user' => IntVal( User::idFromName( $user->getText() ) ), + 'log_user' => intval( User::idFromName( $user->getText() ) ), 'log_namespace' => $target->getNamespace(), 'log_title' => $target->getDBkey(), 'log_comment' => wfUnescapeWikiText( $comment ), diff --git a/maintenance/importPhase2.php b/maintenance/importPhase2.php index e53097b0f6..27f99b47e9 100644 --- a/maintenance/importPhase2.php +++ b/maintenance/importPhase2.php @@ -158,7 +158,7 @@ class Phase2Importer { print " ($total total)\n"; while( $row = wfFetchObject( $res ) ) { - $id = IntVal( $row->user_id ); + $id = intval( $row->user_id ); $list = explode( "\n", $row->user_watch ); foreach( $list as $page ) { $title = $this->titleCache->fetch( $page ); @@ -310,7 +310,7 @@ class Phase2Importer { print " ($total total)\n"; while( $row = wfFetchObject( $res ) ) { - $id = IntVal( $row->user_id ); + $id = intval( $row->user_id ); $option = wfStrencode( $this->rewriteUserOptions( $row->user_options ) ); wfQuery( "UPDATE user SET user_options='$option' WHERE user_id=$id LIMIT 1", DB_MASTER ); if( ++$n % 50 == 0 ) { diff --git a/maintenance/rebuildrecentchanges.inc b/maintenance/rebuildrecentchanges.inc index 4c23901a66..b7c54b7402 100644 --- a/maintenance/rebuildrecentchanges.inc +++ b/maintenance/rebuildrecentchanges.inc @@ -83,14 +83,14 @@ function rebuildRecentChangesTablePass2() $new = 0; if( $obj->rc_cur_id != $lastCurId ) { # Switch! Look up the previous last edit, if any - $lastCurId = IntVal( $obj->rc_cur_id ); + $lastCurId = intval( $obj->rc_cur_id ); $emit = $obj->rc_timestamp; $sql2 = "SELECT old_id FROM $old,$cur " . "WHERE old_namespace=cur_namespace AND old_title=cur_title AND cur_id={$lastCurId} ". "AND old_timestamp<'{$emit}' ORDER BY old_timestamp DESC LIMIT 1"; $res2 = $dbw->query( $sql2 ); if( $row = $dbw->fetchObject( $res2 ) ) { - $lastOldId = IntVal( $row->old_id ); + $lastOldId = intval( $row->old_id ); } else { # No previous edit $lastOldId = 0; @@ -104,7 +104,7 @@ function rebuildRecentChangesTablePass2() $sql3 = "UPDATE $recentchanges SET rc_last_oldid=$lastOldId,rc_new=$new,rc_type=$new " . "WHERE rc_cur_id={$lastCurId} AND rc_this_oldid={$obj->rc_this_oldid}"; $dbw->query( $sql3 ); - $lastOldId = IntVal( $obj->rc_this_oldid ); + $lastOldId = intval( $obj->rc_this_oldid ); } } $dbw->freeResult( $res ); diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 2676b354ad..5cde1e51b3 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -500,7 +500,7 @@ function do_pagelinks_update() { function do_pagelinks_namespace( $namespace ) { global $wgDatabase, $wgContLang; - $ns = IntVal( $namespace ); + $ns = intval( $namespace ); echo "Cleaning up broken links for namespace $ns... "; $pagelinks = $wgDatabase->tableName( 'pagelinks' ); diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 10704dff01..db2487d0c4 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -273,7 +273,7 @@ class UserDupes { */ function editCountOn( $table, $field, $userid ) { $fname = 'UserDupes::editCountOn'; - return IntVal( $this->db->selectField( + return intval( $this->db->selectField( $table, 'COUNT(*)', array( $field => $userid ), diff --git a/tests/SearchEngineTest.php b/tests/SearchEngineTest.php index 6f3e8d4f7f..1c732b3448 100644 --- a/tests/SearchEngineTest.php +++ b/tests/SearchEngineTest.php @@ -77,7 +77,7 @@ END function fetchIds( &$results ) { $matches = array(); while( $row = $results->fetchObject() ) { - $matches[] = IntVal( $row->page_id ); + $matches[] = intval( $row->page_id ); } $results->free(); # Search is not guaranteed to return results in a certain order; -- 2.20.1