Adds "$wgPopupsTextExtractsIntroOnly" option to control "intro" parameters for TextExtracts API request

Change-Id: I84f91ab0752bbd4a5b1ee159b7cbe1388f942f24
This commit is contained in:
Vedmaka 2020-11-26 16:09:57 +03:00 committed by jdlrobson
parent d1d0b2a704
commit ff2ba9ebf5
7 changed files with 10 additions and 4 deletions

View file

@ -113,6 +113,10 @@
"Special:MostLinkedFiles",
"Special:Book"
]
},
"PopupsTextExtractsIntroOnly": {
"description": "Whether we should extract intro text only or full page text. This is only applicable when using PopupsGateway=mwApiPlain.",
"value": true
}
},
"ResourceModules": {

View file

@ -134,6 +134,7 @@ class PopupsHooks {
$vars['wgPopupsEventLogging'] = $config->get( 'PopupsEventLogging' );
$vars['wgPopupsRestGatewayEndpoint'] = $config->get( 'PopupsRestGatewayEndpoint' );
$vars['wgPopupsStatsvSamplingRate'] = $config->get( 'PopupsStatsvSamplingRate' );
$vars['wgPopupsTextExtractsIntroOnly'] = $config->get( 'PopupsTextExtractsIntroOnly' );
}
/**

View file

@ -67,7 +67,7 @@
"bundlesize": [
{
"path": "resources/dist/index.js",
"maxSize": "13.6kB"
"maxSize": "13.61kB"
}
]
}

Binary file not shown.

Binary file not shown.

View file

@ -37,7 +37,7 @@ export default function createMediaWikiApiGateway( api, config ) {
prop: 'info|extracts|pageimages|revisions|info',
formatversion: 2,
redirects: true,
exintro: true,
exintro: mw.config.get( 'wgPopupsTextExtractsIntroOnly', true ),
exchars: config.EXTRACT_LENGTH,
// There is an added geometric limit on .mwe-popups-extract

View file

@ -153,11 +153,12 @@ class PopupsHooksTest extends MediaWikiTestCase {
'wgPopupsRestGatewayEndpoint' => '/api',
'wgPopupsVirtualPageViews' => true,
'wgPopupsGateway' => 'mwApiPlain',
'wgPopupsStatsvSamplingRate' => 0
'wgPopupsStatsvSamplingRate' => 0,
'wgPopupsTextExtractsIntroOnly' => true,
];
$this->setMwGlobals( $config );
PopupsHooks::onResourceLoaderGetConfigVars( $vars, '' );
$this->assertCount( 6, $vars, 'A configuration is retrieved.' );
$this->assertCount( 7, $vars, 'A configuration is retrieved.' );
foreach ( $config as $key => $value ) {
$this->assertSame(