Go to the documentation of this file.
52 $config = $this->context->getConfig();
54 if ( !
$request->checkUrlExtension() ) {
58 if ( $this->
getOutput()->checkLastModified( $this->
page->getTouched() ) ) {
63 if ( $gen ==
'css' || $gen ==
'js' ) {
69 $maxage =
$request->getInt(
'maxage', $config->get(
'SquidMaxage' ) );
70 $smaxage =
$request->getIntOrNull(
'smaxage' );
71 if ( $smaxage ===
null ) {
72 if ( $contentType ==
'text/css' || $contentType ==
'text/javascript' ) {
76 $smaxage = intval( $config->get(
'ForcedRawSMaxage' ) );
85 if ( $config->get(
'UseKeyHeader' ) ) {
89 $response->header(
'Content-type: ' . $contentType .
'; charset=UTF-8' );
95 $privateCache = $privateCache || $this->
getUser()->isLoggedIn();
96 $mode = $privateCache ?
'private' :
'public';
98 'Cache-Control: ' . $mode .
', s-maxage=' . $smaxage .
', max-age=' . $maxage
107 if ( $text ===
false && $contentType ==
'text/x-wiki' ) {
113 if ( !
Hooks::run(
'RawPageViewBeforeOutput', [ &$rawAction, &$text ] ) ) {
114 wfDebug( __METHOD__ .
": RawPageViewBeforeOutput hook broke raw page output.\n" );
140 if ( $text ===
false ) {
148 $request->response()->header(
"Last-modified: $lastmod" );
151 $content =
$rev->getContent();
153 if ( $content ===
null ) {
158 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
159 . $content->getModel() .
"` which is not supported via this interface." );
165 $content = $content->getSection(
$section );
168 if ( $content ===
null || $content ===
false ) {
172 $text = $content->getNativeData();
178 if ( $text !==
false && $text !==
'' &&
$request->getVal(
'templates' ) ===
'expand' ) {
195 $oldid = $this->
getRequest()->getInt(
'oldid' );
196 switch ( $this->
getRequest()->getText(
'direction' ) ) {
198 # output next revision, or nothing if there isn't one
201 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
203 $oldid = $nextid ?: -1;
206 # output previous revision, or nothing if there isn't one
208 # get the current revision so we can get the penultimate one
209 $oldid = $this->
page->getLatest();
211 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
212 $oldid = $previd ?: -1;
228 $ctype = $this->
getRequest()->getVal(
'ctype' );
230 if ( $ctype ==
'' ) {
232 if ( $gen ==
'js' ) {
233 $ctype =
'text/javascript';
234 } elseif ( $gen ==
'css' ) {
239 $allowedCTypes = [
'text/x-wiki',
'text/javascript',
'text/css',
'application/x-zope-edit' ];
240 if ( $ctype ==
'' || !in_array( $ctype, $allowedCTypes ) ) {
241 $ctype =
'text/x-wiki';
A simple method to retrieve the plain source of an article, using "action=raw" in the GET request str...
getOldId()
Get the ID of the revision that should used to get the text.
getName()
Return the name of the action this object responds to.
getRequest()
Get the WebRequest being used for this instance.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getRawText()
Get the text that should be returned, or false if the page or revision was not found.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
getContext()
Get the IContextSource in use here.
getContentType()
Get the content type to use for the response.
namespace and then decline to actually register it file or subcat img or subcat $title
requiresUnblock()
Whether this action can still be executed by a blocked user.
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static singleton()
Get the signleton instance of this class.
onView()
Show something on GET request.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
getUser()
Shortcut to get the User being used for this instance.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
getTitle()
Shortcut to get the Title object from the page.
Content object implementation for representing flat text.
this hook is for auditing only $response
static isEveryoneAllowed( $right)
Check if all users may be assumed to have the given permission.
wfHttpError( $code, $label, $desc)
Provide a simple HTTP error.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
getOutput()
Get the OutputPage being used for this instance.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
requiresWrite()
Whether this action requires the wiki not to be locked.