MediaWiki
master
BadTitleError.php
Go to the documentation of this file.
1
<?php
21
use
MediaWiki\Message\Message
;
22
use
MediaWiki\Title\MalformedTitleException
;
23
37
class
BadTitleError
extends
ErrorPageError
{
45
public
function
__construct
( $msg =
'badtitletext'
,
$params
= [] ) {
46
if
(
$msg
instanceof
MalformedTitleException
) {
47
$errorMessage =
$msg
->getErrorMessage();
48
if
( !$errorMessage ) {
49
parent::__construct(
'badtitle'
,
'badtitletext'
, [] );
50
}
else
{
51
$errorMessageParams =
$msg
->getErrorMessageParameters();
52
parent::__construct(
'badtitle'
, $errorMessage, $errorMessageParams );
53
}
54
}
else
{
55
parent::__construct(
'badtitle'
,
$msg
,
$params
);
56
}
57
}
58
62
public
function
report
( $action = self::SEND_OUTPUT ) {
63
global
$wgOut
;
64
65
$wgOut
->setStatusCode( 404 );
66
67
parent::report( self::STAGE_OUTPUT );
68
69
// Unconditionally cache the error for an hour, see T316932
70
$wgOut
->enableClientCache();
71
$wgOut
->setCdnMaxage( 3600 );
72
73
if
( $action === self::SEND_OUTPUT ) {
74
$wgOut
->output();
75
}
76
}
77
}
$wgOut
if(!defined( 'MW_NO_SESSION') &&MW_ENTRY_POINT !=='cli' $wgOut
Definition
Setup.php:538
$params
array $params
The job parameters.
Definition
UploadJobTrait.php:45
BadTitleError
Show an error page on a badtitle.
Definition
BadTitleError.php:37
BadTitleError\__construct
__construct( $msg='badtitletext', $params=[])
Definition
BadTitleError.php:45
BadTitleError\report
report( $action=self::SEND_OUTPUT)
to override
Definition
BadTitleError.php:62
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition
ErrorPageError.php:32
ErrorPageError\$msg
string MessageSpecifier $msg
Definition
ErrorPageError.php:39
MediaWiki\Message\Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition
Message.php:158
MediaWiki\Title\MalformedTitleException
MalformedTitleException is thrown when a TitleParser is unable to parse a title string.
Definition
MalformedTitleException.php:32
includes
exception
BadTitleError.php
Generated on Fri Jul 26 2024 23:23:12 for MediaWiki by
1.10.0