summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryLangLinks.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /includes/api/ApiQueryLangLinks.php
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'includes/api/ApiQueryLangLinks.php')
-rw-r--r--includes/api/ApiQueryLangLinks.php38
1 files changed, 26 insertions, 12 deletions
diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php
index fdba8465..3109a090 100644
--- a/includes/api/ApiQueryLangLinks.php
+++ b/includes/api/ApiQueryLangLinks.php
@@ -4,7 +4,7 @@
*
* Created on May 13, 2007
*
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,35 +60,36 @@ class ApiQueryLangLinks extends ApiQueryBase {
$this->dieUsage( 'Invalid continue param. You should pass the ' .
'original value returned by the previous query', '_badcontinue' );
}
+ $op = $params['dir'] == 'descending' ? '<' : '>';
$llfrom = intval( $cont[0] );
- $lllang = $this->getDB()->strencode( $cont[1] );
+ $lllang = $this->getDB()->addQuotes( $cont[1] );
$this->addWhere(
- "ll_from > $llfrom OR " .
+ "ll_from $op $llfrom OR " .
"(ll_from = $llfrom AND " .
- "ll_lang >= '$lllang')"
+ "ll_lang $op= $lllang)"
);
}
- $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
- if ( isset( $params['lang'] ) ) {
+ $sort = ( $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' . $dir );
+ $this->addOption( 'ORDER BY', 'll_from' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'll_title' . $dir,
- 'll_from' . $dir
+ 'll_title' . $sort,
+ 'll_from' . $sort
));
}
} 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' . $dir );
+ $this->addOption( 'ORDER BY', 'll_lang' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'll_from' . $dir,
- 'll_lang' . $dir
+ 'll_from' . $sort,
+ 'll_lang' . $sort
));
}
}
@@ -158,6 +159,19 @@ class ApiQueryLangLinks extends ApiQueryBase {
);
}
+ public function getResultProperties() {
+ return array(
+ '' => array(
+ 'lang' => 'string',
+ 'url' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ '*' => 'string'
+ )
+ );
+ }
+
public function getDescription() {
return 'Returns all interlanguage links from the given page(s)';
}