Fix CodeSniffer errors and warnings on a number of ApiQuery classes
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 14 Nov 2013 17:38:36 +0000 (18:38 +0100)
committerChad Horohoe <chadh@wikimedia.org>
Fri, 15 Nov 2013 18:33:50 +0000 (10:33 -0800)
Change-Id: I763f79c66cd8ed2ca19586323d5b3ee8b60ffd18

includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryDeletedrevs.php

index 68f2487..748dbaf 100644 (file)
@@ -58,7 +58,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        $fld_registration = isset( $prop['registration'] );
                        $fld_implicitgroups = isset( $prop['implicitgroups'] );
                } else {
-                       $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration = $fld_rights = $fld_implicitgroups = false;
+                       $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration =
+                               $fld_rights = $fld_implicitgroups = false;
                }
 
                $limit = $params['limit'];
@@ -123,7 +124,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        if ( count( $params['excludegroup'] ) == 1 ) {
                                $exclude = array( 'ug1.ug_group' => $params['excludegroup'][0] );
                        } else {
-                               $exclude = array( $db->makeList( array( 'ug1.ug_group' => $params['excludegroup'] ), LIST_OR ) );
+                               $exclude = array( $db->makeList(
+                                       array( 'ug1.ug_group' => $params['excludegroup'] ),
+                                       LIST_OR
+                               ) );
                        }
                        $this->addJoinConds( array( 'ug1' => array( 'LEFT OUTER JOIN',
                                array_merge( array( 'ug1.ug_user=user_id' ), $exclude )
@@ -187,12 +191,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
                $lastUser = false;
                $result = $this->getResult();
 
-               //
-               // This loop keeps track of the last entry.
-               // For each new row, if the new row is for different user then the last, the last entry is added to results.
-               // Otherwise, the group of the new row is appended to the last entry.
-               // The setContinue... is more complex because of this, and takes into account the higher sql limit
-               // to make sure all rows that belong to the same user are received.
+               // This loop keeps track of the last entry. For each new row, if the
+               // new row is for different user then the last, the last entry is added
+               // to results. Otherwise, the group of the new row is appended to the
+               // last entry. The setContinue... is more complex because of this, and
+               // takes into account the higher sql limit to make sure all rows that
+               // belong to the same user are received.
 
                foreach ( $res as $row ) {
                        $count++;
@@ -212,7 +216,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
                                }
 
                                if ( $count > $limit ) {
-                                       // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                                       // We've reached the one extra which shows that there are
+                                       // additional pages to be had. Stop here...
                                        $this->setContinueEnumParameter( 'from', $row->user_name );
                                        break;
                                }
@@ -246,10 +251,13 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        }
 
                        if ( $sqlLimit == $count ) {
-                               // BUG!  database contains group name that User::getAllGroups() does not return
-                               // TODO: should handle this more gracefully
-                               ApiBase::dieDebug( __METHOD__,
-                                       'MediaWiki configuration error: the database contains more user groups than known to User::getAllGroups() function' );
+                               // @todo BUG!  database contains group name that User::getAllGroups() does not return
+                               // Should handle this more gracefully
+                               ApiBase::dieDebug(
+                                       __METHOD__,
+                                       'MediaWiki configuration error: The database contains more ' .
+                                               'user groups than known to User::getAllGroups() function'
+                               );
                        }
 
                        $lastUserObj = User::newFromId( $row->user_id );
@@ -369,11 +377,13 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        'dir' => 'Direction to sort in',
                        'group' => 'Limit users to given group name(s)',
                        'excludegroup' => 'Exclude users in given group name(s)',
-                       'rights' => 'Limit users to given right(s) (does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed)',
+                       'rights' => 'Limit users to given right(s) (does not include rights ' .
+                               'granted by implicit or auto-promoted groups like *, user, or autoconfirmed)',
                        'prop' => array(
                                'What pieces of information to include.',
                                ' blockinfo      - Adds the information about a current block on the user',
-                               ' groups         - Lists groups that the user is in. This uses more server resources and may return fewer results than the limit',
+                               ' groups         - Lists groups that the user is in. This uses ' .
+                                       'more server resources and may return fewer results than the limit',
                                ' implicitgroups - Lists all the groups the user is automatically in',
                                ' rights         - Lists rights that the user has',
                                ' editcount      - Adds the edit count of the user',
@@ -433,7 +443,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'group-excludegroup', 'info' => 'group and excludegroup cannot be used together' ),
+                       array(
+                               'code' => 'group-excludegroup',
+                               'info' => 'group and excludegroup cannot be used together'
+                       ),
                ) );
        }
 
