39 parent::__construct( $query, $moduleName,
'im' );
47 $this->run( $resultPageSet );
53 private function run( $resultPageSet =
null ) {
55 if ( $pages === [] ) {
66 $this->
addWhereFld(
'il_from', array_keys( $pages ) );
67 if ( $params[
'continue'] !==
null ) {
68 $cont = explode(
'|', $params[
'continue'] );
70 $op = $params[
'dir'] ==
'descending' ?
'<' :
'>';
71 $ilfrom = (int)$cont[0];
72 $ilto = $this->
getDB()->addQuotes( $cont[1] );
74 "il_from $op $ilfrom OR " .
75 "(il_from = $ilfrom AND " .
80 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
82 if ( count( $pages ) === 1 ) {
83 $this->
addOption(
'ORDER BY',
'il_to' . $sort );
90 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
92 if ( $params[
'images'] ) {
94 foreach ( $params[
'images'] as $img ) {
99 $images[] =
$title->getDBkey();
111 if ( $resultPageSet ===
null ) {
113 foreach (
$res as $row ) {
114 if ( ++$count > $params[
'limit'] ) {
131 foreach (
$res as $row ) {
132 if ( ++$count > $params[
'limit'] ) {
140 $resultPageSet->populateFromTitles( $titles );
151 ParamValidator::PARAM_DEFAULT => 10,
152 ParamValidator::PARAM_TYPE =>
'limit',
153 IntegerDef::PARAM_MIN => 1,
161 ParamValidator::PARAM_ISMULTI =>
true,
164 ParamValidator::PARAM_DEFAULT =>
'ascending',
165 ParamValidator::PARAM_TYPE => [
174 $title = Title::newMainPage()->getPrefixedText();
175 $mp = rawurlencode(
$title );
178 "action=query&prop=images&titles={$mp}"
179 =>
'apihelp-query+images-example-simple',
180 "action=query&generator=images&titles={$mp}&prop=info"
181 =>
'apihelp-query+images-example-generator',
186 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Images';
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
const LIMIT_BIG1
Fast query, standard limit.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
const LIMIT_BIG2
Fast query, apihighlimits limit.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
addFields( $value)
Add a set of fields to select to the internal array.
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
getDB()
Get the Query database connection (read-only)
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
addWhereFld( $field, $value)
Equivalent to addWhere( [ $field => $value ] )
addWhere( $value)
Add a set of WHERE clauses to the internal array.
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
getPageSet()
Get the PageSet object to work on.
This query adds an "<images>" subelement to all pages with the list of images embedded into those pag...
executeGenerator( $resultPageSet)
Execute this module as a generator.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
__construct(ApiQuery $query, $moduleName)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getExamplesMessages()
Returns usage examples for this module.
getHelpUrls()
Return links to more detailed help pages about the module.
This is the main query class.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.