Add/remove whitelines to increase readability in API code files
authorSam Reed <reedy@users.mediawiki.org>
Sat, 23 Jan 2010 22:26:40 +0000 (22:26 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 23 Jan 2010 22:26:40 +0000 (22:26 +0000)
27 files changed:
includes/api/ApiBase.php
includes/api/ApiDelete.php
includes/api/ApiDisabled.php
includes/api/ApiEditPage.php
includes/api/ApiEmailUser.php
includes/api/ApiExpandTemplates.php
includes/api/ApiFormatRaw.php
includes/api/ApiFormatWddx.php
includes/api/ApiFormatYaml_spyc.php
includes/api/ApiImport.php
includes/api/ApiMove.php
includes/api/ApiQueryAllpages.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiResult.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php
includes/api/ApiUserrights.php
includes/api/ApiWatch.php

index 785715c..2ad4106 100644 (file)
@@ -657,13 +657,16 @@ abstract class ApiBase {
                        return array();
                $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
                $valuesList = explode( '|', $value, $sizeLimit + 1 );
+
                if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
                        $this->setWarning( "Too many values supplied for parameter '$valueName': the limit is $sizeLimit" );
                }
+
                if ( !$allowMultiple && count( $valuesList ) != 1 ) {
                        $possibleValues = is_array( $allowedValues ) ? "of '" . implode( "', '", $allowedValues ) . "'" : '';
                        $this->dieUsage( "Only one $possibleValues is allowed for parameter '$valueName'", "multival_$valueName" );
                }
+
                if ( is_array( $allowedValues ) ) {
                        # Check for unknown values
                        $unknown = array_diff( $valuesList, $allowedValues );
index bffbfc8..35365fa 100644 (file)
@@ -27,7 +27,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        require_once ( "ApiBase.php" );
 }
 
-
 /**
  * API module that facilitates deleting pages. The API eqivalent of action=delete.
  * Requires API write mode to be enabled.
@@ -74,15 +73,13 @@ class ApiDelete extends ApiBase {
                if ( $titleObj->getNamespace() == NS_FILE ) {
                        $retval = self::deleteFile( $params['token'], $titleObj, $params['oldimage'], $reason, false );
                        if ( count( $retval ) )
-                               // We don't care about multiple errors, just report one of them
-                               $this->dieUsageMsg( reset( $retval ) );
+                               $this->dieUsageMsg( reset( $retval ) ); // We don't care about multiple errors, just report one of them
                } else {
                        $articleObj = new Article( $titleObj );
                        $retval = self::delete( $articleObj, $params['token'], $reason );
                        
                        if ( count( $retval ) )
-                               // We don't care about multiple errors, just report one of them
-                               $this->dieUsageMsg( reset( $retval ) );
+                               $this->dieUsageMsg( reset( $retval ) ); // We don't care about multiple errors, just report one of them
                        
                        if ( $params['watch'] || $wgUser->getOption( 'watchdeletion' ) )
                                $articleObj->doWatch();
index 21e8f97..a19a6d4 100644 (file)
@@ -27,7 +27,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        require_once ( "ApiBase.php" );
 }
 
-
 /**
  * API module that dies with an error immediately.
  *
index 8c71bd6..27d07c2 100644 (file)
@@ -44,14 +44,18 @@ class ApiEditPage extends ApiBase {
        public function execute() {
                global $wgUser;
                $params = $this->extractRequestParams();
+               
                if ( is_null( $params['title'] ) )
                        $this->dieUsageMsg( array( 'missingparam', 'title' ) );
+
                if ( is_null( $params['text'] ) && is_null( $params['appendtext'] ) &&
                                is_null( $params['prependtext'] ) &&
                                $params['undo'] == 0 )
                        $this->dieUsageMsg( array( 'missingtext' ) );
+
                if ( is_null( $params['token'] ) )
                        $this->dieUsageMsg( array( 'missingparam', 'token' ) );
+
                if ( !$wgUser->matchEditToken( $params['token'] ) )
                        $this->dieUsageMsg( array( 'sessionfailure' ) );
 
@@ -113,14 +117,17 @@ class ApiEditPage extends ApiBase {
                        $undoRev = Revision::newFromID( $params['undo'] );
                        if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) )
                                $this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
+
                        if ( $params['undoafter'] == 0 )
                                $undoafterRev = $undoRev->getPrevious();
                        if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) )
                                $this->dieUsageMsg( array( 'nosuchrevid', $params['undoafter'] ) );
+
                        if ( $undoRev->getPage() != $articleObj->getID() )
                                $this->dieUsageMsg( array( 'revwrongpage', $undoRev->getID(), $titleObj->getPrefixedText() ) );
                        if ( $undoafterRev->getPage() != $articleObj->getID() )
                                $this->dieUsageMsg( array( 'revwrongpage', $undoafterRev->getID(), $titleObj->getPrefixedText() ) );
+                               
                        $newtext = $articleObj->getUndoText( $undoRev, $undoafterRev );
                        if ( $newtext === false )
                                $this->dieUsageMsg( array( 'undo-failure' ) );
@@ -132,9 +139,8 @@ class ApiEditPage extends ApiBase {
                }
 
                # See if the MD5 hash checks out
-               if ( !is_null( $params['md5'] ) )
-                       if ( md5( $toMD5 ) !== $params['md5'] )
-                               $this->dieUsageMsg( array( 'hashcheckfailed' ) );
+               if ( !is_null( $params['md5'] ) && md5( $toMD5 ) !== $params['md5'] )
+                       $this->dieUsageMsg( array( 'hashcheckfailed' ) );
                
                $ep = new EditPage( $articleObj );
                // EditPage wants to parse its stuff from a WebRequest
@@ -143,23 +149,28 @@ class ApiEditPage extends ApiBase {
                                'wpEditToken' => $params['token'],
                                'wpIgnoreBlankSummary' => ''
                );
+
                if ( !is_null( $params['summary'] ) )
                        $reqArr['wpSummary'] = $params['summary'];
+
                # Watch out for basetimestamp == ''
                # wfTimestamp() treats it as NOW, almost certainly causing an edit conflict
                if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' )
                        $reqArr['wpEdittime'] = wfTimestamp( TS_MW, $params['basetimestamp'] );
                else
                        $reqArr['wpEdittime'] = $articleObj->getTimestamp();
+
                if ( !is_null( $params['starttimestamp'] ) && $params['starttimestamp'] != '' )
                        $reqArr['wpStarttime'] = wfTimestamp( TS_MW, $params['starttimestamp'] );
                else
-                       # Fake wpStartime
-                       $reqArr['wpStarttime'] = $reqArr['wpEdittime'];
+                       $reqArr['wpStarttime'] = $reqArr['wpEdittime'];                 # Fake wpStartime
+
                if ( $params['minor'] || ( !$params['notminor'] && $wgUser->getOption( 'minordefault' ) ) )
                        $reqArr['wpMinoredit'] = '';
+
                if ( $params['recreate'] )
                        $reqArr['wpRecreate'] = '';
+
                if ( !is_null( $params['section'] ) )
                {
                        $section = intval( $params['section'] );
@@ -208,6 +219,7 @@ class ApiEditPage extends ApiBase {
                        $wgRequest->setVal( 'wpCaptchaId', $params['captchaid'] );
                if ( !is_null( $params['captchaword'] ) )
                        $wgRequest->setVal( 'wpCaptchaWord', $params['captchaword'] );
+
                $r = array();
                if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) )
                {
@@ -236,39 +248,55 @@ class ApiEditPage extends ApiBase {
                        case EditPage::AS_HOOK_ERROR:
                        case EditPage::AS_HOOK_ERROR_EXPECTED:
                                $this->dieUsageMsg( array( 'hookaborted' ) );
+
                        case EditPage::AS_IMAGE_REDIRECT_ANON:
                                $this->dieUsageMsg( array( 'noimageredirect-anon' ) );
+
                        case EditPage::AS_IMAGE_REDIRECT_LOGGED:
                                $this->dieUsageMsg( array( 'noimageredirect-logged' ) );
+
                        case EditPage::AS_SPAM_ERROR:
                                $this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
+
                        case EditPage::AS_FILTERING:
                                $this->dieUsageMsg( array( 'filtered' ) );
+
                        case EditPage::AS_BLOCKED_PAGE_FOR_USER:
                                $this->dieUsageMsg( array( 'blockedtext' ) );
+
                        case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
                        case EditPage::AS_CONTENT_TOO_BIG:
                                global $wgMaxArticleSize;
                                $this->dieUsageMsg( array( 'contenttoobig', $wgMaxArticleSize ) );
+
                        case EditPage::AS_READ_ONLY_PAGE_ANON:
                                $this->dieUsageMsg( array( 'noedit-anon' ) );
+
                        case EditPage::AS_READ_ONLY_PAGE_LOGGED:
                                $this->dieUsageMsg( array( 'noedit' ) );
+
                        case EditPage::AS_READ_ONLY_PAGE:
                                $this->dieReadOnly();
+
                        case EditPage::AS_RATE_LIMITED:
                                $this->dieUsageMsg( array( 'actionthrottledtext' ) );
+
                        case EditPage::AS_ARTICLE_WAS_DELETED:
                                $this->dieUsageMsg( array( 'wasdeleted' ) );
+
                        case EditPage::AS_NO_CREATE_PERMISSION:
                                $this->dieUsageMsg( array( 'nocreate-loggedin' ) );
+
                        case EditPage::AS_BLANK_ARTICLE:
                                $this->dieUsageMsg( array( 'blankpage' ) );
+
                        case EditPage::AS_CONFLICT_DETECTED:
                                $this->dieUsageMsg( array( 'editconflict' ) );
+
                        # case EditPage::AS_SUMMARY_NEEDED: Can't happen since we set wpIgnoreBlankSummary
                        case EditPage::AS_TEXTBOX_EMPTY:
                                $this->dieUsageMsg( array( 'emptynewsection' ) );
+
                        case EditPage::AS_SUCCESS_NEW_ARTICLE:
                                $r['new'] = '';
                        case EditPage::AS_SUCCESS_UPDATE:
@@ -291,6 +319,7 @@ class ApiEditPage extends ApiBase {
                                                $newArticle->getTimestamp() );
                                }
                                break;
+
                        case EditPage::AS_END:
                                # This usually means some kind of race condition
                                # or DB weirdness occurred. Fall through to throw an unknown 
index cf56c5e..469fe37 100644 (file)
@@ -27,7 +27,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        require_once ( "ApiBase.php" );
 }
 
-
 /**
  * @ingroup API
  */
@@ -61,8 +60,7 @@ class ApiEmailUser extends ApiBase {
                $error = EmailUserForm::getPermissionsError( $wgUser, $params['token'] );
                if ( $error )
                        $this->dieUsageMsg( array( $error ) );
-               
-                       
+
                $form = new EmailUserForm( $targetUser, $params['text'], $params['subject'], $params['ccme'] );
                $retval = $form->doSubmit();
                if ( is_null( $retval ) )
index 0ddd62a..5876645 100644 (file)
@@ -55,6 +55,7 @@ class ApiExpandTemplates extends ApiBase {
                // Parse text
                global $wgParser;
                $options = new ParserOptions();
+               
                if ( $params['generatexml'] )
                {
                        $wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS );
index be646df..ee8f573 100644 (file)
@@ -46,10 +46,13 @@ class ApiFormatRaw extends ApiFormatBase {
 
        public function getMimeType() {
                $data = $this->getResultData();
+
                if ( isset( $data['error'] ) )
                        return $this->mErrorFallback->getMimeType();
+
                if ( !isset( $data['mime'] ) )
                        ApiBase::dieDebug( __METHOD__, "No MIME type set for raw formatter" );
+       
                return $data['mime'];
        }
 
@@ -60,6 +63,7 @@ class ApiFormatRaw extends ApiFormatBase {
                        $this->mErrorFallback->execute();
                        return;
                }
+               
                if ( !isset( $data['text'] ) )
                        ApiBase::dieDebug( __METHOD__, "No text given for raw formatter" );
                $this->printText( $data['text'] );
index 117f222..9b38208 100644 (file)
@@ -80,8 +80,7 @@ class ApiFormatWddx extends ApiFormatBase {
                                if ( $cnt == 0 || array_keys( $elemValue ) === range( 0, $cnt - 1 ) ) {
                                        // Regular array
                                        $this->printText( $indstr . Xml::element( 'array', array(
-                                               'length' => $cnt
-                                       ), null ) . $nl );
+                                               'length' => $cnt ), null ) . $nl );
                                        foreach ( $elemValue as $subElemValue )
                                                $this->slowWddxPrinter( $subElemValue, $indent + 2 );
                                        $this->printText( "$indstr</array>$nl" );
index 47c8480..3f375eb 100644 (file)
@@ -159,7 +159,6 @@ class Spyc {
                        strpos( $value, "\n" ) ||
                        preg_match( "/[#:]/", $value ) ||
                        preg_match( "/^[-?,[\]{}!*&|>'\"%@`]/", $value ) ) );
-
        }
 
        /**
index 2633bbe..a57217f 100644 (file)
@@ -91,8 +91,8 @@ class ApiImport extends ApiBase {
                                $result->mByte . $result->mContext,
                                xml_error_string( $result->mXmlError ) ) );
                else if ( WikiError::isError( $result ) )
-                       // This shouldn't happen
-                       $this->dieUsageMsg( array( 'import-unknownerror', $result->getMessage() ) );
+                       $this->dieUsageMsg( array( 'import-unknownerror', $result->getMessage() ) ); // This shouldn't happen
+
                $resultData = $reporter->getData();
                $this->getResult()->setIndexedTagName( $resultData, 'page' );
                $this->getResult()->addValue( null, $this->getModuleName(), $resultData );
index 6512e90..8d0f94b 100644 (file)
@@ -63,6 +63,7 @@ class ApiMove extends ApiBase {
                        if ( !$fromTitle )
                                $this->dieUsageMsg( array( 'nosuchpageid', $params['fromid'] ) );
                }
+
                if ( !$fromTitle->exists() )
                        $this->dieUsageMsg( array( 'notanarticle' ) );
                $fromTalk = $fromTitle->getTalkPage();
index 0d3572a..e2da777 100644 (file)
@@ -137,8 +137,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                if ( $forceNameTitleIndex )
                        $this->addOption( 'USE INDEX', 'name_title' );
 
-               
-
                $limit = $params['limit'];
                $this->addOption( 'LIMIT', $limit + 1 );
                $res = $this->select( __METHOD__ );
index 71d5a6f..ca0d6d9 100644 (file)
@@ -79,6 +79,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                        }
                        $this->addWhereFld( 'cl_to', $cats );
                }
+
                if ( !is_null( $params['continue'] ) ) {
                        $cont = explode( '|', $params['continue'] );
                        if ( count( $cont ) != 2 )
@@ -90,6 +91,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                                        "(cl_from = $clfrom AND " .
                                        "cl_to >= '$clto')" );
                }
+
                if ( isset( $show['hidden'] ) && isset( $show['!hidden'] ) )
                        $this->dieUsage( "Incorrect parameter - mutually exclusive values may not be supplied", 'show' );
                if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) || isset( $prop['hidden'] ) )
index 47cb3f2..2a21fc2 100644 (file)
@@ -65,8 +65,10 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                                'pp_page=page_id',
                                'pp_propname' => 'hiddencat' ) ),
                ) );
+
                $this->addFields( array( 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'pp_propname AS cat_hidden' ) );
                $this->addWhere( array( 'cat_title' => $cattitles ) );
+
                if ( !is_null( $params['continue'] ) )
                {
                        $title = $this->getDB()->addQuotes( $params['continue'] );
index 10f068a..11bfba2 100644 (file)
@@ -202,8 +202,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                                $rev['user'] = $row->ar_user_text;
                        if ( $fld_comment )
                                $rev['comment'] = $row->ar_comment;
-                       if ( $fld_minor )
-                               if ( $row->ar_minor_edit == 1 )
+                       if ( $fld_minor && $row->ar_minor_edit == 1)
                                        $rev['minor'] = '';
                        if ( $fld_len )
                                $rev['len'] = $row->ar_len;
index 11b8ac6..9d5484b 100644 (file)
@@ -63,11 +63,13 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                        'i2.img_user_text AS dup_user_text',
                        'i2.img_timestamp AS dup_timestamp'
                ) );
+
                $this->addWhere( array(
                        'i1.img_name' => array_keys( $images ),
                        'i1.img_sha1 = i2.img_sha1',
                        'i1.img_name != i2.img_name',
                ) );
+
                if ( isset( $params['continue'] ) )
                {
                        $cont = explode( '|', $params['continue'] );
@@ -80,6 +82,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                                        "(i1.img_name = '$orig' AND " .
                                        "i2.img_name >= '$dup')" );
                }
+
                $this->addOption( 'ORDER BY', 'i1.img_name' );
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
 
index 25c3077..b2410c3 100644 (file)
@@ -51,9 +51,11 @@ class ApiQueryExternalLinks extends ApiQueryBase {
 
                $this->addTables( 'externallinks' );
                $this->addWhereFld( 'el_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
+
                # Don't order by el_from if it's constant in the WHERE clause
                if ( count( $this->getPageSet()->getGoodTitles() ) != 1 )
                        $this->addOption( 'ORDER BY', 'el_from' );
+
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
                if ( !is_null( $params['offset'] ) )
                        $this->addOption( 'OFFSET', $params['offset'] );
index 84bfe2c..3f40330 100644 (file)
@@ -71,6 +71,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                                        "(il_from = $ilfrom AND " .
                                        "il_to >= '$ilto')" );
                }
+
                # Don't order by il_from if it's constant in the WHERE clause
                if ( count( $this->getPageSet()->getGoodTitles() ) == 1 )
                        $this->addOption( 'ORDER BY', 'il_to' );
index 0e7c8b5..9180c00 100644 (file)
@@ -63,6 +63,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                                        "(ll_from = $llfrom AND " .
                                        "ll_lang >= '$lllang')" );
                }
+
                # Don't order by ll_from if it's constant in the WHERE clause
                if ( count( $this->getPageSet()->getGoodTitles() ) == 1 )
                        $this->addOption( 'ORDER BY', 'll_lang' );
index afb0c08..62ee76d 100644 (file)
@@ -62,24 +62,29 @@ class ApiQueryUserInfo extends ApiQueryBase {
 
                if ( $wgUser->isAnon() )
                        $vals['anon'] = '';
+
                if ( isset( $this->prop['blockinfo'] ) ) {
                        if ( $wgUser->isBlocked() ) {
                                $vals['blockedby'] = User::whoIs( $wgUser->blockedBy() );
                                $vals['blockreason'] = $wgUser->blockedFor();
                        }
                }
+
                if ( isset( $this->prop['hasmsg'] ) && $wgUser->getNewtalk() ) {
                        $vals['messages'] = '';
                }
+
                if ( isset( $this->prop['groups'] ) ) {
                        $vals['groups'] = $wgUser->getGroups();
                        $result->setIndexedTagName( $vals['groups'], 'g' );     // even if empty
                }
+
                if ( isset( $this->prop['rights'] ) ) {
                        // User::getRights() may return duplicate values, strip them
                        $vals['rights'] = array_values( array_unique( $wgUser->getRights() ) );
                        $result->setIndexedTagName( $vals['rights'], 'r' );     // even if empty
                }
+
                if ( isset( $this->prop['changeablegroups'] ) ) {
                        $vals['changeablegroups'] = $wgUser->changeableGroups();
                        $result->setIndexedTagName( $vals['changeablegroups']['add'], 'g' );
@@ -87,18 +92,23 @@ class ApiQueryUserInfo extends ApiQueryBase {
                        $result->setIndexedTagName( $vals['changeablegroups']['add-self'], 'g' );
                        $result->setIndexedTagName( $vals['changeablegroups']['remove-self'], 'g' );
                }
+
                if ( isset( $this->prop['options'] ) ) {
                        $vals['options'] = $wgUser->getOptions();
                }
+
                if ( isset( $this->prop['preferencestoken'] ) && is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
                        $vals['preferencestoken'] = $wgUser->editToken();
                }
+
                if ( isset( $this->prop['editcount'] ) ) {
                        $vals['editcount'] = intval( $wgUser->getEditCount() );
                }
+
                if ( isset( $this->prop['ratelimits'] ) ) {
                        $vals['ratelimits'] = $this->getRateLimits();
                }
+
                if ( isset( $this->prop['email'] ) ) {
                        $vals['email'] = $wgUser->getEmail();
                        $auth = $wgUser->getEmailAuthenticationTimestamp();
index fcab4a9..929ff33 100644 (file)
@@ -33,7 +33,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
  *
  * @ingroup API
  */
-
  class ApiQueryUsers extends ApiQueryBase {
 
        public function __construct( $query, $moduleName ) {
@@ -104,6 +103,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
                         else
                                $goodNames[] = $n;
                }
+
                if ( count( $goodNames ) )
                {
                        $db = $this->getDb();
index 1d3af83..ab09572 100644 (file)
@@ -68,6 +68,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                $this->addWhereFld( 'wl_namespace', $params['namespace'] );
                $this->addWhereIf( 'wl_notificationtimestamp IS NOT NULL', isset( $show['changed'] ) );
                $this->addWhereIf( 'wl_notificationtimestamp IS NULL', isset( $show['!changed'] ) );
+
                if ( isset( $params['continue'] ) )
                {
                        $cont = explode( '|', $params['continue'] );
@@ -80,6 +81,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                                        "(wl_namespace = '$ns' AND " .
                                        "wl_title >= '$title')" );
                }
+
                // Don't ORDER BY wl_namespace if it's constant in the WHERE clause
                if ( count( $params['namespace'] ) == 1 )
                        $this->addOption( 'ORDER BY', 'wl_title' );
@@ -101,6 +103,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                                break;
                        }
                        $t = Title::makeTitle( $row->wl_namespace, $row->wl_title );
+
                        if ( is_null( $resultPageSet ) )
                        {
                                $vals = array();
index 25b8c77..58cfd7d 100644 (file)
@@ -199,17 +199,16 @@ class ApiResult extends ApiBase {
         * @param $arr array
         * @param $tag string Tag name
         */
-       public function setIndexedTagName_recursive( &$arr, $tag )
-       {
-                       if ( !is_array( $arr ) )
-                                       return;
-                       foreach ( $arr as &$a )
-                       {
-                                       if ( !is_array( $a ) )
-                                                       continue;
-                                       $this->setIndexedTagName( $a, $tag );
-                                       $this->setIndexedTagName_recursive( $a, $tag );
-                       }
+       public function setIndexedTagName_recursive( &$arr, $tag ) {
+               if ( !is_array( $arr ) )
+                               return;
+               foreach ( $arr as &$a )
+               {
+                               if ( !is_array( $a ) )
+                                               continue;
+                               $this->setIndexedTagName( $a, $tag );
+                               $this->setIndexedTagName_recursive( $a, $tag );
+               }
        }
 
        /**
index 8a8513d..a0e6e9b 100644 (file)
@@ -48,8 +48,10 @@ class ApiUndelete extends ApiBase {
 
                if ( !$wgUser->isAllowed( 'undelete' ) )
                        $this->dieUsageMsg( array( 'permdenied-undelete' ) );
+
                if ( $wgUser->isBlocked() )
                        $this->dieUsageMsg( array( 'blockedtext' ) );
+
                if ( !$wgUser->matchEditToken( $params['token'] ) )
                        $this->dieUsageMsg( array( 'sessionfailure' ) );
 
index e0b01c2..8bebedb 100644 (file)
@@ -50,7 +50,6 @@ class ApiUpload extends ApiBase {
                if ( !$wgUser->matchEditToken( $this->mParams['token'] ) )
                        $this->dieUsageMsg( array( 'sessionfailure' ) );
 
-
                // Add the uploaded file to the params array
                $this->mParams['file'] = $request->getFileName( 'file' );
 
@@ -72,7 +71,7 @@ class ApiUpload extends ApiBase {
 
                        $this->mUpload = new UploadFromStash();
                        $this->mUpload->initialize( $this->mParams['filename'],
-                                       $_SESSION['wsUploadData'][$this->mParams['sessionkey']] );
+                               $_SESSION['wsUploadData'][$this->mParams['sessionkey']] );
                } else {
                        /**
                         * Upload from url, etc
@@ -113,7 +112,6 @@ class ApiUpload extends ApiBase {
                                if ( ! $wgUser->isAllowed( 'upload_by_url' ) )
                                        $this->dieUsageMsg( array( 'badaccess-groups' ) );
 
-
                                $this->mUpload = new UploadFromUrl();
                                $this->mUpload->initialize( $this->mParams['filename'],
                                                $this->mParams['url'] );
index ea607d3..a8ccb32 100644 (file)
@@ -27,7 +27,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        require_once ( "ApiBase.php" );
 }
 
-
 /**
  * @ingroup API
  */
@@ -49,8 +48,8 @@ class ApiUserrights extends ApiBase {
                $user = $form->fetchUser( $params['user'] );
                if ( $user instanceof WikiErrorMsg )
                        $this->dieUsageMsg( array_merge(
-                               (array)$user->getMessageKey(),
-                               $user->getMessageArgs() ) );
+                               (array)$user->getMessageKey(), $user->getMessageArgs() ) );
+
                if ( !$wgUser->matchEditToken( $params['token'], $user->getName() ) )
                        $this->dieUsageMsg( array( 'sessionfailure' ) );
                
index 87c9a56..06d4a01 100644 (file)
@@ -43,12 +43,16 @@ class ApiWatch extends ApiBase {
                global $wgUser;
                if ( !$wgUser->isLoggedIn() )
                        $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' );
+
                $params = $this->extractRequestParams();
                $title = Title::newFromText( $params['title'] );
+
                if ( !$title )
                        $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
+
                $article = new Article( $title );
                $res = array( 'title' => $title->getPrefixedText() );
+
                if ( $params['unwatch'] )
                {
                        $res['unwatched'] = '';