mediawiki-extensions-Discus.../includes/Hooks/ResourceLoaderHooks.php
libraryupgrader b0884b177c build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.1 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I7a71e23da561599da417db3b3077b78d91173bbc
2021-07-22 16:29:04 +00:00

38 lines
1.1 KiB
PHP

<?php
/**
* DiscussionTools resource loader hooks
*
* @file
* @ingroup Extensions
* @license MIT
*/
namespace MediaWiki\Extension\DiscussionTools\Hooks;
use Config;
use MediaWiki\MediaWikiServices;
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
class ResourceLoaderHooks implements
ResourceLoaderGetConfigVarsHook
{
/**
* 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 {
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()
->makeConfig( 'discussiontools' );
$vars['wgDTSchemaEditAttemptStepSamplingRate'] =
$dtConfig->get( 'DTSchemaEditAttemptStepSamplingRate' );
$vars['wgDTSchemaEditAttemptStepOversample'] =
$dtConfig->get( 'DTSchemaEditAttemptStepOversample' );
}
}