if ( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
&& $this->request->getVal( 'localsettings' )
) {
- $this->request->response()->header( 'Content-type: application/x-httpd-php' );
- $this->request->response()->header(
- 'Content-Disposition: attachment; filename="LocalSettings.php"'
- );
-
- $ls = InstallerOverrides::getLocalSettingsGenerator( $this );
- $rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )];
- foreach ( $rightsProfile as $group => $rightsArr ) {
- $ls->setGroupRights( $group, $rightsArr );
- }
- echo $ls->getText();
-
+ $this->outputLS();
return $this->session;
}
* Get a session variable.
*
* @param string $name
- * @param array $default
+ * @param array|null $default
*
* @return array
*/
public function getAcceptLanguage() {
global $wgLanguageCode, $wgRequest;
- $mwLanguages = Language::fetchLanguageNames();
+ $mwLanguages = Language::fetchLanguageNames( null, 'mwfile' );
$headerLanguages = array_keys( $wgRequest->getAcceptLang() );
foreach ( $headerLanguages as $lang ) {
*/
public function showHelpBox( $msg /*, ... */ ) {
$args = func_get_args();
- $html = call_user_func_array( [ $this, 'getHelpBox' ], $args );
+ $html = $this->getHelpBox( ...$args );
$this->output->addHTML( $html );
}
public function showStatusMessage( Status $status ) {
$errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() );
foreach ( $errors as $error ) {
- call_user_func_array( [ $this, 'showMessage' ], $error );
+ $this->showMessage( ...$error );
}
}
*/
public function label( $msg, $forId, $contents, $helpData = "" ) {
if ( strval( $msg ) == '' ) {
- $labelText = ' ';
+ $labelText = "\u{00A0}";
} else {
$labelText = wfMessage( $msg )->escaped();
}
$items[$value] =
Xml::radio( $params['controlName'], $value, $checked, $itemAttribs ) .
- ' ' .
+ "\u{00A0}" .
Xml::tags( 'label', [ 'for' => $id ], $this->parse(
isset( $params['itemLabels'] ) ?
wfMessage( $params['itemLabels'][$value] )->plain() :
* @return string
*/
protected function getDocUrl( $page ) {
- $url = "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
+ $query = [ 'page' => $page ];
if ( in_array( $this->currentPageName, $this->pageSequence ) ) {
- $url .= '&lastPage=' . urlencode( $this->currentPageName );
+ $query['lastPage'] = $this->currentPageName;
}
- return $url;
+ return $this->getUrl( $query );
}
/**
public function docLink( $linkText, $attribs, $parser ) {
$url = $this->getDocUrl( $attribs['href'] );
- return '<a href="' . htmlspecialchars( $url ) . '">' .
- htmlspecialchars( $linkText ) .
- '</a>';
+ return Html::element( 'a', [ 'href' => $url ], $linkText );
}
/**
return WebRequest::detectServer();
}
+ /**
+ * Actually output LocalSettings.php for download
+ *
+ * @suppress SecurityCheck-XSS
+ */
+ private function outputLS() {
+ $this->request->response()->header( 'Content-type: application/x-httpd-php' );
+ $this->request->response()->header(
+ 'Content-Disposition: attachment; filename="LocalSettings.php"'
+ );
+
+ $ls = InstallerOverrides::getLocalSettingsGenerator( $this );
+ $rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )];
+ foreach ( $rightsProfile as $group => $rightsArr ) {
+ $ls->setGroupRights( $group, $rightsArr );
+ }
+ echo $ls->getText();
+ }
+
/**
* Output stylesheet for web installer pages
*/