30 parent::__construct( $query, $moduleName,
'im' );
39 $this->run( $resultPageSet );
45 private function run( $resultPageSet =
null ) {
47 if ( $pages === [] ) {
52 $queryInfo = $this->linksMigration->getQueryInfo(
'imagelinks' );
55 $this->
addFields( [
'il_from',
'lt_title' ] );
58 $this->
addWhereFld(
'il_from', array_keys( $pages ) );
59 if ( $params[
'continue'] !==
null ) {
61 $op = $params[
'dir'] ==
'descending' ?
'<=' :
'>=';
63 'il_from' => $cont[0],
65 'lt_title' => $cont[1],
67 $this->
addWhere( $this->
getDB()->buildComparison( $op, $comparison ) );
70 $sort = ( $params[
'dir'] ==
'descending' ?
' DESC' :
'' );
72 if ( count( $pages ) === 1 ) {
73 $this->
addOption(
'ORDER BY',
'lt_title' . $sort );
80 $this->
addOption(
'LIMIT', $params[
'limit'] + 1 );
82 if ( $params[
'images'] ) {
84 foreach ( $params[
'images'] as $img ) {
85 $title = Title::newFromText( $img );
86 if ( !$title || $title->getNamespace() !==
NS_FILE ) {
89 $images[] = $title->getDBkey();
101 $res = $this->
select( __METHOD__ );
104 if ( $resultPageSet ===
null ) {
106 foreach ( $res as $row ) {
107 if ( ++$count > $params[
'limit'] ) {
124 foreach ( $res as $row ) {
125 if ( ++$count > $params[
'limit'] ) {
133 $resultPageSet->populateFromTitles( $titles );
146 ParamValidator::PARAM_DEFAULT => 10,
147 ParamValidator::PARAM_TYPE =>
'limit',
148 IntegerDef::PARAM_MIN => 1,
156 ParamValidator::PARAM_ISMULTI =>
true,
159 ParamValidator::PARAM_DEFAULT =>
'ascending',
160 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',
183 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Images';
188class_alias( ApiQueryImages::class,
'ApiQueryImages' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...