X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryIWBacklinks.php;h=ec5453c2efd7636375ace7468080af79254a0205;hb=79ebb4b0288b709fb53cff8f7ebc5f50221931c9;hp=ebae3e768ca88a19ab84ddf15a53731d8a3d1665;hpb=8734fe02b84c0fdd6fa53454b23ce9239b50dc75;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index ebae3e768c..ec5453c2ef 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -44,7 +44,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { } /** - * @param $resultPageSet ApiPageSet + * @param ApiPageSet $resultPageSet * @return void */ public function run( $resultPageSet = null ) { @@ -92,14 +92,14 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { $this->addOption( 'ORDER BY', array( 'iwl_title' . $sort, 'iwl_from' . $sort - )); + ) ); } } else { $this->addOption( 'ORDER BY', array( 'iwl_prefix' . $sort, 'iwl_title' . $sort, 'iwl_from' . $sort - )); + ) ); } $this->addOption( 'LIMIT', $params['limit'] + 1 ); @@ -111,10 +111,15 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { $count = 0; $result = $this->getResult(); foreach ( $res as $row ) { - if ( ++ $count > $params['limit'] ) { - // 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->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" ); + if ( ++$count > $params['limit'] ) { + // 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->setContinueEnumParameter( + 'continue', + "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" + ); break; } @@ -140,7 +145,10 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry ); if ( !$fit ) { - $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" ); + $this->setContinueEnumParameter( + 'continue', + "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" + ); break; } } @@ -223,7 +231,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { return array( 'Find all pages that link to the given interwiki link.', 'Can be used to find all links with a prefix, or', 'all links to a title (with a given prefix).', - 'Using neither parameter is effectively "All IW Links"', + 'Using neither parameter is effectively "All IW Links".', ); }