- switch ( $this->entryPoint ) {
- case 'cli':
- $finalOutput = $longText;
- break;
- case 'index.php':
- case 'mw-config/index.php':
- $this->outputHTMLHeader();
- $finalOutput = $this->getIndexErrorOutput( $title, $longHtml, $shortText );
- break;
- case 'load.php':
- $this->outputHTMLHeader();
- $finalOutput = "/* $shortText */";
- break;
- default:
- $this->outputHTMLHeader();
- // Handle everything that's not index.php
- $finalOutput = $shortText;
+ if ( $this->format === 'html' ) {
+ // Used by index.php and mw-config/index.php
+ $this->outputHTMLHeader();
+ $finalOutput = $this->getIndexErrorOutput( $title, $longHtml, $shortText );
+ } else {
+ // Used by Maintenance.php (CLI)
+ $finalOutput = $longText;