38 parent::__construct( $query, $moduleName,
'im' );
46 $this->
run( $resultPageSet );
52 private function run( $resultPageSet =
null ) {
54 if ( $pages === [] ) {
65 $this->
addWhereFld(
'il_from', array_keys( $pages ) );
66 if (
$params[
'continue'] !==
null ) {
69 $op =
$params[
'dir'] ==
'descending' ?
'<=' :
'>=';
70 $this->
addWhere( $db->buildComparison( $op, [
71 'il_from' => $cont[0],
76 $sort = (
$params[
'dir'] ==
'descending' ?
' DESC' :
'' );
78 if ( count( $pages ) === 1 ) {
79 $this->
addOption(
'ORDER BY',
'il_to' . $sort );
90 foreach (
$params[
'images'] as $img ) {
91 $title = Title::newFromText( $img );
92 if ( !$title || $title->getNamespace() !==
NS_FILE ) {
95 $images[] = $title->getDBkey();
105 $res = $this->
select( __METHOD__ );
107 if ( $resultPageSet ===
null ) {
109 foreach ( $res as $row ) {
110 if ( ++$count >
$params[
'limit'] ) {
127 foreach ( $res as $row ) {
128 if ( ++$count >
$params[
'limit'] ) {
134 $titles[] = Title::makeTitle(
NS_FILE, $row->il_to );
136 $resultPageSet->populateFromTitles( $titles );
147 ParamValidator::PARAM_DEFAULT => 10,
148 ParamValidator::PARAM_TYPE =>
'limit',
149 IntegerDef::PARAM_MIN => 1,
157 ParamValidator::PARAM_ISMULTI =>
true,
160 ParamValidator::PARAM_DEFAULT =>
'ascending',
161 ParamValidator::PARAM_TYPE => [
170 $title = Title::newMainPage()->getPrefixedText();
171 $mp = rawurlencode( $title );
174 "action=query&prop=images&titles={$mp}"
175 =>
'apihelp-query+images-example-simple',
176 "action=query&generator=images&titles={$mp}&prop=info"
177 =>
'apihelp-query+images-example-generator',
182 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Images';
187class_alias( ApiQueryImages::class,
'ApiQueryImages' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
array $params
The job parameters.