Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/51841
Change subject: Change intval( User::getOption() ) to User::getIntOption()
......................................................................
Change intval( User::getOption() ) to User::getIntOption()
Also changed some getOption with int or bool cast
Change-Id: Ia551a50e9de047c62be84065481fdf8c02e2ef96
---
M includes/ImagePage.php
M includes/Pager.php
M includes/User.php
M includes/WebRequest.php
M includes/api/ApiBase.php
M includes/specials/SpecialNewpages.php
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialUndelete.php
M includes/specials/SpecialUpload.php
M includes/specials/SpecialUserlogin.php
M includes/specials/SpecialWatchlist.php
11 files changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/41/51841/1
diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 0b814ec..998d607 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -916,7 +916,7 @@
public function getImageLimitsFromOption( $user, $optionName ) {
global $wgImageLimits;
- $option = intval( $user->getOption( $optionName ) );
+ $option = $user->getIntOption( $optionName );
if ( !isset( $wgImageLimits[$option] ) ) {
$option = User::getDefaultOption( $optionName );
}
diff --git a/includes/Pager.php b/includes/Pager.php
index 9e937e4..746b02e 100644
--- a/includes/Pager.php
+++ b/includes/Pager.php
@@ -143,7 +143,7 @@
$this->mOffset = $this->mRequest->getText( 'offset' );
# Use consistent behavior for the limit options
- $this->mDefaultLimit = intval( $this->getUser()->getOption(
'rclimit' ) );
+ $this->mDefaultLimit = $this->getUser()->getIntOption(
'rclimit' );
if ( !$this->mLimit ) {
// Don't override if a subclass calls $this->setLimit()
in its constructor.
list( $this->mLimit, /* $offset */ ) =
$this->mRequest->getLimitOffset();
diff --git a/includes/User.php b/includes/User.php
index fca2032..2263cae 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -2474,7 +2474,7 @@
*/
public function getStubThreshold() {
global $wgMaxArticleSize; # Maximum article size, in Kb
- $threshold = intval( $this->getOption( 'stubthreshold' ) );
+ $threshold = $this->getIntOption( 'stubthreshold' );
if ( $threshold > $wgMaxArticleSize * 1024 ) {
# If they have set an impossible value, disable the
preference
# so we can use the parser cache again.
diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index 50da049..2195fbb 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -741,7 +741,7 @@
$limit = 0;
}
if( ( $limit == 0 ) && ( $optionname != '' ) ) {
- $limit = (int)$wgUser->getOption( $optionname );
+ $limit = $wgUser->getIntOption( $optionname );
}
if( $limit <= 0 ) {
$limit = $deflimit;
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 4a6dad3..d042eb8 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -842,7 +842,7 @@
? 'watchdefault' :
'watchcreations';
}
# Watch the article based on the user preference
- return (bool)$this->getUser()->getOption(
$userOption );
+ return $this->getUser()->getBoolOption(
$userOption );
case 'nochange':
return $userWatching;
diff --git a/includes/specials/SpecialNewpages.php
b/includes/specials/SpecialNewpages.php
index 0499e57..6e8e634 100644
--- a/includes/specials/SpecialNewpages.php
+++ b/includes/specials/SpecialNewpages.php
@@ -53,7 +53,7 @@
$opts->add( 'hidepatrolled', $this->getUser()->getBoolOption(
'newpageshidepatrolled' ) );
$opts->add( 'hidebots', false );
$opts->add( 'hideredirs', true );
- $opts->add( 'limit', (int)$this->getUser()->getOption(
'rclimit' ) );
+ $opts->add( 'limit', $this->getUser()->getIntOption( 'rclimit'
) );
$opts->add( 'offset', '' );
$opts->add( 'namespace', '0' );
$opts->add( 'username', '' );
diff --git a/includes/specials/SpecialRecentchanges.php
b/includes/specials/SpecialRecentchanges.php
index 7ea3a94..2cc5f9e 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -42,8 +42,8 @@
public function getDefaultOptions() {
$opts = new FormOptions();
- $opts->add( 'days', (int)$this->getUser()->getOption( 'rcdays'
) );
- $opts->add( 'limit', (int)$this->getUser()->getOption(
'rclimit' ) );
+ $opts->add( 'days', $this->getUser()->getIntOption( 'rcdays' )
);
+ $opts->add( 'limit', $this->getUser()->getIntOption( 'rclimit'
) );
$opts->add( 'from', '' );
$opts->add( 'hideminor', $this->getUser()->getBoolOption(
'hideminor' ) );
diff --git a/includes/specials/SpecialUndelete.php
b/includes/specials/SpecialUndelete.php
index afc41bf..b6578a3 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -939,8 +939,8 @@
// source view for textual content
$sourceView = Xml::element( 'textarea', array(
'readonly' => 'readonly',
- 'cols' => intval( $user->getOption( 'cols' ) ),
- 'rows' => intval( $user->getOption( 'rows' ) )
),
+ 'cols' => $user->getIntOption( 'cols' ),
+ 'rows' => $user->getIntOption( 'rows' ) ),
$content->getNativeData() . "\n" );
$previewButton = Xml::element( 'input', array(
diff --git a/includes/specials/SpecialUpload.php
b/includes/specials/SpecialUpload.php
index c1505a0..a37f5fb 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -953,7 +953,7 @@
? 'filereuploadsummary'
: 'fileuploadsummary',
'default' => $this->mComment,
- 'cols' => intval( $this->getUser()->getOption(
'cols' ) ),
+ 'cols' => $this->getUser()->getIntOption(
'cols' ),
'rows' => 8,
)
);
diff --git a/includes/specials/SpecialUserlogin.php
b/includes/specials/SpecialUserlogin.php
index 27701d4..634d06f 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -747,7 +747,7 @@
case self::SUCCESS:
# We've verified now, update the real record
$user = $this->getUser();
- if( (bool)$this->mRemember !=
(bool)$user->getOption( 'rememberpassword' ) ) {
+ if( (bool)$this->mRemember !=
$user->getBoolOption( 'rememberpassword' ) ) {
$user->setOption( 'rememberpassword',
$this->mRemember ? 1 : 0 );
$user->saveSettings();
} else {
diff --git a/includes/specials/SpecialWatchlist.php
b/includes/specials/SpecialWatchlist.php
index bf2d08b..7114fc9 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -226,7 +226,7 @@
# Toggle watchlist content (all recent edits or just the latest)
if( $values['extended'] ) {
- $limitWatchlist = intval( $user->getOption( 'wllimit' )
);
+ $limitWatchlist = $user->getIntOption( 'wllimit' );
$usePage = false;
} else {
# Top log Ids for a page are not stored
--
To view, visit https://gerrit.wikimedia.org/r/51841
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia551a50e9de047c62be84065481fdf8c02e2ef96
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits