From: Brion Vibber Date: Fri, 17 Jun 2005 23:20:55 +0000 (+0000) Subject: Fix up getMessage() on WikiError X-Git-Tag: 1.5.0beta1~175 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=66bd225582ae9a28606c21e021a2528dd66fdf13;p=lhc%2Fweb%2Fwiklou.git Fix up getMessage() on WikiError --- diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index 3903de053a..09bc312319 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -54,13 +54,13 @@ function wfSpecialImport( $page = '' ) { } if( WikiError::isError( $result ) ) { - $wgOut->addWikiText( htmlspecialchars( $result->toString() ) ); + $wgOut->addWikiText( wfEscapeWikiText( $result->getMessage() ) ); } else { $importer->setRevisionHandler( "wfImportOldRevision" ); $result = $importer->doImport(); if( WikiError::isError( $result ) ) { $wgOut->addHTML( "

" . wfMsg( "importfailed", - htmlspecialchars( $result->toString() ) ) . "

" ); + htmlspecialchars( $result->getMessage() ) ) . "

" ); } else { # Success! $wgOut->addHTML( "

" . wfMsg( "importsuccess" ) . "

" ); diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 56138e98b0..4ebcb3623a 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -261,7 +261,7 @@ class PreferencesForm { # User can come back through the confirmation URL to re-enable email. $result = $wgUser->sendConfirmationMail(); if( WikiError::isError( $result ) ) { - $error = wfMsg( 'mailerror', $result->toString() ); + $error = wfMsg( 'mailerror', $result->getMessage() ); } else { $error = wfMsg( 'eauthentsent', $wgUser->getName() ); } diff --git a/includes/WikiError.php b/includes/WikiError.php index 65a64556b2..ece931f438 100644 --- a/includes/WikiError.php +++ b/includes/WikiError.php @@ -37,10 +37,19 @@ class WikiError { /** * @return string Plaintext error message to display */ - function toString() { + function getMessage() { return $this->mMessage; } + /** + * In following PEAR_Error model this could be formatted differently, + * but so far it's not. + * @return string + */ + function toString() { + return $this->getMessage(); + } + /** * Returns true if the given object is a WikiError-descended * error object, false otherwise. @@ -83,9 +92,9 @@ class WikiXmlError extends WikiError { xml_parser_free( $parser ); } - function toString() { + function getMessage() { return $this->mMessage . ': ' . xml_error_string( $this->mXmlError ); } } -?> \ No newline at end of file +?>