From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: 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 --- includes/api/ApiQueryImages.php | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'includes/api/ApiQueryImages.php') diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index f03b2874..6052a75f 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -4,7 +4,7 @@ * * Created on May 13, 2007 * - * Copyright © 2006 Yuri Astrakhan @gmail.com + * Copyright © 2006 Yuri Astrakhan "@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 @@ -25,7 +25,8 @@ */ /** - * This query adds an subelement to all pages with the list of images embedded into those pages. + * This query adds an "" subelement to all pages with the list of + * images embedded into those pages. * * @ingroup API */ @@ -65,23 +66,24 @@ class ApiQueryImages extends ApiQueryGeneratorBase { $this->dieUsage( 'Invalid continue param. You should pass the ' . 'original value returned by the previous query', '_badcontinue' ); } + $op = $params['dir'] == 'descending' ? '<' : '>'; $ilfrom = intval( $cont[0] ); - $ilto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) ); + $ilto = $this->getDB()->addQuotes( $cont[1] ); $this->addWhere( - "il_from > $ilfrom OR " . + "il_from $op $ilfrom OR " . "(il_from = $ilfrom AND " . - "il_to >= '$ilto')" + "il_to $op= $ilto)" ); } - $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' ); + $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' ); // Don't order by il_from if it's constant in the WHERE clause if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) { - $this->addOption( 'ORDER BY', 'il_to' . $dir ); + $this->addOption( 'ORDER BY', 'il_to' . $sort ); } else { $this->addOption( 'ORDER BY', array( - 'il_from' . $dir, - 'il_to' . $dir + 'il_from' . $sort, + 'il_to' . $sort )); } $this->addOption( 'LIMIT', $params['limit'] + 1 ); @@ -107,16 +109,14 @@ class ApiQueryImages 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->il_from . - '|' . $this->keyToTitle( $row->il_to ) ); + $this->setContinueEnumParameter( 'continue', $row->il_from . '|' . $row->il_to ); break; } $vals = array(); ApiQueryBase::addTitleInfo( $vals, Title::makeTitle( NS_FILE, $row->il_to ) ); $fit = $this->addPageSubItem( $row->il_from, $vals ); if ( !$fit ) { - $this->setContinueEnumParameter( 'continue', $row->il_from . - '|' . $this->keyToTitle( $row->il_to ) ); + $this->setContinueEnumParameter( 'continue', $row->il_from . '|' . $row->il_to ); break; } } @@ -127,8 +127,7 @@ class ApiQueryImages 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->il_from . - '|' . $this->keyToTitle( $row->il_to ) ); + $this->setContinueEnumParameter( 'continue', $row->il_from . '|' . $row->il_to ); break; } $titles[] = Title::makeTitle( NS_FILE, $row->il_to ); @@ -173,6 +172,15 @@ class ApiQueryImages extends ApiQueryGeneratorBase { ); } + public function getResultProperties() { + return array( + '' => array( + 'ns' => 'namespace', + 'title' => 'string' + ) + ); + } + public function getDescription() { return 'Returns all images contained on the given page(s)'; } -- cgit v1.2.3-54-g00ecf