aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryLangLinks.php
diff options
context:
space:
mode:
authorAryeh Gregor <simetrical@users.mediawiki.org>2010-01-11 15:55:52 +0000
committerAryeh Gregor <simetrical@users.mediawiki.org>2010-01-11 15:55:52 +0000
commit3758769f0d2b244b113714da012dc1ceb95d0e22 (patch)
tree55c16bb1c633605d00421ae813fe31b82e667234 /includes/api/ApiQueryLangLinks.php
parentfe3397990f8ef05c89f530b0e45a5d6711250bc6 (diff)
downloadmediawikicore-3758769f0d2b244b113714da012dc1ceb95d0e22.tar.gz
mediawikicore-3758769f0d2b244b113714da012dc1ceb95d0e22.zip
stylize.php on API code
"I wouldn't object to stylizing the API code to bring it in line with the rest of MW on principle, but I'm not gonna bother myself." --Roan <http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60657#c5108> If you're seeing this commit in blames, tell your blame tool to ignore whitespace, e.g., git blame -w or svn blame -x -w.
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/60930
Diffstat (limited to 'includes/api/ApiQueryLangLinks.php')
-rw-r--r--includes/api/ApiQueryLangLinks.php64
1 files changed, 32 insertions, 32 deletions
diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php
index 7aa9783490b0..0e7c8b52b513 100644
--- a/includes/api/ApiQueryLangLinks.php
+++ b/includes/api/ApiQueryLangLinks.php
@@ -23,9 +23,9 @@
* http://www.gnu.org/copyleft/gpl.html
*/
-if (!defined('MEDIAWIKI')) {
+if ( !defined( 'MEDIAWIKI' ) ) {
// Eclipse helper - will be ignored in production
- require_once ("ApiQueryBase.php");
+ require_once ( "ApiQueryBase.php" );
}
/**
@@ -35,8 +35,8 @@ if (!defined('MEDIAWIKI')) {
*/
class ApiQueryLangLinks extends ApiQueryBase {
- public function __construct($query, $moduleName) {
- parent :: __construct($query, $moduleName, 'll');
+ public function __construct( $query, $moduleName ) {
+ parent :: __construct( $query, $moduleName, 'll' );
}
public function execute() {
@@ -44,52 +44,52 @@ class ApiQueryLangLinks extends ApiQueryBase {
return;
$params = $this->extractRequestParams();
- $this->addFields(array (
+ $this->addFields( array (
'll_from',
'll_lang',
'll_title'
- ));
+ ) );
- $this->addTables('langlinks');
- $this->addWhereFld('ll_from', array_keys($this->getPageSet()->getGoodTitles()));
- if(!is_null($params['continue'])) {
- $cont = explode('|', $params['continue']);
- if(count($cont) != 2)
- $this->dieUsage("Invalid continue param. You should pass the " .
- "original value returned by the previous query", "_badcontinue");
- $llfrom = intval($cont[0]);
- $lllang = $this->getDB()->strencode($cont[1]);
- $this->addWhere("ll_from > $llfrom OR ".
- "(ll_from = $llfrom AND ".
- "ll_lang >= '$lllang')");
+ $this->addTables( 'langlinks' );
+ $this->addWhereFld( 'll_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
+ if ( !is_null( $params['continue'] ) ) {
+ $cont = explode( '|', $params['continue'] );
+ if ( count( $cont ) != 2 )
+ $this->dieUsage( "Invalid continue param. You should pass the " .
+ "original value returned by the previous query", "_badcontinue" );
+ $llfrom = intval( $cont[0] );
+ $lllang = $this->getDB()->strencode( $cont[1] );
+ $this->addWhere( "ll_from > $llfrom OR " .
+ "(ll_from = $llfrom AND " .
+ "ll_lang >= '$lllang')" );
}
# 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');
+ if ( count( $this->getPageSet()->getGoodTitles() ) == 1 )
+ $this->addOption( 'ORDER BY', 'll_lang' );
else
- $this->addOption('ORDER BY', 'll_from, ll_lang');
- $this->addOption('LIMIT', $params['limit'] + 1);
- $res = $this->select(__METHOD__);
+ $this->addOption( 'ORDER BY', 'll_from, ll_lang' );
+ $this->addOption( 'LIMIT', $params['limit'] + 1 );
+ $res = $this->select( __METHOD__ );
$count = 0;
$db = $this->getDB();
- while ($row = $db->fetchObject($res)) {
- if (++$count > $params['limit']) {
+ while ( $row = $db->fetchObject( $res ) ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that
// there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter('continue', "{$row->ll_from}|{$row->ll_lang}");
+ $this->setContinueEnumParameter( 'continue', "{$row->ll_from}|{$row->ll_lang}" );
break;
}
- $entry = array('lang' => $row->ll_lang);
- ApiResult :: setContent($entry, $row->ll_title);
- $fit = $this->addPageSubItem($row->ll_from, $entry);
- if(!$fit)
+ $entry = array( 'lang' => $row->ll_lang );
+ ApiResult :: setContent( $entry, $row->ll_title );
+ $fit = $this->addPageSubItem( $row->ll_from, $entry );
+ if ( !$fit )
{
- $this->setContinueEnumParameter('continue', "{$row->ll_from}|{$row->ll_lang}");
+ $this->setContinueEnumParameter( 'continue', "{$row->ll_from}|{$row->ll_lang}" );
break;
}
}
- $db->freeResult($res);
+ $db->freeResult( $res );
}
public function getAllowedParams() {