index 238c8e8..bda1e03 100644 (file)
@@ -149,7 +149,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                if ( $this->params['filterredir'] == 'redirects' ) {
                        $this->addWhereFld( 'page_is_redirect', 1 );
                } elseif ( $this->params['filterredir'] == 'nonredirects' && !$this->redirect ) {
-                       // bug 22245 - Check for !redirect, as filtering nonredirects, when getting what links to them is contradictory
+                       // bug 22245 - Check for !redirect, as filtering nonredirects, when
+                       // getting what links to them is contradictory
                        $this->addWhereFld( 'page_is_redirect', 0 );
                }
 
@@ -269,7 +270,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
 
                foreach ( $res as $row ) {
                        if ( ++$count > $this->params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                // Continue string preserved in case the redirect query doesn't pass the limit
                                $this->continueStr = $this->getContinueStr( $row->page_id );
                                break;
@@ -294,7 +296,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        $count = 0;
                        foreach ( $res as $row ) {
                                if ( ++$count > $this->params['limit'] ) {
-                                       // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                                       // We've reached the one extra which shows that there are
+                                       // additional pages to be had. Stop here...
                                        // We need to keep the parent page of this redir in
                                        if ( $this->hasNS ) {
                                                $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}];
@@ -384,7 +387,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $parentID = $this->pageMap[$ns][$row->{$this->bl_title}];
                // Put all the results in an array first
                $this->resultArr[$parentID]['redirlinks'][] = $a;
-               $this->getResult()->setIndexedTagName( $this->resultArr[$parentID]['redirlinks'], $this->bl_code );
+               $this->getResult()->setIndexedTagName(
+                       $this->resultArr[$parentID]['redirlinks'],
+                       $this->bl_code
+               );
        }
 
        protected function processContinue() {
@@ -396,7 +402,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
 
                // only image titles are allowed for the root in imageinfo mode
                if ( !$this->hasNS && $this->rootTitle->getNamespace() !== NS_FILE ) {
-                       $this->dieUsage( "The title for {$this->getModuleName()} query must be an image", 'bad_image_title' );
+                       $this->dieUsage(
+                               "The title for {$this->getModuleName()} query must be an image",
+                               'bad_image_title'
+                       );
                }
        }
 
@@ -494,9 +503,14 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                );
                if ( $this->getModuleName() != 'embeddedin' ) {
                        return array_merge( $retval, array(
-                               'redirect' => 'If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.',
-                               'filterredir' => "How to filter for redirects. If set to nonredirects when {$this->bl_code}redirect is enabled, this is only applied to the second level",
-                               'limit' => "How many total pages to return. If {$this->bl_code}redirect is enabled, limit applies to each level separately (which means you may get up to 2 * limit results)."
+                               'redirect' => 'If linking page is a redirect, find all pages ' .
+                                       'that link to that redirect as well. Maximum limit is halved.',
+                               'filterredir' => 'How to filter for redirects. If set to ' .
+                                       "nonredirects when {$this->bl_code}redirect is enabled, " .
+                                       'this is only applied to the second level',
+                               'limit' => 'How many total pages to return. If ' .
+                                       "{$this->bl_code}redirect is enabled, limit applies to each " .
+                                       'level separately (which means you may get up to 2 * limit results).'
                        ) );
                }
 
@@ -534,7 +548,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                return array_merge( parent::getPossibleErrors(),
                        $this->getTitleOrPageIdErrorMessage(),
                        array(
-                               array( 'code' => 'bad_image_title', 'info' => "The title for {$this->getModuleName()} query must be an image" ),
+                               array(
+                                       'code' => 'bad_image_title',
+                                       'info' => "The title for {$this->getModuleName()} query must be an image"
+                               ),
                        )
                );
        }
