Change intval( User::getOption() ) to User::getIntOption()
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 2 Mar 2013 16:50:56 +0000 (17:50 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 4 Mar 2013 14:08:48 +0000 (14:08 +0000)
Also changed some getOption with int or bool cast

Change-Id: Ia551a50e9de047c62be84065481fdf8c02e2ef96

includes/ImagePage.php
includes/Pager.php
includes/User.php
includes/WebRequest.php
includes/api/ApiBase.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialWatchlist.php

index 0b814ec..998d607 100644 (file)
@@ -916,7 +916,7 @@ EOT
        public function getImageLimitsFromOption( $user, $optionName ) {
                global $wgImageLimits;
 
-               $option = intval( $user->getOption( $optionName ) );
+               $option = $user->getIntOption( $optionName );
                if ( !isset( $wgImageLimits[$option] ) ) {
                        $option = User::getDefaultOption( $optionName );
                }
index 9e937e4..746b02e 100644 (file)
@@ -143,7 +143,7 @@ abstract class IndexPager extends ContextSource implements Pager {
                $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();
index fca2032..2263cae 100644 (file)
@@ -2474,7 +2474,7 @@ class User {
         */
        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.
index 50da049..2195fbb 100644 (file)
@@ -741,7 +741,7 @@ class WebRequest {
                        $limit = 0;
                }
                if( ( $limit == 0 ) && ( $optionname != '' ) ) {
-                       $limit = (int)$wgUser->getOption( $optionname );
+                       $limit = $wgUser->getIntOption( $optionname );
                }
                if( $limit <= 0 ) {
                        $limit = $deflimit;
index 6dd6a2b..9e48e3a 100644 (file)
@@ -845,7 +845,7 @@ abstract class ApiBase extends ContextSource {
                                                        ? '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;
index 0499e57..6e8e634 100644 (file)
@@ -53,7 +53,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $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', '' );
index 7ea3a94..2cc5f9e 100644 (file)
@@ -42,8 +42,8 @@ class SpecialRecentChanges extends IncludableSpecialPage {
        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' ) );
index afc41bf..b6578a3 100644 (file)
@@ -939,8 +939,8 @@ class SpecialUndelete extends SpecialPage {
                        // 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(
index c1505a0..a37f5fb 100644 (file)
@@ -953,7 +953,7 @@ class UploadForm extends HTMLForm {
                                        ? 'filereuploadsummary'
                                        : 'fileuploadsummary',
                                'default' => $this->mComment,
-                               'cols' => intval( $this->getUser()->getOption( 'cols' ) ),
+                               'cols' => $this->getUser()->getIntOption( 'cols' ),
                                'rows' => 8,
                        )
                );
index 27701d4..634d06f 100644 (file)
@@ -747,7 +747,7 @@ class LoginForm extends SpecialPage {
                        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 {
index bf2d08b..7114fc9 100644 (file)
@@ -226,7 +226,7 @@ class SpecialWatchlist extends SpecialPage {
 
                # 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