print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
} else {
print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
- $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... ";
# 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 ) {
function pageDataFromId( &$dbr, $id ) {
return $this->pageData( $dbr, array(
- 'page_id' => IntVal( $id ) ) );
+ 'page_id' => intval( $id ) ) );
}
/**
}
# 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' ),
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 {
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 );
*/
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;
}
}
// be sure it's an integer
- $this->id = IntVal($this->id);
+ $this->id = intval($this->id);
if($this->id) {
// By ID
function getId() { return $this->id; }
function setId($id) {
- $this->id = IntVal($id);
+ $this->id = intval($id);
$this->dataLoaded = false;
}
global $wgUseSquid, $wgInternalServer;
global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath;
- $width = IntVal( $width );
+ $width = intval( $width );
$this->load();
if ( ! $this->exists() )
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,
'%' => 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 ) );
}
}
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' );
*/
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 {
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;
function newFromId( $id ) {
return Revision::newFromConds(
array( 'page_id=rev_page',
- 'rev_id' => IntVal( $id ) ) );
+ 'rev_id' => intval( $id ) ) );
}
/**
*/
function newFromTitle( &$title, $id = 0 ) {
if( $id ) {
- $matchId = IntVal( $id );
+ $matchId = intval( $id );
} else {
$matchId = 'page_latest';
}
*/
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;
}
*/
function loadFromTitle( &$db, $title, $id = 0 ) {
if( $id ) {
- $matchId = IntVal( $id );
+ $matchId = intval( $id );
} else {
$matchId = 'page_latest';
}
*/
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,
// 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;
}
function decCharReference( $codepoint ) {
- $point = IntVal( $codepoint );
+ $point = intval( $codepoint );
if( Sanitizer::validateCodepoint( $point ) ) {
return sprintf( '&#%d;', $point );
} else {
* @access public
*/
function setLimitOffset( $limit, $offset = 0 ) {
- $this->limit = IntVal( $limit );
- $this->offset = IntVal( $offset );
+ $this->limit = intval( $limit );
+ $this->offset = intval( $offset );
}
/**
$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 .'";';
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(
);
}
} 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'),
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();
# 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;
$lines = explode( "\n", $text );
- $max = IntVal( $contextchars ) + 1;
+ $max = intval( $contextchars ) + 1;
$pat1 = "/(.*)($terms)(.{0,$max})/i";
$lineno = 0;
$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 );
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' );
}
/**
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' );
}
/**
}
} else {
wfDebug( "$fname: adding record for $key $summary\n" );
- $wgMemc->add( $key, 1, IntVal( $period ) );
+ $wgMemc->add( $key, 1, intval( $period ) );
}
$wgMemc->incr( $key );
}
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();
}
# Paranoia
- $this->mId = IntVal( $this->mId );
+ $this->mId = intval( $this->mId );
/** Anonymous user */
if( !$this->mId ) {
* @return int
*/
function getInt( $name, $default = 0 ) {
- return IntVal( $this->getVal( $name, $default ) );
+ return intval( $this->getVal( $name, $default ) );
}
/**
function getIntOrNull( $name ) {
$val = $this->getVal( $name );
return is_numeric( $val )
- ? IntVal( $val )
+ ? intval( $val )
: null;
}
| (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 ) {
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' ) );
$source = codepointToUtf8( hexdec( $codepoint ) );
if( $canonicalCombiningClass != 0 ) {
- $combiningClass[$source] = IntVal( $canonicalCombiningClass );
+ $combiningClass[$source] = intval( $canonicalCombiningClass );
}
if( $decompositionMapping === '' ) continue;
## ------
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";
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("/", ":");
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;
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 );
}
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.
$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'];
$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;
'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 ),
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 );
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 ) {
$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;
$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 );
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' );
*/
function editCountOn( $table, $field, $userid ) {
$fname = 'UserDupes::editCountOn';
- return IntVal( $this->db->selectField(
+ return intval( $this->db->selectField(
$table,
'COUNT(*)',
array( $field => $userid ),
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;