index c620a8f..cfc2244 100644 (file)
@@ -219,7 +219,9 @@ abstract class ApiQueryBase extends ApiBase {
                if ( $sort ) {
                        $order = $field . ( $isDirNewer ? '' : ' DESC' );
                        // Append ORDER BY
-                       $optionOrderBy = isset( $this->options['ORDER BY'] ) ? (array)$this->options['ORDER BY'] : array();
+                       $optionOrderBy = isset( $this->options['ORDER BY'] )
+                               ? (array)$this->options['ORDER BY']
+                               : array();
                        $optionOrderBy[] = $order;
                        $this->addOption( 'ORDER BY', $optionOrderBy );
                }
@@ -260,16 +262,37 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $method Function the query should be attributed to.
         *  You should usually use __METHOD__ here
         * @param array $extraQuery Query data to add but not store in the object
-        *  Format is array( 'tables' => ..., 'fields' => ..., 'where' => ..., 'options' => ..., 'join_conds' => ... )
+        *  Format is array(
+        *    'tables' => ...,
+        *    'fields' => ...,
+        *    'where' => ...,
+        *    'options' => ...,
+        *    'join_conds' => ...
+        *  )
         * @return ResultWrapper
         */
        protected function select( $method, $extraQuery = array() ) {
 
-               $tables = array_merge( $this->tables, isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : array() );
-               $fields = array_merge( $this->fields, isset( $extraQuery['fields'] ) ? (array)$extraQuery['fields'] : array() );
-               $where = array_merge( $this->where, isset( $extraQuery['where'] ) ? (array)$extraQuery['where'] : array() );
-               $options = array_merge( $this->options, isset( $extraQuery['options'] ) ? (array)$extraQuery['options'] : array() );
-               $join_conds = array_merge( $this->join_conds, isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array() );
+               $tables = array_merge(
+                       $this->tables,
+                       isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : array()
+               );
+               $fields = array_merge(
+                       $this->fields,
+                       isset( $extraQuery['fields'] ) ? (array)$extraQuery['fields'] : array()
+               );
+               $where = array_merge(
+                       $this->where,
+                       isset( $extraQuery['where'] ) ? (array)$extraQuery['where'] : array()
+               );
+               $options = array_merge(
+                       $this->options,
+                       isset( $extraQuery['options'] ) ? (array)$extraQuery['options'] : array()
+               );
+               $join_conds = array_merge(
+                       $this->join_conds,
+                       isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array()
+               );
 
                // getDB has its own profileDBIn/Out calls
                $db = $this->getDB();
@@ -289,7 +312,13 @@ abstract class ApiQueryBase extends ApiBase {
        protected function checkRowCount() {
                $db = $this->getDB();
                $this->profileDBIn();
-               $rowcount = $db->estimateRowCount( $this->tables, $this->fields, $this->where, __METHOD__, $this->options );
+               $rowcount = $db->estimateRowCount(
+                       $this->tables,
+                       $this->fields,
+                       $this->where,
+                       __METHOD__,
+                       $this->options
+               );
                $this->profileDBOut();
 
                global $wgAPIMaxDBRows;
index 8dad635..57f76bc 100644 (file)
@@ -76,7 +76,12 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $fld_flags );
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
-               $this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] );
+               $this->addTimestampWhereRange(
+                       'ipb_timestamp',
+                       $params['dir'],
+                       $params['start'],
+                       $params['end']
+               );
 
                $db = $this->getDB();
 
@@ -107,7 +112,10 @@ class ApiQueryBlocks extends ApiQueryBase {
                        # Check range validity, if it's a CIDR
                        list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
                        if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
-                               $this->dieUsage( "$type CIDR ranges broader than /$cidrLimit are not accepted", 'cidrtoobroad' );
+                               $this->dieUsage(
+                                       "$type CIDR ranges broader than /$cidrLimit are not accepted",
+                                       'cidrtoobroad'
+                               );
                        }
 
                        # Let IP::parseRange handle calculating $upper, instead of duplicating the logic here.
@@ -145,8 +153,10 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
                        $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
                        $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
-                       $this->addWhereIf( 'ipb_expiry = ' . $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
-                       $this->addWhereIf( 'ipb_expiry != ' . $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
+                       $this->addWhereIf( 'ipb_expiry = ' .
+                               $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
+                       $this->addWhereIf( 'ipb_expiry != ' .
+                               $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
                        $this->addWhereIf( 'ipb_range_end = ipb_range_start', isset( $show['!range'] ) );
                        $this->addWhereIf( 'ipb_range_end > ipb_range_start', isset( $show['range'] ) );
                }
index e62305a..c5b12b3 100644 (file)
@@ -220,14 +220,16 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                return array(
                        'prop' => array(
                                'Which additional properties to get for each category',
-                               ' sortkey    - Adds the sortkey (hexadecimal string) and sortkey prefix (human-readable part) for the category',
+                               ' sortkey    - Adds the sortkey (hexadecimal string) and sortkey prefix',
+                               '              (human-readable part) for the category',
                                ' timestamp  - Adds timestamp of when the category was added',
                                ' hidden     - Tags categories that are hidden with __HIDDENCAT__',
                        ),
                        'limit' => 'How many categories to return',
                        'show' => 'Which kind of categories to show',
                        'continue' => 'When more results are available, use this to continue',
-                       'categories' => 'Only list these categories. Useful for checking whether a certain page is in a certain category',
+                       'categories' => 'Only list these categories. Useful for checking ' .
+                               'whether a certain page is in a certain category',
                        'dir' => 'The direction in which to list',
                );
        }
@@ -263,8 +265,10 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=categories&titles=Albert%20Einstein' => 'Get a list of categories [[Albert Einstein]] belongs to',
-                       'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info' => 'Get information about all categories used in the [[Albert Einstein]]',
+                       'api.php?action=query&prop=categories&titles=Albert%20Einstein'
+                               => 'Get a list of categories [[Albert Einstein]] belongs to',
+                       'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info'
+                               => 'Get information about all categories used in the [[Albert Einstein]]',
                );
        }
 
index 4e78f02..574ef6e 100644 (file)
@@ -63,7 +63,13 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                                'pp_propname' => 'hiddencat' ) ),
                ) );
 
