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" );
51 private function renderHtml() {
52 if ( !headers_sent() ) {
53 HttpStatus::header( 500 );
54 header(
'Content-Type: text/html; charset=UTF-8' );
61 'ExtensionConfigError',
64 'path' => $this->path,
65 'type' => $this->isSkin ?
'skin' :
'extension',
66 'error' => $this->error,
67 'extName' => $this->extName,
68 'trace' => $this->getTraceAsString(),
69 'mwLogo' => $this->getMWLogo(),
72 }
catch ( Exception $e ) {
73 echo
'Error: ' . htmlspecialchars( $e->getMessage() );
80 private function renderText() {
81 $type = $this->isSkin ?
'skin' :
'extension';
82 echo
"Error: The $this->extName $type cannot be loaded. "
83 .
"Check that all of its files are installed properly.\n\n";
84 echo $this->getTraceAsString();
100 error_log( $this->getMessage() );
109 private function getMWLogo() {
111 $suffix =
"/resources/assets/mediawiki.png";
117 foreach ( array_filter( explode(
'/', $_SERVER[
'PHP_SELF'] ) ) as $part ) {
118 if ( !preg_match(
'/\.php$/', $part ) ) {
125 return $path . $suffix;
130class_alias( MissingExtensionException::class,
'MissingExtensionException' );
const MW_VERSION
The running version of MediaWiki.
if(!defined('MW_SETUP_CALLBACK'))
$wgResourceBasePath
Config variable stub for the ResourceBasePath setting, for use by phpdoc and IDEs.