20 private $extName =
'unknown';
31 $this->isSkin = str_ends_with(
$path,
"/skin.json" );
33 preg_match(
"!/([^/]*)/[^/]*.json$!",
$path, $m );
35 $this->extName = $m[1];
38 $this->error = $error;
40 parent::__construct(
"Error Loading extension. Unable to open file $path: $error" );
50 private function renderHtml() {
51 if ( !headers_sent() ) {
53 header(
'Content-Type: text/html; charset=UTF-8' );
60 'ExtensionConfigError',
63 'path' => $this->path,
64 'type' => $this->isSkin ?
'skin' :
'extension',
65 'error' => $this->error,
66 'extName' => $this->extName,
67 'trace' => $this->getTraceAsString(),
68 'mwLogo' => $this->getMWLogo(),
71 }
catch ( Exception $e ) {
72 echo
'Error: ' . htmlspecialchars( $e->getMessage() );
79 private function renderText() {
80 $type = $this->isSkin ?
'skin' :
'extension';
81 echo
"Error: The $this->extName $type cannot be loaded. "
82 .
"Check that all of its files are installed properly.\n\n";
83 echo $this->getTraceAsString();
100 trigger_error( $this->getMessage(), E_USER_ERROR );
108 private function getMWLogo() {
110 $suffix =
"/resources/assets/mediawiki.png";
116 foreach ( array_filter( explode(
'/', $_SERVER[
'PHP_SELF'] ) ) as $part ) {
117 if ( !preg_match(
'/\.php$/', $part ) ) {
124 return $path . $suffix;
const MW_VERSION
The running version of MediaWiki.
A BagOStuff object with no objects in it.
static header( $code)
Output an HTTP status code header.
Thrown when ExtensionRegistry cannot open the extension.json or skin.json file.
__construct( $path, $error)
render()
Output an error response and exit.
$wgResourceBasePath
Config variable stub for the ResourceBasePath setting, for use by phpdoc and IDEs.