X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FWebInstaller.php;h=0a6be86ba56acaa74d7fc8afd9464e376ca7be20;hb=61702397aa04572251869935245c07a0821f6c4a;hp=cda86129566f106dee795b2e6db415d9e4df1f31;hpb=ee975d6d1a376bb08d2b1731f97abc96f6e26b1d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index cda8612956..0a6be86ba5 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -140,9 +140,9 @@ class WebInstaller extends Installer { $this->request = $request; // Add parser hooks - global $wgParser; - $wgParser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] ); - $wgParser->setHook( 'doclink', [ $this, 'docLink' ] ); + $parser = MediaWikiServices::getInstance()->getParser(); + $parser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] ); + $parser->setHook( 'doclink', [ $this, 'docLink' ] ); } /** @@ -374,13 +374,14 @@ class WebInstaller extends Installer { * Show an error message in a box. Parameters are like wfMessage(), or * alternatively, pass a Message object in. * @param string|Message $msg + * @param mixed ...$params */ - public function showError( $msg /*...*/ ) { + public function showError( $msg, ...$params ) { if ( !( $msg instanceof Message ) ) { - $args = func_get_args(); - array_shift( $args ); - $args = array_map( 'htmlspecialchars', $args ); - $msg = wfMessage( $msg, $args ); + $msg = wfMessage( + $msg, + array_map( 'htmlspecialchars', $params ) + ); } $text = $msg->useDatabase( false )->plain(); $this->output->addHTML( $this->getErrorBox( $text ) ); @@ -675,9 +676,7 @@ class WebInstaller extends Installer { * @param string $msg * @return string */ - public function getHelpBox( $msg /*, ... */ ) { - $args = func_get_args(); - array_shift( $args ); + public function getHelpBox( $msg, ...$args ) { $args = array_map( 'htmlspecialchars', $args ); $text = wfMessage( $msg, $args )->useDatabase( false )->plain(); $html = $this->parse( $text, true ); @@ -693,10 +692,10 @@ class WebInstaller extends Installer { /** * Output a help box. * @param string $msg Key for wfMessage() + * @param mixed ...$params */ - public function showHelpBox( $msg /*, ... */ ) { - $args = func_get_args(); - $html = $this->getHelpBox( ...$args ); + public function showHelpBox( $msg, ...$params ) { + $html = $this->getHelpBox( $msg, ...$params ); $this->output->addHTML( $html ); } @@ -705,12 +704,11 @@ class WebInstaller extends Installer { * Output looks like a list. * * @param string $msg + * @param mixed ...$params */ - public function showMessage( $msg /*, ... */ ) { - $args = func_get_args(); - array_shift( $args ); + public function showMessage( $msg, ...$params ) { $html = '
' . - $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) . + $this->parse( wfMessage( $msg, $params )->useDatabase( false )->plain() ) . "
\n"; $this->output->addHTML( $html ); } @@ -1072,12 +1070,10 @@ class WebInstaller extends Installer { if ( $value === null ) { // Checkbox? $this->setVar( $name, false ); + } elseif ( stripos( $name, 'password' ) !== false ) { + $this->setPassword( $name, $value ); } else { - if ( stripos( $name, 'password' ) !== false ) { - $this->setPassword( $name, $value ); - } else { - $this->setVar( $name, $value ); - } + $this->setVar( $name, $value ); } }