X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FWebInstallerPage.php;h=1c95d9a1ac6fcad754a640f013f7754983685f93;hb=1e66d7840b318ba55ceec5000d1dc44b9e79e26a;hp=510ea6c6bb7eabd2a7a7d299e935e93016bd4ec9;hpb=870f710234d99d6e168dc26833601bfcfdc5fdbf;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php
index 510ea6c6bb..1c95d9a1ac 100644
--- a/includes/installer/WebInstallerPage.php
+++ b/includes/installer/WebInstallerPage.php
@@ -89,27 +89,35 @@ abstract class WebInstallerPage {
if ( $continue ) {
// Fake submit button for enter keypress (bug 26267)
// Messages: config-continue, config-restart, config-regenerate
- $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(),
- array( 'name' => "enter-$continue", 'style' =>
- 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n";
+ $s .= Xml::submitButton(
+ wfMessage( "config-$continue" )->text(),
+ array(
+ 'name' => "enter-$continue",
+ 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0'
+ )
+ ) . "\n";
}
if ( $back ) {
// Message: config-back
- $s .= Xml::submitButton( wfMessage( "config-$back" )->text(),
+ $s .= Xml::submitButton(
+ wfMessage( "config-$back" )->text(),
array(
'name' => "submit-$back",
'tabindex' => $this->parent->nextTabIndex()
- ) ) . "\n";
+ )
+ ) . "\n";
}
if ( $continue ) {
// Messages: config-continue, config-restart, config-regenerate
- $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(),
+ $s .= Xml::submitButton(
+ wfMessage( "config-$continue" )->text(),
array(
'name' => "submit-$continue",
'tabindex' => $this->parent->nextTabIndex(),
- ) ) . "\n";
+ )
+ ) . "\n";
}
$s .= "\n";
@@ -177,7 +185,6 @@ abstract class WebInstallerPage {
}
class WebInstaller_Language extends WebInstallerPage {
-
public function execute() {
global $wgLang;
$r = $this->parent->request;
@@ -211,6 +218,7 @@ class WebInstaller_Language extends WebInstallerPage {
if ( isset( $languages[$contLang] ) ) {
$this->setVar( 'wgLanguageCode', $contLang );
}
+
return 'continue';
}
} elseif ( $this->parent->showSessionWarning ) {
@@ -264,9 +272,9 @@ class WebInstaller_Language extends WebInstallerPage {
$s .= "\n" . Xml::option( "$code - $lang", $code, $code == $selectedCode );
}
$s .= "\n\n";
+
return $this->parent->label( $label, $name, $s );
}
-
}
class WebInstaller_ExistingWiki extends WebInstallerPage {
@@ -280,8 +288,8 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
// Check if the upgrade key supplied to the user has appeared in LocalSettings.php
if ( $vars['wgUpgradeKey'] !== false
&& $this->getVar( '_UpgradeKeySupplied' )
- && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey'] )
- {
+ && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey']
+ ) {
// It's there, so the user is authorized
$status = $this->handleExistingUpgrade( $vars );
if ( $status->isOK() ) {
@@ -290,6 +298,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
$this->startForm();
$this->parent->showStatusBox( $status );
$this->endForm( 'continue' );
+
return 'output';
}
}
@@ -308,6 +317,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
$this->getVar( 'wgUpgradeKey' ) . "';" )->plain()
) );
$this->endForm( 'continue' );
+
return 'output';
}
@@ -319,6 +329,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
if ( !$key || $key !== $vars['wgUpgradeKey'] ) {
$this->parent->showError( 'config-localsettings-badkey' );
$this->showKeyForm();
+
return 'output';
}
// Key was OK
@@ -328,10 +339,12 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
} else {
$this->parent->showStatusBox( $status );
$this->showKeyForm();
+
return 'output';
}
} else {
$this->showKeyForm();
+
return 'output';
}
}
@@ -361,6 +374,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
}
$this->setVar( $name, $vars[$name] );
}
+
return $status;
}
@@ -372,7 +386,8 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
protected function handleExistingUpgrade( $vars ) {
// Check $wgDBtype
if ( !isset( $vars['wgDBtype'] ) ||
- !in_array( $vars['wgDBtype'], Installer::getDBTypes() ) ) {
+ !in_array( $vars['wgDBtype'], Installer::getDBTypes() )
+ ) {
return Status::newFatal( 'config-localsettings-connection-error', '' );
}
@@ -402,11 +417,13 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
// Adjust the error message to explain things correctly
$status->replaceMessage( 'config-connection-error',
'config-localsettings-connection-error' );
+
return $status;
}
// All good
$this->setVar( '_ExistingDBSettings', true );
+
return $status;
}
}
@@ -431,9 +448,9 @@ class WebInstaller_Welcome extends WebInstallerPage {
} else {
$this->parent->showStatusMessage( $status );
}
+
return '';
}
-
}
class WebInstaller_DBConnect extends WebInstallerPage {
@@ -449,6 +466,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
if ( $status->isGood() ) {
$this->setVar( '_UpgradeDone', false );
+
return 'continue';
} else {
$this->parent->showStatusBox( $status );
@@ -494,20 +512,21 @@ class WebInstaller_DBConnect extends WebInstallerPage {
// Messages: config-header-mysql, config-header-postgres, config-header-oracle,
// config-header-sqlite
- $settings .=
- Html::openElement( 'div', array( 'id' => 'DB_wrapper_' . $type,
- 'class' => 'dbWrapper' ) ) .
+ $settings .= Html::openElement(
+ 'div',
+ array(
+ 'id' => 'DB_wrapper_' . $type,
+ 'class' => 'dbWrapper'
+ )
+ ) .
Html::element( 'h3', array(), wfMessage( 'config-header-' . $type )->text() ) .
$installer->getConnectForm() .
"\n";
}
- $types .= "
\n";
- $this->addHTML(
- $this->parent->label( 'config-db-type', false, $types ) .
- $settings
- );
+ $types .= "
\n";
+ $this->addHTML( $this->parent->label( 'config-db-type', false, $types ) . $settings );
$this->endForm();
}
@@ -522,9 +541,9 @@ class WebInstaller_DBConnect extends WebInstallerPage {
if ( !$installer ) {
return Status::newFatal( 'config-invalid-db-type' );
}
+
return $installer->submitConnectForm();
}
-
}
class WebInstaller_Upgrade extends WebInstallerPage {
@@ -545,6 +564,7 @@ class WebInstaller_Upgrade extends WebInstallerPage {
// Show the done message again
// Make them click back again if they want to do the upgrade again
$this->showDoneMessage();
+
return 'output';
}
}
@@ -573,6 +593,7 @@ class WebInstaller_Upgrade extends WebInstallerPage {
}
$this->setVar( '_UpgradeDone', true );
$this->showDoneMessage();
+
return 'output';
}
}
@@ -596,15 +617,14 @@ class WebInstaller_Upgrade extends WebInstallerPage {
$this->parent->getInfoBox(
wfMessage( $msg,
$this->getVar( 'wgServer' ) .
- $this->getVar( 'wgScriptPath' ) . '/index' .
- $this->getVar( 'wgScriptExtension' )
+ $this->getVar( 'wgScriptPath' ) . '/index' .
+ $this->getVar( 'wgScriptExtension' )
)->plain(), 'tick-32.png'
)
);
$this->parent->restoreLinkPopups();
$this->endForm( $regenerate ? 'regenerate' : false, false );
}
-
}
class WebInstaller_DBSettings extends WebInstallerPage {
@@ -633,7 +653,6 @@ class WebInstaller_DBSettings extends WebInstallerPage {
$this->addHTML( $form );
$this->endForm();
}
-
}
class WebInstaller_Name extends WebInstallerPage {
@@ -684,9 +703,8 @@ class WebInstaller_Name extends WebInstallerPage {
) ) .
$this->parent->getTextBox( array(
'var' => 'wgMetaNamespace',
- 'label' => '', //TODO: Needs a label?
- 'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' ),
-
+ 'label' => '', // @todo Needs a label?
+ 'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' )
) ) .
$this->getFieldSetStart( 'config-admin-box' ) .
$this->parent->getTextBox( array(
@@ -728,6 +746,7 @@ class WebInstaller_Name extends WebInstallerPage {
$this->setVar( 'wgMetaNamespace', $metaNS );
$this->endForm();
+
return 'output';
}
@@ -841,11 +860,9 @@ class WebInstaller_Name extends WebInstallerPage {
return $retVal;
}
-
}
class WebInstaller_Options extends WebInstallerPage {
-
public function execute() {
if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
return 'skip';
@@ -938,7 +955,7 @@ class WebInstaller_Options extends WebInstallerPage {
}
$extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
- $this->getFieldSetEnd();
+ $this->getFieldSetEnd();
$this->addHTML( $extHtml );
}
@@ -1053,6 +1070,7 @@ class WebInstaller_Options extends WebInstallerPage {
'lang' => $this->getVar( '_UserLang' ),
'stylesheet' => $styleUrl,
) );
+
return $iframeUrl;
}
@@ -1082,6 +1100,7 @@ class WebInstaller_Options extends WebInstallerPage {
// If you change this height, also change it in config.css
$expandJs = str_replace( '$1', '54em', $js );
$reduceJs = str_replace( '$1', '70px', $js );
+
return '
' . Html::element( 'img', array( 'src' => $this->getVar( 'wgRightsIcon' ) ) ) . ' ' . @@ -1108,6 +1127,7 @@ class WebInstaller_Options extends WebInstallerPage { array( 'wgRightsUrl', 'wgRightsText', 'wgRightsIcon' ) ); if ( count( $newValues ) != 3 ) { $this->parent->showError( 'config-cc-error' ); + return; } $this->setVar( '_CCDone', true ); @@ -1122,8 +1142,8 @@ class WebInstaller_Options extends WebInstallerPage { 'wgUseInstantCommons' ) ); if ( !in_array( $this->getVar( '_RightsProfile' ), - array_keys( $this->parent->rightsProfiles ) ) ) - { + array_keys( $this->parent->rightsProfiles ) ) + ) { reset( $this->parent->rightsProfiles ); $this->setVar( '_RightsProfile', key( $this->parent->rightsProfiles ) ); } @@ -1132,6 +1152,7 @@ class WebInstaller_Options extends WebInstallerPage { if ( $code == 'cc-choose' ) { if ( !$this->getVar( '_CCDone' ) ) { $this->parent->showError( 'config-cc-not-chosen' ); + return false; } } elseif ( in_array( $code, array_keys( $this->parent->licenses ) ) ) { @@ -1166,28 +1187,33 @@ class WebInstaller_Options extends WebInstallerPage { $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) ); if ( !$memcServers ) { $this->parent->showError( 'config-memcache-needservers' ); + return false; } foreach ( $memcServers as $server ) { $memcParts = explode( ":", $server, 2 ); if ( !isset( $memcParts[0] ) - || ( !IP::isValid( $memcParts[0] ) - && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) ) ) { + || ( !IP::isValid( $memcParts[0] ) + && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) ) + ) { $this->parent->showError( 'config-memcache-badip', $memcParts[0] ); + return false; } elseif ( !isset( $memcParts[1] ) ) { $this->parent->showError( 'config-memcache-noport', $memcParts[0] ); + return false; } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) { $this->parent->showError( 'config-memcache-badport', 1, 65535 ); + return false; } } } + return true; } - } class WebInstaller_Install extends WebInstallerPage { @@ -1219,13 +1245,16 @@ class WebInstaller_Install extends WebInstallerPage { $this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) ); $this->endForm(); } + return true; } public function startStage( $step ) { // Messages: config-install-database, config-install-tables, config-install-interwiki, // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage - $this->addHTML( "