diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
commit | 91e194556c52d2f354344f930419eef2dd6267f0 (patch) | |
tree | 0cd12490d3cd3499274017c9b799d0f738d3719e /includes/resourceloader | |
parent | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff) |
Update to MediaWiki 1.21.2
Diffstat (limited to 'includes/resourceloader')
-rw-r--r-- | includes/resourceloader/ResourceLoader.php | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 27f682c2..4e047be4 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -175,7 +175,7 @@ class ResourceLoader { $cache->set( $key, $result ); } catch ( Exception $exception ) { // Return exception as a comment - $result = $this->makeComment( $exception->__toString() ); + $result = $this->formatException( $exception ); $this->hasErrors = true; } @@ -461,7 +461,7 @@ class ResourceLoader { $this->preloadModuleInfo( array_keys( $modules ), $context ); } catch( Exception $e ) { // Add exception to the output as a comment - $errors .= $this->makeComment( $e->__toString() ); + $errors .= $this->formatException( $e ); $this->hasErrors = true; } @@ -479,7 +479,7 @@ class ResourceLoader { $mtime = max( $mtime, $module->getModifiedTime( $context ) ); } catch ( Exception $e ) { // Add exception to the output as a comment - $errors .= $this->makeComment( $e->__toString() ); + $errors .= $this->formatException( $e ); $this->hasErrors = true; } } @@ -663,6 +663,22 @@ class ResourceLoader { } /** + * Handle exception display + * + * @param Exception $e to be shown to the user + * @return string sanitized text that can be returned to the user + */ + protected function formatException( $e ) { + global $wgShowExceptionDetails; + + if ( $wgShowExceptionDetails ) { + return $this->makeComment( $e->__toString() ); + } else { + return $this->makeComment( wfMessage( 'internalerror' )->text() ); + } + } + + /** * Generates code for a response * * @param $context ResourceLoaderContext: Context in which to generate a response @@ -686,7 +702,7 @@ class ResourceLoader { $blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() ); } catch ( Exception $e ) { // Add exception to the output as a comment - $exceptions .= $this->makeComment( $e->__toString() ); + $exceptions .= $this->formatException( $e ); $this->hasErrors = true; } } else { @@ -792,7 +808,7 @@ class ResourceLoader { } } catch ( Exception $e ) { // Add exception to the output as a comment - $exceptions .= $this->makeComment( $e->__toString() ); + $exceptions .= $this->formatException( $e ); $this->hasErrors = true; // Register module as missing |