Merge "Re-add A/B testing framework for new accounts"

This commit is contained in:
jenkins-bot 2015-04-21 01:18:11 +00:00 committed by Gerrit Code Review
commit 84b236ef95
3 changed files with 28 additions and 0 deletions

View file

@ -652,4 +652,22 @@ class VisualEditorHooks {
}
return true;
}
/**
* Sets user preference to enable the VisualEditor account if their new
* account's userID is even, if $wgVisualEditorEnableSplitTest is true.
*
* To be removed once no longer needed.
*/
public static function onAddNewAccount( $user, $byEmail ) {
if (
RequestContext::getMain()->getConfig()->get( 'VisualEditorEnableSplitTest' ) &&
$user->isLoggedin() &&
( ( $user->getId() % 2 ) === 0 )
) {
$user->setOption( 'visualeditor-enable', 1 );
$user->saveSettings();
}
return true;
}
}

View file

@ -87,6 +87,9 @@ $wgHooks['PageContentSaveComplete'][] = 'VisualEditorHooks::onPageContentSaveCom
$wgHooks['BeforeInitialize'][] = 'VisualEditorHooks::onBeforeInitialize';
$wgExtensionFunctions[] = 'VisualEditorHooks::onSetup';
// Run split test in production if $wgVisualEditorEnableSplitTest is true.
$wgHooks['AddNewAccount'][] = 'VisualEditorHooks::onAddNewAccount';
// Register resource modules
$wgVisualEditorResourceTemplate = array(
@ -1712,4 +1715,7 @@ $wgVisualEditorTabMessages = array(
'editsectionsourceappendix' => null,
);
// Whether to enable VisualEditor for half of all new accounts (userID even).
$wgVisualEditorEnableSplitTest = false;
unset( $wgVisualEditorResourceTemplate );

View file

@ -93,6 +93,7 @@
},
"VisualEditorTabPosition": "before",
"VisualEditorParsoidURL": "http://localhost:8000",
"VisualEditorEnableSplitTest": false,
"VisualEditorEnableTocWidget": false,
"VisualEditorNamespaces": [],
"VisualEditorParsoidTimeout": 100
@ -165,6 +166,9 @@
],
"BeforeInitialize": [
"VisualEditorHooks::onBeforeInitialize"
],
"AddNewAccount": [
"VisualEditorHooks::onAddNewAccount"
]
},
"ResourceModules": {