mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-12 08:35:37 +00:00
dcecf76ff1
PHP logging code is not moved. * Use the new mw.track() handlers from WikimediaEvents * Ensure that 'integration' and 'editor_interface' are set on init events, since they're not hard-coded in the handler any more * Remove the setting of 'editingStatsId' tracking parameter, now happens in WikimediaEvents (by way of VE ArticleTargetSaver) * Remove code connecting ve.track to mw.track, now happens in VE This must be merged together with WikimediaEvents change Iace4d53a972396ca5b8713000570cc47c9986034 (but we can't use Depends-On, because CI requires code here to be removed first). Bug: T332438 Change-Id: I0ef0a96aafdf89a4ebe32131a85b18c25744bb2c
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* DiscussionTools resource loader hooks
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Hooks;
|
|
|
|
use Config;
|
|
use ConfigFactory;
|
|
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
|
|
|
|
class ResourceLoaderHooks implements
|
|
ResourceLoaderGetConfigVarsHook
|
|
{
|
|
|
|
private Config $config;
|
|
|
|
public function __construct(
|
|
ConfigFactory $configFactory
|
|
) {
|
|
$this->config = $configFactory->makeConfig( 'discussiontools' );
|
|
}
|
|
|
|
/**
|
|
* Set static (not request-specific) JS configuration variables
|
|
*
|
|
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
|
|
* @param array &$vars Array of variables to be added into the output of the startup module
|
|
* @param string $skin Current skin name to restrict config variables to a certain skin
|
|
* @param Config $config
|
|
*/
|
|
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
|
|
$abtest = $this->config->get( 'DiscussionToolsABTest' );
|
|
if ( $abtest ) {
|
|
$vars['wgDiscussionToolsABTest'] = $abtest;
|
|
}
|
|
}
|
|
|
|
}
|