18 private string $extName =
'unknown';
20 private string $error;
27 $this->isSkin = str_ends_with(
$path,
"/skin.json" );
29 preg_match(
"!/([^/]*)/[^/]*.json$!",
$path, $m );
31 $this->extName = $m[1];
34 $this->error = $error;
36 parent::__construct(
"Error Loading extension. Unable to open file $path: $error" );
46 private function renderHtml() {
47 if ( !headers_sent() ) {
48 HttpStatus::header( 500 );
49 header(
'Content-Type: text/html; charset=UTF-8' );
56 'ExtensionConfigError',
59 'path' => $this->path,
60 'type' => $this->isSkin ?
'skin' :
'extension',
61 'error' => $this->error,
62 'extName' => $this->extName,
63 'trace' => $this->getTraceAsString(),
64 'mwLogo' => $this->getMWLogo(),
67 }
catch ( Exception $e ) {
68 echo
'Error: ' . htmlspecialchars( $e->getMessage() );
75 private function renderText() {
76 $type = $this->isSkin ?
'skin' :
'extension';
77 echo
"Error: The $this->extName $type cannot be loaded. "
78 .
"Check that all of its files are installed properly.\n\n";
79 echo $this->getTraceAsString();
96 trigger_error( $this->getMessage(), E_USER_ERROR );
104 private function getMWLogo() {
106 $suffix =
"/resources/assets/mediawiki.png";
112 foreach ( array_filter( explode(
'/', $_SERVER[
'PHP_SELF'] ) ) as $part ) {
113 if ( !preg_match(
'/\.php$/', $part ) ) {
120 return $path . $suffix;
const MW_VERSION
The running version of MediaWiki.
A BagOStuff object with no objects in it.
Thrown when ExtensionRegistry cannot open the extension.json or skin.json file.
__construct(string $path, string $error)
render()
Output an error response and exit.
$wgResourceBasePath
Config variable stub for the ResourceBasePath setting, for use by phpdoc and IDEs.