diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /includes/api/ApiQueryIWBacklinks.php | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/api/ApiQueryIWBacklinks.php')
-rw-r--r-- | includes/api/ApiQueryIWBacklinks.php | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index ebae3e76..b5aa45bf 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -31,7 +31,7 @@ */ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'iwbl' ); } @@ -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; } } @@ -202,37 +210,14 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { ); } - public function getResultProperties() { - return array( - '' => array( - 'pageid' => 'integer', - 'ns' => 'namespace', - 'title' => 'string', - 'redirect' => 'boolean' - ), - 'iwprefix' => array( - 'iwprefix' => 'string' - ), - 'iwtitle' => array( - 'iwtitle' => 'string' - ) - ); - } - public function getDescription() { 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".', ); } - public function getPossibleErrors() { - return array_merge( parent::getPossibleErrors(), array( - array( 'missingparam', 'prefix' ), - ) ); - } - public function getExamples() { return array( 'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks', |