Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68845


Change subject: Add ability to run a 50% split user test with VisualEditor as 
default
......................................................................

Add ability to run a 50% split user test with VisualEditor as default

Will only run if $wgVisualEditorEnableSplitTest is set to true. To be removed
once VisualEditor is fully deployed.

Bug: 49604
Change-Id: I5c603ece309d61641d32ccc9eff5ea2890d5b816
---
M VisualEditor.hooks.php
M VisualEditor.php
2 files changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/45/68845/1

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 34dfa4d..9a834cb 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -188,4 +188,19 @@
 
                return true;
        }
+
+
+       /**
+        * Sets user preference to enable the VisualEditor account if their new
+        * account's userID is even, if $wgVisualEditorEnableSplitTest is true.
+        *
+        * Added per bug 49604.
+        */
+       public static function onAddNewAccount( $user, $byEmail ) {
+               global $wgVisualEditorEnableSplitTest;
+
+               if ( $wgVisualEditorEnableSplitTest && ( ( $user->getId() % 2 ) 
== 0 ) ) {
+                       $user->setOption( 'visualeditor-enable' );
+               }
+       }
 }
diff --git a/VisualEditor.php b/VisualEditor.php
index b3bcfd6..110066b 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -625,6 +625,10 @@
 $wgHooks['MakeGlobalVariablesScript'][] = 
'VisualEditorHooks::onMakeGlobalVariablesScript';
 $wgHooks['ResourceLoaderGetConfigVars'][] = 
'VisualEditorHooks::onResourceLoaderGetConfigVars';
 $wgHooks['ResourceLoaderTestModules'][] = 
'VisualEditorHooks::onResourceLoaderTestModules';
+
+// Bug 49604: Running split test in production if 
$wgVisualEditorEnableSplitTest is true.
+$wgHooks['AddNewAccount'][] =  'VisualEditorHooks::onAddNewAccount';
+
 $wgExtensionFunctions[] = 'VisualEditorHooks::onSetup';
 
 $wgAutoloadClasses['VisualEditorMessagesModule'] = $dir . 
'VisualEditorMessagesModule.php';

-- 
To view, visit https://gerrit.wikimedia.org/r/68845
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c603ece309d61641d32ccc9eff5ea2890d5b816
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to