Warn if stateful ParserOutput transforms are used
[lhc/web/wiklou.git] / includes / api / ApiQueryImages.php
index e04d8c8..01a54de 100644 (file)
@@ -85,16 +85,20 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                }
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
 
-               if ( !is_null( $params['images'] ) ) {
+               if ( $params['images'] ) {
                        $images = [];
                        foreach ( $params['images'] as $img ) {
                                $title = Title::newFromText( $img );
                                if ( !$title || $title->getNamespace() != NS_FILE ) {
-                                       $this->setWarning( "\"$img\" is not a file" );
+                                       $this->addWarning( [ 'apiwarn-notfile', wfEscapeWikiText( $img ) ] );
                                } else {
                                        $images[] = $title->getDBkey();
                                }
                        }
+                       if ( !$images ) {
+                               // No titles so no results
+                               return;
+                       }
                        $this->addWhereFld( 'il_to', $images );
                }
 
@@ -172,6 +176,6 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
        }
 
        public function getHelpUrls() {
-               return 'https://www.mediawiki.org/wiki/API:Images';
+               return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Images';
        }
 }