Bug 28039 - Boldface all fatals. Moved showError() from WebInstaller to base class, added its call to all env checks wherever appropriate. Also fixed a fatal in CLI installer when no DB drivers are present.
This commit is contained in:
parent
3f37c708ca
commit
a80cfe3425
2 changed files with 37 additions and 15 deletions
|
|
@ -121,14 +121,31 @@ class CliInstaller extends Installer {
|
|||
}
|
||||
|
||||
public function showMessage( $msg /*, ... */ ) {
|
||||
$params = func_get_args();
|
||||
array_shift( $params );
|
||||
echo $this->getMessageText( func_get_args() ) . "\n";
|
||||
flush();
|
||||
}
|
||||
|
||||
public function showError( $msg /*, ... */ ) {
|
||||
echo "***{$this->getMessageText( func_get_args() )}***\n";
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getMessageText( $params ) {
|
||||
$msg = array_shift( $params );
|
||||
|
||||
$text = wfMsgExt( $msg, array( 'parseinline' ), $params );
|
||||
|
||||
$text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 <$1>', $text );
|
||||
echo html_entity_decode( strip_tags( $text ), ENT_QUOTES ) . "\n";
|
||||
flush();
|
||||
return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy
|
||||
*/
|
||||
public function showHelpBox( $msg /*, ... */ ) {
|
||||
}
|
||||
|
||||
public function showStatusMessage( Status $status ) {
|
||||
|
|
|
|||
|
|
@ -295,6 +295,11 @@ abstract class Installer {
|
|||
*/
|
||||
public abstract function showMessage( $msg /*, ... */ );
|
||||
|
||||
/**
|
||||
* Same as showMessage(), but for displaying errors
|
||||
*/
|
||||
public abstract function showError( $msg /*, ... */ );
|
||||
|
||||
/**
|
||||
* Show a message to the installing user by using a Status object
|
||||
* @param $status Status
|
||||
|
|
@ -617,7 +622,7 @@ abstract class Installer {
|
|||
$this->setVar( '_CompiledDBs', $compiledDBs );
|
||||
|
||||
if ( !$compiledDBs ) {
|
||||
$this->showMessage( 'config-no-db' );
|
||||
$this->showError( 'config-no-db' );
|
||||
// FIXME: this only works for the web installer!
|
||||
$this->showHelpBox( 'config-no-db-help', $wgLang->commaList( $allNames ) );
|
||||
return false;
|
||||
|
|
@ -647,7 +652,7 @@ abstract class Installer {
|
|||
protected function envCheckBrokenXML() {
|
||||
$test = new PhpXmlBugTester();
|
||||
if ( !$test->ok ) {
|
||||
$this->showMessage( 'config-brokenlibxml' );
|
||||
$this->showError( 'config-brokenlibxml' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -660,7 +665,7 @@ abstract class Installer {
|
|||
$test = new PhpRefCallBugTester;
|
||||
$test->execute();
|
||||
if ( !$test->ok ) {
|
||||
$this->showMessage( 'config-using531', phpversion() );
|
||||
$this->showError( 'config-using531', phpversion() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -670,7 +675,7 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckMagicQuotes() {
|
||||
if( wfIniGetBool( "magic_quotes_runtime" ) ) {
|
||||
$this->showMessage( 'config-magic-quotes-runtime' );
|
||||
$this->showError( 'config-magic-quotes-runtime' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -680,7 +685,7 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckMagicSybase() {
|
||||
if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
|
||||
$this->showMessage( 'config-magic-quotes-sybase' );
|
||||
$this->showError( 'config-magic-quotes-sybase' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,7 +695,7 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckMbstring() {
|
||||
if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
|
||||
$this->showMessage( 'config-mbstring' );
|
||||
$this->showError( 'config-mbstring' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -700,7 +705,7 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckZE1() {
|
||||
if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) {
|
||||
$this->showMessage( 'config-ze1' );
|
||||
$this->showError( 'config-ze1' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -720,7 +725,7 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckXML() {
|
||||
if ( !function_exists( "utf8_encode" ) ) {
|
||||
$this->showMessage( 'config-xml-bad' );
|
||||
$this->showError( 'config-xml-bad' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -730,14 +735,14 @@ abstract class Installer {
|
|||
*/
|
||||
protected function envCheckPCRE() {
|
||||
if ( !function_exists( 'preg_match' ) ) {
|
||||
$this->showMessage( 'config-pcre' );
|
||||
$this->showError( 'config-pcre' );
|
||||
return false;
|
||||
}
|
||||
wfSuppressWarnings();
|
||||
$regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
|
||||
wfRestoreWarnings();
|
||||
if ( $regexd != '--' ) {
|
||||
$this->showMessage( 'config-pcre-no-utf8' );
|
||||
$this->showError( 'config-pcre-no-utf8' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -843,7 +848,7 @@ abstract class Installer {
|
|||
// Some kind soul has set it for us already (e.g. debconf)
|
||||
return true;
|
||||
} else {
|
||||
$this->showMessage( 'config-no-uri' );
|
||||
$this->showError( 'config-no-uri' );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue