24 private string $extName =
'unknown';
26 private string $error;
33 $this->isSkin = str_ends_with(
$path,
"/skin.json" );
35 preg_match(
"!/([^/]*)/[^/]*.json$!",
$path, $m );
37 $this->extName = $m[1];
40 $this->error = $error;
42 parent::__construct(
"Error Loading extension. Unable to open file $path: $error" );
52 private function renderHtml() {
53 if ( !headers_sent() ) {
54 HttpStatus::header( 500 );
55 header(
'Content-Type: text/html; charset=UTF-8' );
62 'ExtensionConfigError',
65 'path' => $this->path,
66 'type' => $this->isSkin ?
'skin' :
'extension',
67 'error' => $this->error,
68 'extName' => $this->extName,
69 'trace' => $this->getTraceAsString(),
70 'mwLogo' => $this->getMWLogo(),
73 }
catch ( Exception $e ) {
74 echo
'Error: ' . htmlspecialchars( $e->getMessage() );
81 private function renderText() {
82 $type = $this->isSkin ?
'skin' :
'extension';
83 echo
"Error: The $this->extName $type cannot be loaded. "
84 .
"Check that all of its files are installed properly.\n\n";
85 echo $this->getTraceAsString();
102 trigger_error( $this->getMessage(), E_USER_ERROR );
110 private function getMWLogo() {
112 $suffix =
"/resources/assets/mediawiki.png";
118 foreach ( array_filter( explode(
'/', $_SERVER[
'PHP_SELF'] ) ) as $part ) {
119 if ( !preg_match(
'/\.php$/', $part ) ) {
126 return $path . $suffix;
131class_alias( MissingExtensionException::class,
'MissingExtensionException' );
const MW_VERSION
The running version of MediaWiki.
$wgResourceBasePath
Config variable stub for the ResourceBasePath setting, for use by phpdoc and IDEs.