Go to the documentation of this file.
36 parent::__construct( $query, $moduleName,
'im' );
44 $this->
run( $resultPageSet );
50 private function run( $resultPageSet =
null ) {
51 if ( $this->
getPageSet()->getGoodTitleCount() == 0 ) {
63 if ( $params[
'continue'] !==
null ) {
64 $cont = explode(
'|', $params[
'continue'] );
66 $op = $params[
'dir'] ==
'descending' ?
'<' :
'>';
67 $ilfrom = (int)$cont[0];
68 $ilto = $this->
getDB()->addQuotes( $cont[1] );
70 "il_from $op $ilfrom OR " .
71 "(il_from = $ilfrom AND " .
76 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
78 if ( count( $this->
getPageSet()->getGoodTitles() ) == 1 ) {
79 $this->
addOption(
'ORDER BY',
'il_to' . $sort );
86 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
88 if ( $params[
'images'] ) {
90 foreach ( $params[
'images'] as $img ) {
95 $images[] =
$title->getDBkey();
107 if ( $resultPageSet ===
null ) {
109 foreach (
$res as $row ) {
110 if ( ++$count > $params[
'limit'] ) {
127 foreach (
$res as $row ) {
128 if ( ++$count > $params[
'limit'] ) {
136 $resultPageSet->populateFromTitles( $titles );
171 'action=query&prop=images&titles=Main%20Page'
172 =>
'apihelp-query+images-example-simple',
173 'action=query&generator=images&titles=Main%20Page&prop=info'
174 =>
'apihelp-query+images-example-generator',
179 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Images';
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
addFields( $value)
Add a set of fields to select to the internal array.
This is the main query class.
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
This query adds an "<images>" subelement to all pages with the list of images embedded into those pag...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
executeGenerator( $resultPageSet)
Execute this module as a generator.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
getPageSet()
Get the PageSet object to work on.
const LIMIT_BIG1
Fast query, standard limit.
getDB()
Get the Query database connection (read-only) Stable to override.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
getExamplesMessages()
Returns usage examples for this module.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
__construct(ApiQuery $query, $moduleName)
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
run( $resultPageSet=null)
getCacheMode( $params)
Get the cache mode for the data generated by this module.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
addWhereFld( $field, $value)
Equivalent to addWhere( [ $field => $value ] )
const LIMIT_BIG2
Fast query, apihighlimits limit.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
addWhere( $value)
Add a set of WHERE clauses to the internal array.
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
getHelpUrls()
Return links to more detailed help pages about the module.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.