Merge "Add method parameter type documentation"
[lhc/web/wiklou.git] / includes / api / ApiQueryBacklinks.php
index 3ef6b84..2d1089a 100644 (file)
@@ -229,10 +229,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $orderBy = array();
                $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' );
                // Don't order by namespace/title if it's constant in the WHERE clause
-               if( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
+               if ( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
                        $orderBy[] = $this->bl_ns . $sort;
                }
-               if( count( array_unique( $allRedirDBkey ) ) != 1 ) {
+               if ( count( array_unique( $allRedirDBkey ) ) != 1 ) {
                        $orderBy[] = $this->bl_title . $sort;
                }
                $orderBy[] = $this->bl_from . $sort;
@@ -255,6 +255,9 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                if ( $this->params['limit'] == 'max' ) {
                        $this->params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
                        $result->setParsedLimit( $this->getModuleName(), $this->params['limit'] );
+               } else {
+                       $this->params['limit'] = intval( $this->params['limit'] );
+                       $this->validateLimit( 'limit', $this->params['limit'], 1, $userMax, $botMax );
                }
 
                $this->processContinue();
@@ -294,9 +297,9 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                                        // 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 } ];
+                                               $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}];
                                        } else {
-                                               $parentID = $this->pageMap[NS_FILE][$row-> { $this->bl_title } ];
+                                               $parentID = $this->pageMap[NS_FILE][$row->{$this->bl_title}];
                                        }
                                        $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id );
                                        break;
@@ -377,8 +380,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                if ( $row->page_is_redirect ) {
                        $a['redirect'] = '';
                }
-               $ns = $this->hasNS ? $row-> { $this->bl_ns } : NS_FILE;
-               $parentID = $this->pageMap[$ns][$row-> { $this->bl_title } ];
+               $ns = $this->hasNS ? $row->{$this->bl_ns} : NS_FILE;
+               $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 );