+ public function getWikiText( $shortContext = false, $longContext = false, $lang = null ) {
+ $lang = $this->languageFromParam( $lang );
+
+ $rawErrors = $this->getErrors();
+ if ( count( $rawErrors ) == 0 ) {
+ if ( $this->isOK() ) {
+ $this->fatal( 'internalerror_info',
+ __METHOD__ . " called for a good result, this is incorrect\n" );
+ } else {
+ $this->fatal( 'internalerror_info',
+ __METHOD__ . ": Invalid result object: no error text but not OK\n" );
+ }
+ $rawErrors = $this->getErrors(); // just added a fatal
+ }
+ if ( count( $rawErrors ) == 1 ) {
+ $s = $this->getErrorMessage( $rawErrors[0], $lang )->plain();
+ if ( $shortContext ) {
+ $s = wfMessage( $shortContext, $s )->inLanguage( $lang )->plain();
+ } elseif ( $longContext ) {
+ $s = wfMessage( $longContext, "* $s\n" )->inLanguage( $lang )->plain();
+ }
+ } else {
+ $errors = $this->getErrorMessageArray( $rawErrors, $lang );
+ foreach ( $errors as &$error ) {
+ $error = $error->plain();
+ }
+ $s = '* ' . implode( "\n* ", $errors ) . "\n";
+ if ( $longContext ) {
+ $s = wfMessage( $longContext, $s )->inLanguage( $lang )->plain();
+ } elseif ( $shortContext ) {
+ $s = wfMessage( $shortContext, "\n$s\n" )->inLanguage( $lang )->plain();
+ }