-               $this->addFields( array( 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'cat_hidden' => 'pp_propname' ) );
+               $this->addFields( array(
+                       'cat_title',
+                       'cat_pages',
+                       'cat_subcats',
+                       'cat_files',
+                       'cat_hidden' => 'pp_propname'
+               ) );
                $this->addWhere( array( 'cat_title' => $cattitles ) );
 
                if ( !is_null( $params['continue'] ) ) {
index 9dc7a32..271558b 100644 (file)
@@ -181,8 +181,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $rows as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               // TODO: Security issue - if the user has no right to view next title, it will still be shown
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
+                               // @todo Security issue - if the user has no right to view next
+                               // title, it will still be shown
                                if ( $params['sort'] == 'timestamp' ) {
                                        $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) );
                                } else {
@@ -324,14 +326,16 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                global $wgMiserMode;
                $p = $this->getModulePrefix();
                $desc = array(
-                       'title' => "Which category to enumerate (required). Must include Category: prefix. Cannot be used together with {$p}pageid",
+                       'title' => "Which category to enumerate (required). Must include ' .
+                               'Category: prefix. Cannot be used together with {$p}pageid",
                        'pageid' => "Page ID of the category to enumerate. Cannot be used together with {$p}title",
                        'prop' => array(
                                'What pieces of information to include',
                                ' ids           - Adds the page ID',
                                ' title         - Adds the title and namespace ID of the page',
                                ' sortkey       - Adds the sortkey used for sorting in the category (hexadecimal string)',
-                               ' sortkeyprefix - Adds the sortkey prefix used for sorting in the category (human-readable part of the sortkey)',
+                               ' sortkeyprefix - Adds the sortkey prefix used for sorting in the ' .
+                                       'category (human-readable part of the sortkey)',
                                ' type          - Adds the type that the page has been categorised as (page, subcat or file)',
                                ' timestamp     - Adds the timestamp of when the page was included',
                        ),
@@ -341,10 +345,15 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                        'dir' => 'In which direction to sort',
                        'start' => "Timestamp to start listing from. Can only be used with {$p}sort=timestamp",
                        'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
-                       'startsortkey' => "Sortkey to start listing from. Must be given in binary format. Can only be used with {$p}sort=sortkey",
-                       'endsortkey' => "Sortkey to end listing at. Must be given in binary format. Can only be used with {$p}sort=sortkey",
-                       'startsortkeyprefix' => "Sortkey prefix to start listing from. Can only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
-                       'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, if this value occurs it will not be included!). Can only be used with {$p}sort=sortkey. Overrides {$p}endsortkey",
+                       'startsortkey' => "Sortkey to start listing from. Must be given in ' .
+                               'binary format. Can only be used with {$p}sort=sortkey",
+                       'endsortkey' => "Sortkey to end listing at. Must be given in binary ' .
+                               'format. Can only be used with {$p}sort=sortkey",
+                       'startsortkeyprefix' => "Sortkey prefix to start listing from. Can ' .
+                               'only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
+                       'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, ' .
+                               'if this value occurs it will not be included!). Can only be used with ' .
+                               '{$p}sort=sortkey. Overrides {$p}endsortkey",
                        'continue' => 'For large categories, give the value returned from previous query',
                        'limit' => 'The maximum number of pages to return.',
                );
@@ -406,8 +415,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&list=categorymembers&cmtitle=Category:Physics' => 'Get first 10 pages in [[Category:Physics]]',
-                       'api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info' => 'Get page info about first 10 pages in [[Category:Physics]]',
+                       'api.php?action=query&list=categorymembers&cmtitle=Category:Physics'
+                               => 'Get first 10 pages in [[Category:Physics]]',
+                       'api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info'
+                               => 'Get page info about first 10 pages in [[Category:Physics]]',
                );
        }
 
