32 parent::__construct( $query, $moduleName,
'im' );
40 $this->
run( $resultPageSet );
46 private function run( $resultPageSet =
null ) {
47 if ( $this->
getPageSet()->getGoodTitleCount() == 0 ) {
59 if ( $params[
'continue'] !==
null ) {
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 ) {
75 $this->
addOption(
'ORDER BY',
'il_to' . $sort );
82 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
84 if ( $params[
'images'] ) {
86 foreach ( $params[
'images'] as $img ) {
87 $title = Title::newFromText( $img );
91 $images[] =
$title->getDBkey();
103 if ( $resultPageSet ===
null ) {
105 foreach (
$res as $row ) {
106 if ( ++$count > $params[
'limit'] ) {
123 foreach (
$res as $row ) {
124 if ( ++$count > $params[
'limit'] ) {
130 $titles[] = Title::makeTitle(
NS_FILE, $row->il_to );
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';
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) Stable to override.
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.
run( $resultPageSet=null)
This is the main query class.