immewnity / mediawiki-fluent

Fluent skin for MediaWiki
https://www.mediawiki.org/wiki/Skin:Fluent
MIT License
6 stars 3 forks source link

Fix configuration #18

Closed redbluegreenhat closed 9 months ago

redbluegreenhat commented 9 months ago

Fixes an error introduced in my PR (https://github.com/immewnity/mediawiki-fluent/pull/15)

redbluegreenhat commented 9 months ago

I came across more issues caused by my PR on an install with this and a ported version of https://github.com/immewnity/mediawiki-fluent/pull/14

Config is not working correctly:

Original exception: [3b6b5bb628999c94f0e5bfad] /mediawiki/mediawiki-1.41.0/index.php/Special:Preferences TypeError: FluentTemplate::getGravatarUrl(): Argument #1 ($disableGravatar) must be of type bool, array given, called in /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php on line 38
Backtrace:
from /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php(314)
#0 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php(38): FluentTemplate->getGravatarUrl()
#1 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/skins/SkinTemplate.php(148): FluentTemplate->execute()
#2 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/skins/SkinTemplate.php(174): SkinTemplate->generateHTML()
#3 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/Output/OutputPage.php(2947): SkinTemplate->outputPage()
#4 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/MediaWiki.php(978): MediaWiki\Output\OutputPage->output()
#5 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/MediaWiki.php(613): MediaWiki->main()
#6 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/index.php(50): MediaWiki->run()
#7 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/index.php(46): wfIndexMain()
#8 {main}

Exception caught inside exception handler: [3b6b5bb628999c94f0e5bfad] /mediawiki/mediawiki-1.41.0/index.php/Special:Preferences TypeError: FluentTemplate::getGravatarUrl(): Argument #1 ($disableGravatar) must be of type bool, array given, called in /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php on line 38
Backtrace:
from /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php(314)
#0 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/skins/Fluent/includes/FluentTemplate.php(38): FluentTemplate->getGravatarUrl()
#1 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/skins/SkinTemplate.php(148): FluentTemplate->execute()
#2 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/skins/SkinTemplate.php(174): SkinTemplate->generateHTML()
#3 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/Output/OutputPage.php(2947): SkinTemplate->outputPage()
#4 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/exception/MWExceptionRenderer.php(188): MediaWiki\Output\OutputPage->output()
#5 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/exception/MWExceptionRenderer.php(105): MWExceptionRenderer::reportHTML()
#6 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/exception/MWExceptionHandler.php(134): MWExceptionRenderer::output()
#7 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/exception/MWExceptionHandler.php(251): MWExceptionHandler::report()
#8 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/includes/MediaWiki.php(635): MWExceptionHandler::handleException()
#9 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/index.php(50): MediaWiki->run()
#10 /var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/index.php(46): wfIndexMain()
#11 {main}

eval gives this:

/var/www/localhost/htdocs/mediawiki/mediawiki-1.41.0/maintenance # php eval.php

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

> $skinConfig = MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('Fluent');

> var_dump($skinConfig)
object(MediaWiki\Config\GlobalVarConfig)#19 (1) {
  ["prefix":"MediaWiki\Config\GlobalVarConfig":private]=>
  string(2) "wg"
}

> var_dump($skinConfig->get('FluentDisableGravatar'))
array(2) {
  ["value"]=>
  bool(false)
  ["help"]=>
  string(116) "Control whether or not we should use Gravatar. You should set this to true for wikis not available over the internet"
}

I'll fix this on this PR also.

redbluegreenhat commented 9 months ago

I'm not sure how to fix this, it may be best to revert #15 and try again later.

I've been looking at how Vector does configuration, they don't have a ConfigRegistry in their skin.json, they use MediaWiki\MediaWikiServices::getInstance->getMainConfig(), and just get the configs and it works, somehow.