index 0eb1ec7..35e78ac 100644 (file)
@@ -39,7 +39,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                $user = $this->getUser();
                // Before doing anything at all, let's check permissions
                if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $this->dieUsage( 'You don\'t have permission to view deleted revision information', 'permissiondenied' );
+                       $this->dieUsage(
+                               'You don\'t have permission to view deleted revision information',
+                               'permissiondenied'
+                       );
                }
 
                $db = $this->getDB();
@@ -116,7 +119,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                        // This also means stricter restrictions
                        if ( !$user->isAllowed( 'undelete' ) ) {
-                               $this->dieUsage( 'You don\'t have permission to view deleted revision content', 'permissiondenied' );
+                               $this->dieUsage(
+                                       'You don\'t have permission to view deleted revision content',
+                                       'permissiondenied'
+                               );
                        }
                }
                // Check limits
@@ -152,7 +158,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        $this->addWhereRange( 'ar_title', $dir, $from, $to );
 
                        if ( isset( $params['prefix'] ) ) {
-                               $this->addWhere( 'ar_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                               $this->addWhere( 'ar_title' .
+                                       $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                        }
                }
 
@@ -179,7 +186,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                }
 
                $this->addOption( 'LIMIT', $limit + 1 );
-               $this->addOption( 'USE INDEX', array( 'archive' => ( $mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp' ) ) );
+               $this->addOption(
+                       'USE INDEX',
+                       array( 'archive' => ( $mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp' ) )
+               );
                if ( $mode == 'all' ) {
                        if ( $params['unique'] ) {
                                $this->addOption( 'GROUP BY', 'ar_title' );
@@ -391,7 +401,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        'Operates in three modes:',
                        ' 1) List deleted revisions for the given title(s), sorted by timestamp',
                        ' 2) List deleted contributions for the given user, sorted by timestamp (no titles specified)',
-                       " 3) List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, {$p}user not set)",
+                       " 3) List all deleted revisions in the given namespace, sorted by title and timestamp',
+                       '    (no titles specified, {$p}user not set)",
                        'Certain parameters only apply to some modes and are ignored in others.',
                        'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3',
                );
@@ -399,12 +410,22 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision information' ),
-                       array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision content' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted revision information'
+                       ),
+                       array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together'
+                       ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted revision content'
+                       ),
                        array( 'code' => 'badparams', 'info' => "The 'from' parameter cannot be used in modes 1 or 2" ),
                        array( 'code' => 'badparams', 'info' => "The 'to' parameter cannot be used in modes 1 or 2" ),
-                       array( 'code' => 'badparams', 'info' => "The 'prefix' parameter cannot be used in modes 1 or 2" ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "The 'prefix' parameter cannot be used in modes 1 or 2"
+                       ),
                        array( 'code' => 'badparams', 'info' => "The 'start' parameter cannot be used in mode 3" ),
                        array( 'code' => 'badparams', 'info' => "The 'end' parameter cannot be used in mode 3" ),
                ) );
@@ -412,7 +433,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&drprop=user|comment|content'
+                       'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&' .
+                               'drprop=user|comment|content'
                                => 'List the last deleted revisions of Main Page and Talk:Main Page, with content (mode 1)',
                        'api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50'
                                => 'List the last 50 deleted contributions by Bob (mode 2)',