summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryLangLinks.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/api/ApiQueryLangLinks.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/api/ApiQueryLangLinks.php')
-rw-r--r--includes/api/ApiQueryLangLinks.php33
1 files changed, 21 insertions, 12 deletions
diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php
index 942655f4..fdba8465 100644
--- a/includes/api/ApiQueryLangLinks.php
+++ b/includes/api/ApiQueryLangLinks.php
@@ -24,11 +24,6 @@
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( "ApiQueryBase.php" );
-}
-
/**
* A query module to list all langlinks (links to correspanding foreign language pages).
*
@@ -74,20 +69,27 @@ class ApiQueryLangLinks extends ApiQueryBase {
);
}
+ $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
if ( isset( $params['lang'] ) ) {
$this->addWhereFld( 'll_lang', $params['lang'] );
if ( isset( $params['title'] ) ) {
$this->addWhereFld( 'll_title', $params['title'] );
- $this->addOption( 'ORDER BY', 'll_from' );
+ $this->addOption( 'ORDER BY', 'll_from' . $dir );
} else {
- $this->addOption( 'ORDER BY', 'll_title, ll_from' );
+ $this->addOption( 'ORDER BY', array(
+ 'll_title' . $dir,
+ 'll_from' . $dir
+ ));
}
} else {
// 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' );
+ $this->addOption( 'ORDER BY', 'll_lang' . $dir );
} else {
- $this->addOption( 'ORDER BY', 'll_from, ll_lang' );
+ $this->addOption( 'ORDER BY', array(
+ 'll_from' . $dir,
+ 'll_lang' . $dir
+ ));
}
}
@@ -135,6 +137,13 @@ class ApiQueryLangLinks extends ApiQueryBase {
'url' => false,
'lang' => null,
'title' => null,
+ 'dir' => array(
+ ApiBase::PARAM_DFLT => 'ascending',
+ ApiBase::PARAM_TYPE => array(
+ 'ascending',
+ 'descending'
+ )
+ ),
);
}
@@ -145,6 +154,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
'url' => 'Whether to get the full URL',
'lang' => 'Language code',
'title' => "Link to search for. Must be used with {$this->getModulePrefix()}lang",
+ 'dir' => 'The direction in which to list',
);
}
@@ -159,10 +169,9 @@ class ApiQueryLangLinks extends ApiQueryBase {
) );
}
- protected function getExamples() {
+ public function getExamples() {
return array(
- 'Get interlanguage links from the [[Main Page]]:',
- ' api.php?action=query&prop=langlinks&titles=Main%20Page&redirects=',
+ 'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects=' => 'Get interlanguage links from the [[Main Page]]',
);
}