Merge "REST API initial commit"
[lhc/web/wiklou.git] / includes / api / ApiQueryImageInfo.php
index 333b769..e123a2a 100644 (file)
@@ -110,7 +110,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                if ( !isset( $images[$title] ) ) {
                                        if ( isset( $prop['uploadwarning'] ) || isset( $prop['badfile'] ) ) {
                                                // uploadwarning and badfile need info about non-existing files
-                                               $images[$title] = wfLocalFile( $title );
+                                               $images[$title] = MediaWikiServices::getInstance()->getRepoGroup()
+                                                       ->getLocalRepo()->newFile( $title );
                                                // Doesn't exist, so set an empty image repository
                                                $info['imagerepository'] = '';
                                        } else {
@@ -249,13 +250,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        // Don't set $scale['width']; this signals mergeThumbParams() to fill it with the image's width
                        $scale = [];
                        $scale['height'] = $params['urlheight'];
+               } elseif ( $params['urlparam'] ) {
+                       // Audio files might not have a width/height.
+                       $scale = [];
                } else {
-                       if ( $params['urlparam'] ) {
-                               // Audio files might not have a width/height.
-                               $scale = [];
-                       } else {
-                               $scale = null;
-                       }
+                       $scale = null;
                }
 
                return $scale;