19 private string $extName =
'unknown';
21 private string $error;
28 $this->isSkin = str_ends_with(
$path,
"/skin.json" );
30 preg_match(
"!/([^/]*)/[^/]*.json$!",
$path, $m );
32 $this->extName = $m[1];
35 $this->error = $error;
37 parent::__construct(
"Error Loading extension. Unable to open file $path: $error" );
47 private function renderHtml() {
48 if ( !headers_sent() ) {
49 HttpStatus::header( 500 );
50 header(
'Content-Type: text/html; charset=UTF-8' );
57 'ExtensionConfigError',
60 'path' => $this->path,
61 'type' => $this->isSkin ?
'skin' :
'extension',
62 'error' => $this->error,
63 'extName' => $this->extName,
64 'trace' => $this->getTraceAsString(),
65 'mwLogo' => $this->getMWLogo(),
68 }
catch ( Exception $e ) {
69 echo
'Error: ' . htmlspecialchars( $e->getMessage() );
76 private function renderText() {
77 $type = $this->isSkin ?
'skin' :
'extension';
78 echo
"Error: The $this->extName $type cannot be loaded. "
79 .
"Check that all of its files are installed properly.\n\n";
80 echo $this->getTraceAsString();
97 trigger_error( $this->getMessage(), E_USER_ERROR );
105 private function getMWLogo() {
107 $suffix =
"/resources/assets/mediawiki.png";
113 foreach ( array_filter( explode(
'/', $_SERVER[
'PHP_SELF'] ) ) as $part ) {
114 if ( !preg_match(
'/\.php$/', $part ) ) {
121 return $path . $suffix;
const MW_VERSION
The running version of MediaWiki.
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.