MediaWiki
1.42.0
BadTitleError.php
Go to the documentation of this file.
1
<?php
21
use
MediaWiki\Title\MalformedTitleException
;
22
36
class
BadTitleError
extends
ErrorPageError
{
44
public
function
__construct
( $msg =
'badtitletext'
,
$params
= [] ) {
45
if
(
$msg
instanceof
MalformedTitleException
) {
46
$errorMessage =
$msg
->getErrorMessage();
47
if
( !$errorMessage ) {
48
parent::__construct(
'badtitle'
,
'badtitletext'
, [] );
49
}
else
{
50
$errorMessageParams =
$msg
->getErrorMessageParameters();
51
parent::__construct(
'badtitle'
, $errorMessage, $errorMessageParams );
52
}
53
}
else
{
54
parent::__construct(
'badtitle'
,
$msg
,
$params
);
55
}
56
}
57
61
public
function
report
( $action = self::SEND_OUTPUT ) {
62
global
$wgOut
;
63
64
$wgOut
->setStatusCode( 404 );
65
66
parent::report( self::STAGE_OUTPUT );
67
68
// Unconditionally cache the error for an hour, see T316932
69
$wgOut
->enableClientCache();
70
$wgOut
->setCdnMaxage( 3600 );
71
72
if
( $action === self::SEND_OUTPUT ) {
73
$wgOut
->output();
74
}
75
}
76
}
$wgOut
if(!defined( 'MW_NO_SESSION') &&MW_ENTRY_POINT !=='cli' $wgOut
Definition
Setup.php:536
$params
array $params
The job parameters.
Definition
UploadJobTrait.php:45
BadTitleError
Show an error page on a badtitle.
Definition
BadTitleError.php:36
BadTitleError\__construct
__construct( $msg='badtitletext', $params=[])
Definition
BadTitleError.php:44
BadTitleError\report
report( $action=self::SEND_OUTPUT)
to override
Definition
BadTitleError.php:61
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition
ErrorPageError.php:30
ErrorPageError\$msg
$msg
Definition
ErrorPageError.php:33
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 Thu Jun 13 2024 13:48:02 for MediaWiki by
1.10.0