mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-09-24 02:40:04 +00:00
Merge "Hygiene: SamplingRate -> BucketSize"
This commit is contained in:
commit
750f3d73fd
|
@ -166,8 +166,8 @@
|
|||
"RelatedArticlesShowInFooter": false,
|
||||
"RelatedArticlesUseCirrusSearch": false,
|
||||
"RelatedArticlesOnlyUseCirrusSearch": false,
|
||||
"RelatedArticlesLoggingSamplingRate": 0.01,
|
||||
"RelatedArticlesEnabledSamplingRate": 1,
|
||||
"RelatedArticlesLoggingBucketSize": 0.01,
|
||||
"RelatedArticlesEnabledBucketSize": 1,
|
||||
"@RelatedArticlesFooterWhitelistedSkins": "List of skin names (e.g. 'minerva') where related articles will be shown in the footer.",
|
||||
"RelatedArticlesFooterWhitelistedSkins": [ "minerva" ]
|
||||
},
|
||||
|
|
|
@ -158,10 +158,10 @@ class FooterHooks {
|
|||
public static function onResourceLoaderGetConfigVars( &$vars ) {
|
||||
$config = MediaWikiServices::getInstance()->getConfigFactory()
|
||||
->makeConfig( 'RelatedArticles' );
|
||||
$vars['wgRelatedArticlesLoggingSamplingRate'] =
|
||||
$config->get( 'RelatedArticlesLoggingSamplingRate' );
|
||||
$vars['wgRelatedArticlesEnabledSamplingRate']
|
||||
= $config->get( 'RelatedArticlesEnabledSamplingRate' );
|
||||
$vars['wgRelatedArticlesLoggingBucketSize'] =
|
||||
$config->get( 'RelatedArticlesLoggingBucketSize' );
|
||||
$vars['wgRelatedArticlesEnabledBucketSize']
|
||||
= $config->get( 'RelatedArticlesEnabledBucketSize' );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,26 +15,25 @@
|
|||
shouldShowReadMore;
|
||||
|
||||
/**
|
||||
* Is RelatedArticles extension enabled for current user
|
||||
* Gets whether the feature is enabled for the user.
|
||||
*
|
||||
* Returns true if the user opted into the beta feature, otherwise
|
||||
* user's session ID is used to determine the eligibility for RelatedArticles functionality,
|
||||
* based on the value of wgRelatedArticlesEnabledSamplingRate
|
||||
* thus the function will result the same outcome as long as the browser
|
||||
* hasn't been restarted or the cookie hasn't been cleared.
|
||||
* The user's session ID is used to determine the eligibility for
|
||||
* RelatedArticles functionality, based on the value of
|
||||
* `$wgRelatedArticlesEnabledBucketSize`. The result of the function will be
|
||||
* the same for the duration of their session.
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isEnabledForCurrentUser() {
|
||||
var bucket,
|
||||
samplingRate = mw.config.get( 'wgRelatedArticlesEnabledSamplingRate', 1 );
|
||||
bucketSize = mw.config.get( 'wgRelatedArticlesEnabledBucketSize', 1 );
|
||||
|
||||
bucket = mw.experiments.getBucket( {
|
||||
name: 'ext.relatedArticles.visibility',
|
||||
enabled: true,
|
||||
buckets: {
|
||||
control: 1 - samplingRate,
|
||||
A: samplingRate
|
||||
control: 1 - bucketSize,
|
||||
A: bucketSize
|
||||
}
|
||||
}, mw.user.sessionId() );
|
||||
return bucket === 'A';
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
* @return {boolean}
|
||||
*/
|
||||
function isEnabledForCurrentUser() {
|
||||
|
||||
// TODO: Rename this and other instances to bucketingRate.
|
||||
var samplingRate = mw.config.get( 'wgRelatedArticlesLoggingSamplingRate', 0 );
|
||||
var bucketSize = mw.config.get( 'wgRelatedArticlesLoggingBucketSize', 0 );
|
||||
|
||||
if ( !supportsBeacon() ) {
|
||||
return false;
|
||||
|
@ -37,8 +35,8 @@
|
|||
name: 'ext.relatedArticles.instrumentation',
|
||||
enabled: true,
|
||||
buckets: {
|
||||
control: 1 - samplingRate,
|
||||
A: samplingRate
|
||||
control: 1 - bucketSize,
|
||||
A: bucketSize
|
||||
}
|
||||
}, mw.user.sessionId() ) === 'A';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$wgRelatedArticlesLoggingSamplingRate = 1;
|
||||
$wgRelatedArticlesLoggingBucketSize = 1;
|
||||
$wgRelatedArticlesShowInFooter = true;
|
||||
$wgRelatedArticlesShowInSidebar = true;
|
||||
$wgRelatedArticlesUseCirrusSearch = true;
|
||||
|
|
Loading…
Reference in a new issue