ProfessionalWiki / Bootstrap

Provides the Bootstrap 4 web front-end framework to MediaWiki skins and extensions
https://www.mediawiki.org/wiki/Extension:Bootstrap
Other
14 stars 13 forks source link

ParserOutput::addModuleStyles with non-array argument was deprecated in MediaWiki 1.38 #62

Closed adrelanos closed 1 year ago

adrelanos commented 2 years ago

Installation instructions...

wfLoadExtension( 'Bootstrap' );

$wgHooks['SetupAfterCache'][] = function(){
    \Bootstrap\BootstrapManager::getInstance()->addAllBootstrapModules();
    return true;
};

$wgHooks['ParserAfterParse'][]=function( Parser &$parser, &$text, StripState &$stripState ){
    $parser->getOutput()->addModuleStyles( 'ext.bootstrap.styles' );
    $parser->getOutput()->addModules( 'ext.bootstrap.scripts' );
    return true;
};

Now leading to...

PHP Deprecated: Use of ParserOutput::addModuleStyles with non-array argument was deprecated in MediaWiki 1.38. [Called from {closure} PHP Deprecated: Use of ParserOutput::addModules with non-array argument was deprecated in MediaWiki 1.38. [Called from {closure}

Since MediaWiki version 1.38.2.

Melco233 commented 1 year ago

It looks like……

$wgHooks['SetupAfterCache'][] = function(){
    \Bootstrap\BootstrapManager::getInstance()->addAllBootstrapModules();
    return true;
};

$wgHooks['ParserAfterParse'][]=function( Parser &$parser, &$text, StripState &$stripState ){
    $parser->getOutput()->addModuleStyles( ['ext.bootstrap.styles'] );
    $parser->getOutput()->addModules( ['ext.bootstrap.scripts'] );
    return true;
};

Just needs to be modified like this,and it works.

malberts commented 1 year ago

The instructions have been updated on https://www.mediawiki.org/wiki/Extension:Bootstrap