mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-16 20:35:09 +00:00
Cache imageinfo query in MultimediaViewer
Bug: T117750 Change-Id: I5560e14b13968113e768bacce9972169f270e7bc
This commit is contained in:
parent
db3685e956
commit
6005b068bf
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
function MultimediaViewer( mwConfig ) {
|
function MultimediaViewer( mwConfig ) {
|
||||||
var apiCacheMaxAge = 86400; // one day (24 hours * 60 min * 60 sec)
|
var apiCacheMaxAge = 86400; // one day (24 hours * 60 min * 60 sec)
|
||||||
|
var apiCacheFiveMinutes = 300; // 5 min * 60 sec
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {mw.Map}
|
* @property {mw.Map}
|
||||||
|
@ -45,10 +46,10 @@
|
||||||
* @property {mw.mmv.provider.ImageInfo}
|
* @property {mw.mmv.provider.ImageInfo}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.imageInfoProvider = new mw.mmv.provider.ImageInfo( new mw.mmv.logging.Api( 'imageinfo' ),
|
this.imageInfoProvider = new mw.mmv.provider.ImageInfo( new mw.mmv.logging.Api( 'imageinfo' ), {
|
||||||
// Short-circuit, don't fallback, to save some tiny amount of time
|
language: this.mwConfig.get( 'wgUserLanguage', false ) || this.mwConfig.get( 'wgContentLanguage', 'en' ),
|
||||||
{ language: this.mwConfig.get( 'wgUserLanguage', false ) || this.mwConfig.get( 'wgContentLanguage', 'en' ) }
|
maxage: apiCacheFiveMinutes
|
||||||
);
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {mw.mmv.provider.FileRepoInfo}
|
* @property {mw.mmv.provider.FileRepoInfo}
|
||||||
|
|
|
@ -91,7 +91,8 @@
|
||||||
titles: file.getPrefixedDb(),
|
titles: file.getPrefixedDb(),
|
||||||
iiprop: provider.iiprop,
|
iiprop: provider.iiprop,
|
||||||
iiextmetadatafilter: provider.iiextmetadatafilter,
|
iiextmetadatafilter: provider.iiextmetadatafilter,
|
||||||
iiextmetadatalanguage: provider.options.language
|
iiextmetadatalanguage: provider.options.language,
|
||||||
|
uselang: 'content'
|
||||||
} ).then( function ( data ) {
|
} ).then( function ( data ) {
|
||||||
return provider.getQueryPage( file, data );
|
return provider.getQueryPage( file, data );
|
||||||
} ).then( function ( page ) {
|
} ).then( function ( page ) {
|
||||||
|
|
Loading…
Reference in a new issue