40 parent::__construct( $query, $moduleName,
'im' );
48 $this->run( $resultPageSet );
54 private function run( $resultPageSet =
null ) {
56 if ( $pages === [] ) {
67 $this->
addWhereFld(
'il_from', array_keys( $pages ) );
68 if ( $params[
'continue'] !==
null ) {
71 $op = $params[
'dir'] ==
'descending' ?
'<=' :
'>=';
72 $this->
addWhere( $db->buildComparison( $op, [
73 'il_from' => $cont[0],
78 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
80 if ( count( $pages ) === 1 ) {
81 $this->
addOption(
'ORDER BY',
'il_to' . $sort );
88 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
90 if ( $params[
'images'] ) {
92 foreach ( $params[
'images'] as $img ) {
93 $title = Title::newFromText( $img );
97 $images[] =
$title->getDBkey();
109 if ( $resultPageSet ===
null ) {
111 foreach (
$res as $row ) {
112 if ( ++$count > $params[
'limit'] ) {
129 foreach (
$res as $row ) {
130 if ( ++$count > $params[
'limit'] ) {
136 $titles[] = Title::makeTitle(
NS_FILE, $row->il_to );
138 $resultPageSet->populateFromTitles( $titles );
149 ParamValidator::PARAM_DEFAULT => 10,
150 ParamValidator::PARAM_TYPE =>
'limit',
151 IntegerDef::PARAM_MIN => 1,
159 ParamValidator::PARAM_ISMULTI =>
true,
162 ParamValidator::PARAM_DEFAULT =>
'ascending',
163 ParamValidator::PARAM_TYPE => [
172 $title = Title::newMainPage()->getPrefixedText();
173 $mp = rawurlencode(
$title );
176 "action=query&prop=images&titles={$mp}"
177 =>
'apihelp-query+images-example-simple',
178 "action=query&generator=images&titles={$mp}&prop=info"
179 =>
'apihelp-query+images-example-generator',
184 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,...
parseContinueParamOrDie(string $continue, array $types)
Parse the 'continue' parameter in the usual format and validate the types of each part,...
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.