Go to the documentation of this file.
32 parent::__construct( $query, $moduleName,
'im' );
40 $this->
run( $resultPageSet );
46 private function run( $resultPageSet =
null ) {
47 if ( $this->
getPageSet()->getGoodTitleCount() == 0 ) {
59 if ( !is_null( $params[
'continue'] ) ) {
60 $cont = explode(
'|', $params[
'continue'] );
62 $op = $params[
'dir'] ==
'descending' ?
'<' :
'>';
63 $ilfrom = (int)$cont[0];
64 $ilto = $this->
getDB()->addQuotes( $cont[1] );
66 "il_from $op $ilfrom OR " .
67 "(il_from = $ilfrom AND " .
72 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
74 if ( count( $this->
getPageSet()->getGoodTitles() ) == 1 ) {
82 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
84 if ( $params[
'images'] ) {
86 foreach ( $params[
'images'] as $img ) {
91 $images[] =
$title->getDBkey();
103 if ( is_null( $resultPageSet ) ) {
105 foreach (
$res as $row ) {
106 if ( ++$count > $params[
'limit'] ) {
123 foreach (
$res as $row ) {
124 if ( ++$count > $params[
'limit'] ) {
132 $resultPageSet->populateFromTitles( $titles );
167 'action=query&prop=images&titles=Main%20Page'
168 =>
'apihelp-query+images-example-simple',
169 'action=query&generator=images&titles=Main%20Page&prop=info'
170 =>
'apihelp-query+images-example-generator',
175 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.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
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.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
getPageSet()
Get the PageSet object to work on.
const LIMIT_BIG1
Fast query, standard limit.
getDB()
Get the Query database connection (read-only)
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
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.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
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.