Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316249

Change subject: API: Expose wfIsBadImage() in prop=imageinfo
......................................................................

API: Expose wfIsBadImage() in prop=imageinfo

If iiprop=badfile is set, expose the wfIsBadImage() status as a boolean.
This is mainly intended for use by Parsoid, but could be useful for
other API users too.

Bug: T148343
Change-Id: I3432ead92b8d2a17de5243285f2760fc39b501ae
---
M includes/api/ApiQueryImageInfo.php
M includes/api/i18n/en.json
M includes/api/i18n/qqq.json
3 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/49/316249/1

diff --git a/includes/api/ApiQueryImageInfo.php 
b/includes/api/ApiQueryImageInfo.php
index d1fcfa3..ef7c1ad 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -128,9 +128,14 @@
                                        break;
                                }
 
+                               $info = [ 'imagerepository' => 
$img->getRepoName() ];
+                               if ( isset( $prop['badfile'] ) ) {
+                                       $info['badfile'] = wfIsBadImage( 
$img->getTitle() );
+                               }
+
                                $fit = $result->addValue(
-                                       [ 'query', 'pages', intval( $pageId ) ],
-                                       'imagerepository', $img->getRepoName()
+                                       [ 'query', 'pages' ],
+                                       intval( $pageId ), $info
                                );
                                if ( !$fit ) {
                                        if ( count( $pageIds[NS_FILE] ) == 1 ) {
@@ -734,6 +739,7 @@
                                'archivename' => 
'apihelp-query+imageinfo-paramvalue-prop-archivename',
                                'bitdepth' => 
'apihelp-query+imageinfo-paramvalue-prop-bitdepth',
                                'uploadwarning' => 
'apihelp-query+imageinfo-paramvalue-prop-uploadwarning',
+                               'badfile' => 
'apihelp-query+imageinfo-paramvalue-prop-badfile',
                        ],
                        array_flip( $filter )
                );
diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json
index c20ed5d..086c250 100644
--- a/includes/api/i18n/en.json
+++ b/includes/api/i18n/en.json
@@ -803,6 +803,7 @@
        "apihelp-query+imageinfo-paramvalue-prop-archivename": "Adds the 
filename of the archive version for non-latest versions.",
        "apihelp-query+imageinfo-paramvalue-prop-bitdepth": "Adds the bit depth 
of the version.",
        "apihelp-query+imageinfo-paramvalue-prop-uploadwarning": "Used by the 
Special:Upload page to get information about an existing file. Not intended for 
use outside MediaWiki core.",
+       "apihelp-query+imageinfo-paramvalue-prop-badfile": "Adds whether the 
file is on the [[MediaWiki:Bad image list]]",
        "apihelp-query+imageinfo-param-limit": "How many file revisions to 
return per file.",
        "apihelp-query+imageinfo-param-start": "Timestamp to start listing 
from.",
        "apihelp-query+imageinfo-param-end": "Timestamp to stop listing at.",
diff --git a/includes/api/i18n/qqq.json b/includes/api/i18n/qqq.json
index 8deda75..1f5f187 100644
--- a/includes/api/i18n/qqq.json
+++ b/includes/api/i18n/qqq.json
@@ -750,6 +750,7 @@
        "apihelp-query+imageinfo-paramvalue-prop-archivename": 
"{{doc-apihelp-paramvalue|query+imageinfo|prop|archivename}}",
        "apihelp-query+imageinfo-paramvalue-prop-bitdepth": 
"{{doc-apihelp-paramvalue|query+imageinfo|prop|bitdepth}}",
        "apihelp-query+imageinfo-paramvalue-prop-uploadwarning": 
"{{doc-apihelp-paramvalue|query+imageinfo|prop|uploadwarning}}",
+       "apihelp-query+imageinfo-paramvalue-prop-badfile": 
"{{doc-apihelp-paramvalue|query+imageinfo|prop|badfile}}",
        "apihelp-query+imageinfo-param-limit": 
"{{doc-apihelp-param|query+imageinfo|limit}}",
        "apihelp-query+imageinfo-param-start": 
"{{doc-apihelp-param|query+imageinfo|start}}",
        "apihelp-query+imageinfo-param-end": 
"{{doc-apihelp-param|query+imageinfo|end}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/316249
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3432ead92b8d2a17de5243285f2760fc39b501ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to