diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /includes/api/ApiQueryCategories.php | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (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/ApiQueryCategories.php')
-rw-r--r-- | includes/api/ApiQueryCategories.php | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 1c1f1550..309c2ce9 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.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 @@ -89,12 +89,13 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $this->dieUsage( "Invalid continue param. You should pass the " . "original value returned by the previous query", "_badcontinue" ); } + $op = $params['dir'] == 'descending' ? '<' : '>'; $clfrom = intval( $cont[0] ); - $clto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) ); + $clto = $this->getDB()->addQuotes( $cont[1] ); $this->addWhere( - "cl_from > $clfrom OR " . + "cl_from $op $clfrom OR " . "(cl_from = $clfrom AND " . - "cl_to >= '$clto')" + "cl_to $op= $clto)" ); } @@ -123,14 +124,14 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $this->addOption( 'USE INDEX', array( 'categorylinks' => 'cl_from' ) ); - $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' ); + $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' ); // Don't order by cl_from if it's constant in the WHERE clause if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) { - $this->addOption( 'ORDER BY', 'cl_to' . $dir ); + $this->addOption( 'ORDER BY', 'cl_to' . $sort ); } else { $this->addOption( 'ORDER BY', array( - 'cl_from' . $dir, - 'cl_to' . $dir + 'cl_from' . $sort, + 'cl_to' . $sort )); } @@ -142,8 +143,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { 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->cl_from . - '|' . $this->keyToTitle( $row->cl_to ) ); + $this->setContinueEnumParameter( 'continue', $row->cl_from . '|' . $row->cl_to ); break; } @@ -163,8 +163,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $fit = $this->addPageSubItem( $row->cl_from, $vals ); if ( !$fit ) { - $this->setContinueEnumParameter( 'continue', $row->cl_from . - '|' . $this->keyToTitle( $row->cl_to ) ); + $this->setContinueEnumParameter( 'continue', $row->cl_from . '|' . $row->cl_to ); break; } } @@ -174,8 +173,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { 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->cl_from . - '|' . $this->keyToTitle( $row->cl_to ) ); + $this->setContinueEnumParameter( 'continue', $row->cl_from . '|' . $row->cl_to ); break; } @@ -239,6 +237,25 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { ); } + public function getResultProperties() { + return array( + '' => array( + 'ns' => 'namespace', + 'title' => 'string' + ), + 'sortkey' => array( + 'sortkey' => 'string', + 'sortkeyprefix' => 'string' + ), + 'timestamp' => array( + 'timestamp' => 'timestamp' + ), + 'hidden' => array( + 'hidden' => 'boolean' + ) + ); + } + public function getDescription() { return 'List all categories the page(s) belong to'; } |