*
* @var string[]
*/
- public $pageSequence = array(
+ public $pageSequence = [
'Language',
'ExistingWiki',
'Welcome',
'Options',
'Install',
'Complete',
- );
+ ];
/**
* Out of sequence pages, selectable by the user at any time.
*
* @var string[]
*/
- protected $otherPages = array(
+ protected $otherPages = [
'Restart',
'Readme',
'ReleaseNotes',
'Copying',
'UpgradeDoc', // Can't use Upgrade due to Upgrade step
- );
+ ];
/**
* Array of pages which have declared that they have been submitted, have validated
// Add parser hooks
global $wgParser;
- $wgParser->setHook( 'downloadlink', array( $this, 'downloadLinkHook' ) );
- $wgParser->setHook( 'doclink', array( $this, 'docLink' ) );
+ $wgParser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] );
+ $wgParser->setHook( 'doclink', [ $this, 'docLink' ] );
}
/**
if ( isset( $session['happyPages'] ) ) {
$this->happyPages = $session['happyPages'];
} else {
- $this->happyPages = array();
+ $this->happyPages = [];
}
if ( isset( $session['skippedPages'] ) ) {
$this->skippedPages = $session['skippedPages'];
} else {
- $this->skippedPages = array();
+ $this->skippedPages = [];
}
$lowestUnhappy = $this->getLowestUnhappy();
$nextPage = $this->pageSequence[$lowestUnhappy];
}
- $this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
+ $this->output->redirect( $this->getUrl( [ 'page' => $nextPage ] ) );
return $this->finish();
}
$nextPage = $this->pageSequence[$lowestUnhappy];
}
- $this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
+ $this->output->redirect( $this->getUrl( [ 'page' => $nextPage ] ) );
}
return $this->finish();
return true;
}
- $this->phpErrors = array();
- set_error_handler( array( $this, 'errorHandler' ) );
+ $this->phpErrors = [];
+ set_error_handler( [ $this, 'errorHandler' ] );
try {
session_name( 'mw_installer_session' );
session_start();
$url = $m[1];
}
- return md5( serialize( array(
+ return md5( serialize( [
'local path' => dirname( __DIR__ ),
'url' => $url,
'version' => $GLOBALS['wgVersion']
- ) ) );
+ ] ) );
}
/**
* We're restarting the installation, reset the session, happyPages, etc
*/
public function reset() {
- $this->session = array();
- $this->happyPages = array();
- $this->settings = array();
+ $this->session = [];
+ $this->happyPages = [];
+ $this->settings = [];
}
/**
*
* @return string
*/
- public function getUrl( $query = array() ) {
+ public function getUrl( $query = [] ) {
$url = $this->request->getRequestURL();
# Remove existing query
$url = preg_replace( '/\?.*$/', '', $url );
if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) {
$wgLanguageCode = $this->getAcceptLanguage();
$wgLang = $wgContLang = Language::factory( $wgLanguageCode );
+ RequestContext::getMain()->setLanguage( $wgLang );
$this->setVar( 'wgLanguageCode', $wgLanguageCode );
$this->setVar( '_UserLang', $wgLanguageCode );
} else {
// config-page-dbsettings, config-page-name, config-page-options, config-page-install,
// config-page-complete, config-page-restart, config-page-readme, config-page-releasenotes,
// config-page-copying, config-page-upgradedoc, config-page-existingwiki
- $s .= Html::element( 'h2', array(),
+ $s .= Html::element( 'h2', [],
wfMessage( 'config-page-' . strtolower( $currentPageName ) )->text() );
$this->output->addHTMLNoFlush( $s );
$name = wfMessage( 'config-page-' . strtolower( $pageName ) )->text();
if ( $enabled ) {
- $query = array( 'page' => $pageName );
+ $query = [ 'page' => $pageName ];
if ( !in_array( $pageName, $this->pageSequence ) ) {
if ( in_array( $currentPageName, $this->pageSequence ) ) {
}
$link = Html::element( 'a',
- array(
+ [
'href' => $this->getUrl( $query )
- ),
+ ],
$name
);
} else {
}
} else {
$s .= Html::element( 'span',
- array(
+ [
'class' => 'config-page-disabled'
- ),
+ ],
$name
);
}
*/
public function showHelpBox( $msg /*, ... */ ) {
$args = func_get_args();
- $html = call_user_func_array( array( $this, 'getHelpBox' ), $args );
+ $html = call_user_func_array( [ $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( array( $this, 'showMessage' ), $error );
+ call_user_func_array( [ $this, 'showMessage' ], $error );
}
}
$labelText = wfMessage( $msg )->escaped();
}
- $attributes = array( 'class' => 'config-label' );
+ $attributes = [ 'class' => 'config-label' ];
if ( $forId ) {
$attributes['for'] = $forId;
}
if ( !isset( $params['attribs'] ) ) {
- $params['attribs'] = array();
+ $params['attribs'] = [];
}
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
$params['controlName'],
30, // intended to be overridden by CSS
$params['value'],
- $params['attribs'] + array(
+ $params['attribs'] + [
'id' => $params['controlName'],
'class' => 'config-input-text',
'tabindex' => $this->nextTabIndex()
- )
+ ]
),
$params['help']
);
}
if ( !isset( $params['attribs'] ) ) {
- $params['attribs'] = array();
+ $params['attribs'] = [];
}
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
$params['value'],
30,
5,
- $params['attribs'] + array(
+ $params['attribs'] + [
'id' => $params['controlName'],
'class' => 'config-input-text',
'tabindex' => $this->nextTabIndex()
- )
+ ]
),
$params['help']
);
}
if ( !isset( $params['attribs'] ) ) {
- $params['attribs'] = array();
+ $params['attribs'] = [];
}
$params['value'] = $this->getFakePassword( $params['value'] );
}
if ( !isset( $params['attribs'] ) ) {
- $params['attribs'] = array();
+ $params['attribs'] = [];
}
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
Xml::check(
$params['controlName'],
$params['value'],
- $params['attribs'] + array(
+ $params['attribs'] + [
'id' => $params['controlName'],
'tabindex' => $this->nextTabIndex(),
- )
+ ]
) .
$labelText . "\n" .
"</label>\n" .
$params['value'] = $this->getVar( $params['var'] );
}
- $items = array();
+ $items = [];
foreach ( $params['values'] as $value ) {
- $itemAttribs = array();
+ $itemAttribs = [];
if ( isset( $params['commonAttribs'] ) ) {
$itemAttribs = $params['commonAttribs'];
$items[$value] =
Xml::radio( $params['controlName'], $value, $checked, $itemAttribs ) .
' ' .
- Xml::tags( 'label', array( 'for' => $id ), $this->parse(
+ Xml::tags( 'label', [ 'for' => $id ], $this->parse(
isset( $params['itemLabels'] ) ?
wfMessage( $params['itemLabels'][$value] )->plain() :
wfMessage( $params['itemLabelPrefix'] . strtolower( $value ) )->plain()
if ( !$status->isGood() ) {
$text = $status->getWikiText();
- if ( $status->isOk() ) {
+ if ( $status->isOK() ) {
$box = $this->getWarningBox( $text );
} else {
$box = $this->getErrorBox( $text );
* @return string[]
*/
public function setVarsFromRequest( $varNames, $prefix = 'config_' ) {
- $newValues = array();
+ $newValues = [];
foreach ( $varNames as $name ) {
$value = $this->request->getVal( $prefix . $name );
*/
public function downloadLinkHook( $text, $attribs, $parser ) {
$anchor = Html::rawElement( 'a',
- array( 'href' => $this->getURL( array( 'localsettings' => 1 ) ) ),
+ [ 'href' => $this->getUrl( [ 'localsettings' => 1 ] ) ],
wfMessage( 'config-download-localsettings' )->parse()
);
- return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor );
+ return Html::rawElement( 'div', [ 'class' => 'config-download-link' ], $anchor );
+ }
+
+ /**
+ * If the software package wants the LocalSettings.php file
+ * to be placed in a specific location, override this function
+ * (see mw-config/overrides/README) to return the path of
+ * where the file should be saved, or false for a generic
+ * "in the base of your install"
+ *
+ * @since 1.27
+ * @return string|bool
+ */
+ public function getLocalSettingsLocation() {
+ return false;
}
/**