Merge "Replace global configuration variables by Config"

This commit is contained in:
jenkins-bot 2024-10-08 07:13:43 +00:00 committed by Gerrit Code Review
commit 428812edb2
2 changed files with 4 additions and 10 deletions

View file

@ -14,12 +14,9 @@ class Hooks implements ResourceLoaderGetConfigVarsHook {
* @param Config $config * @param Config $config
*/ */
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
global $wgReCaptchaSiteKey; if ( $config->get( 'CaptchaClass' ) === ReCaptchaNoCaptcha::class ) {
global $wgCaptchaClass;
if ( $wgCaptchaClass === ReCaptchaNoCaptcha::class ) {
$vars['wgConfirmEditConfig'] = [ $vars['wgConfirmEditConfig'] = [
'reCaptchaSiteKey' => $wgReCaptchaSiteKey, 'reCaptchaSiteKey' => $config->get( 'ReCaptchaSiteKey' ),
'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js' 'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js'
]; ];
} }

View file

@ -14,12 +14,9 @@ class Hooks implements ResourceLoaderGetConfigVarsHook {
* @param Config $config * @param Config $config
*/ */
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
global $wgTurnstileSiteKey; if ( $config->get( 'CaptchaClass' ) === Turnstile::class ) {
global $wgCaptchaClass;
if ( $wgCaptchaClass === Turnstile::class ) {
$vars['wgConfirmEditConfig'] = [ $vars['wgConfirmEditConfig'] = [
'turnstileSiteKey' => $wgTurnstileSiteKey, 'turnstileSiteKey' => $config->get( 'TurnstileSiteKey' ),
'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js' 'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js'
]; ];
} }