Arlolra has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/339337 )
Change subject: Support "videoinfo" in batching ...................................................................... Support "videoinfo" in batching * Follow up to e23a8185 * Requires I3c651bea67b2ea29fb49edc471040bfa041473a8 * This also keeps it disabled until the necessary changes to the batching api are merged and deployed. Change-Id: Iec9b4d88aebab183277f5e1559173071fe9d5680 --- M lib/config/WikiConfig.js M lib/mw/ApiRequest.js M lib/mw/Batcher.js 3 files changed, 8 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/37/339337/1 diff --git a/lib/config/WikiConfig.js b/lib/config/WikiConfig.js index 0e12724..a08243e 100644 --- a/lib/config/WikiConfig.js +++ b/lib/config/WikiConfig.js @@ -822,7 +822,7 @@ this.useVideoInfo = Array.isArray(query.parameters) && query.parameters.some(function(o) { return o && o.name === 'prop' && o.type.indexOf('videoinfo') > -1; - }); + }) && !env.conf.parsoid.useBatchAPI; // Disabled for batching until deployed }.bind(this)); }; diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js index 646e479..51f1845 100644 --- a/lib/mw/ApiRequest.js +++ b/lib/mw/ApiRequest.js @@ -844,7 +844,8 @@ mangled = manglePreprocessorResponse(this.env, itemResponse); break; case 'imageinfo': - mangled = {batchResponse: itemResponse}; + case 'videoinfo': + mangled = { batchResponse: itemResponse }; break; default: error = new Error("BatchRequest._handleJSON: Invalid action"); diff --git a/lib/mw/Batcher.js b/lib/mw/Batcher.js index db3c53d..8cee7fe 100644 --- a/lib/mw/Batcher.js +++ b/lib/mw/Batcher.js @@ -269,17 +269,18 @@ */ Batcher.prototype.imageinfo = Promise.method(function(filename, dims) { var env = this.env; - var hash = Util.makeHash(["imageinfo", filename, dims.width || "", dims.height || "", env.page.name]); + var action = env.conf.wiki.useVideoInfo ? 'videoinfo' : 'imageinfo'; + var hash = Util.makeHash([action, filename, dims.width || "", dims.height || "", env.page.name]); if (hash in this.resultCache) { return this.resultCache[hash]; } else if (!env.conf.parsoid.useBatchAPI) { - this.trace("Non-batched imageinfo request"); + this.trace('Non-batched ' + action + ' request'); return this.legacyRequest(api.ImageInfoRequest, [ env, filename, dims, hash, ], hash); } else { var params = { - action: "imageinfo", + action: action, filename: filename, hash: hash, page: env.page.name, @@ -336,7 +337,7 @@ var apiItemParams; for (i = 0; i < batchParams.length; i++) { params = batchParams[i]; - if (params.action === 'imageinfo') { + if (params.action === 'imageinfo' || params.action === 'videoinfo') { apiItemParams = { action: params.action, filename: params.filename, -- To view, visit https://gerrit.wikimedia.org/r/339337 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iec9b4d88aebab183277f5e1559173071fe9d5680 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits