wiki.techinc.nl/includes/exception/FatalError.php
Timo Tijhof 480b7341f8 Setup: Move wgArticlePath validation to its main consumer (PathRouter)
The variable is also read in a few other places, such as to
export the value from api.php (siteinfo) and load.php (mw.config)
but those requests don't need to be held back by this extra
logic.

Alternatively, if we really want to require this for all consumption,
we should probably let PathRouter provide the value and require
consumers to use it. E.g. services->getPathRouter->getArticlePath,
or something like that.

As easy first step, I'm moving it to PathRouter, called from
WebRequest::getPathInfo which is still called on all index.php
requests for any wiki page action in any namespace (incl Special)
when the wiki uses anything other than the default 'index.php?title='
article path.

Test Plan:
* Set '$wgArticlePath = 'bla';`
* View /mediawiki/index.php/Main_Page, and observe the fatal
  error message (same as before this change).

Bug: T189966
Change-Id: Id06c2557e2addb58faeef0b6f7767a65b8de55a5
2019-09-25 23:06:52 +00:00

53 lines
1.6 KiB
PHP

<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
/**
* Abort the web request with a custom HTML string that will represent
* the entire response.
*
* This is not caught anywhere in MediaWiki code. It is handled through PHP's
* exception handler, which calls MWExceptionHandler::report.
*
* Unlike MWException, this will not provide error IDs or stack traces.
* It is intended for early installation and configuration problems where
* the exception is all the site administrator needs to know.
*
* @since 1.7
* @ingroup Exception
*/
class FatalError extends MWException {
/**
* Replace our usual detailed HTML response for uncaught exceptions,
* with just the bare message as HTML.
*
* @return string
*/
public function getHTML() {
return $this->getMessage();
}
/**
* @return string
*/
public function getText() {
return $this->getMessage();
}
}