Extension:GrowthExperiments/developer setup

Installation
Other extensions (optional)


 * PageImages — Used in link recommendation tasks (for showing images from the corresponding link recommendation articles).
 * Instrumentation — For more information, see Wikitech
 * EventLogging
 * EventStreamConfig
 * EventBus
 * WikiEditor — The default source editor.
 * Campaigns — Used to track entry points for account creation.
 * WikimediaEvents — Used for some of the editing-related instrumentation.
 * GuidedTour — Used to show tooltips (currently on desktop only).
 * CLDR — Used for localizing language names.

Enabling Growth features

 * 1) Go to Special:Preferences (while logged in)
 * 2) Under User profile section: check Display newcomer homepage and Default to newcomer homepage from username link
 * 3) Under Editing section: check Enable the editor help panel

Alternatively, run the following in the browser console:

Mentor dashboard
To enable the mentor dashboard follow the next steps:


 * 1) Log in as an admin
 * 2) Create a new page for instance   to hold the list of users that will be mentors, add a mentor by adding  . More info https://www.mediawiki.org/wiki/Growth/Communities/How_to_configure_the_mentors%27_list#create
 * 3) Go to http://localhost:8080/wiki/Special:EditGrowthConfig
 * 4) Under mentorship, enable mentorship & specify the page containing the list of mentors:.
 * 5) Run   script
 * 6) Log in to the mentor account & go to http://localhost:8080/wiki/Special:MentorDashboard

Suggested Edits
There are three basic approaches for setting up suggested edits, the main functionality of GrowthExperiments, in a developer setup:


 * 1) Have the extension use the search API of a remote (production) wiki. You won't have to deal with setting up search locally, and you will get a wide range of realistic task suggestions, but the articles suggested for those tasks won't exist on your wiki so most editing-related functionality won't work. This is the easiest way to get the homepage and guidance working in general, and to QA task suggestions. It doesn't work for structured link recommendations though since those aren't enabled on any production wiki yet.
 * 2) Set up search locally, copy-paste or import a couple articles from some real wiki. This is quite a bit more effort but doable (on Vagrant it should mostly work out of the box). It's good for backend development, probably not really worth the effort for frontend development.
 * 3) Mock all the backend logic involved with static PHP code. This is nice for frontend work as you get direct and full control over the responses from the backend.

Set up search locally
In Vagrant search can be set up with  (but it will be set up automatically as a dependency if you provision the   role). For Docker, see MediaWiki-Docker/Configuration recipes/ElasticSearch. For other setups, a basic configuration is:

See the setup notes of Extension:CirrusSearch for more details.

You can use the CirrusSearch maintenance script  for setting the ORES topics of wiki pages.

To use settings from cswiki:


 * 1) Follow the ElasticSearch instructions from 1>Special:MyLanguage/MediaWiki-Docker/Configuration_recipes/ElasticSearch|MediaWiki-Docker/Configuration_recipes/ElasticSearch.


 * 1) Copy the contents of MediaWiki:NewcomerTopicsOres.json to http://localhost:8080/w/index.php?title=MediaWiki:NewcomerTopicsOres.json&action=edit.  (must be signed in as an admin on MediaWiki)


 * 1) Copy the contents of MediaWiki:NewcomerTasks.json to http://localhost:8080/w/index.php?title=MediaWiki:NewcomerTasks.json&action=edit.  (must be signed in as an admin on MediaWiki)


 * 1) Add   to  .


 * 1) Add   to  </>.


 * 1) Add <tvar|1> </> to <tvar|2> .</>

To use settings from other wikis, replace "cs" with the language code of the desired wiki (for  and  ).

Link recommendations
Your local development environment can query the "external traffic" production release of the link recommendation service. Access is proxied via the api-gateway (api.wikimedia.org) which requires an access token to utilize the API. That means you need to generate a personal access token (https://api.wikimedia.org/wiki/Documentation/Getting_started/Authentication#Personal_API_tokens), when you will use the access token as the value for GELinkRecommendationServiceAccessToken in LocalSettings.php:

To allow non-existent pages (red links) as suggested edits, add the following to LocalSettings.php

To enable link recommendation tasks for the currently logged in user, run the following from the browser console (while on Special:Homepage):

2022 production edition
You need to set up an SSH tunnel as there is not a public facing API yet.


 * 1) edit   on your laptop and add
 * 2) set up your SSH tunnel:
 * 3) Make a test request on your laptop:   Note that the   option is needed to ignore SSL validation

Modify the HTTP request in includes/NewcomerTasks/AddImage/ProductionImageRecommendationApiHandler.php to ignore SSL cert validation: $request = $this->httpRequestFactory->create(			$this->url . '/' . implode( '/', array_map( 'rawurlencode', $pathArgs ) ),			[				'method' => 'GET',				'sslVerifyCert' => false,				'sslVerifyHost' => false,				'originalRequest' => RequestContext::getMain->getRequest,				'timeout' => $this->requestTimeout,			],			__METHOD__		); You'll also need to hardcode the page ID used in each request, because we cannot yet query by page title: $pathArgs = [ 'public', 'image_suggestions', 'suggestions', $this->wikiId, // $title->getArticleID 6721577		]; Finally, set the config values in your LocalSettings.php: $wgGEImageRecommendationApiHandler = "production"; $wgGEImageRecommendationServiceWikiIdMasquerade = "ptwiki";

MVP edition
To use the live image suggestions API with the Wikipedia matching the wiki's language, set

To use Commons as a file repository, set

To enable image recommendation tasks for the currently logged in user, run the following from the browser console (while on Special:Homepage):

Seeding Articles from Czech Wikipedia
See also https://phabricator.wikimedia.org/T274198#6972115


 * 1) Make sure that http://localhost:8080/wiki/MediaWiki:NewcomerTasks.json is the same as that in Czech Wikipedia.
 * 2) Get article titles for Growth tasks from Czech Wikipedia.
 * 3) Import XML dump by running the following command inside mediawiki installation directory
 * 4) Create "Module:Wikidata" on your local site. Copy/paste the source of https://cs.wikipedia.org/wiki/Module:Wikidata and save it.
 * 5) Update secondary tables (to get accurate information on Special:RecentChanges and Special:Statistics)
 * 6) Update ElasticSearch

Seeding ORES topics
To import ORES topics for articles imported from a production wiki (English Wikipedia in the example below), run

To set ORES topics for some article manually, use