Go to the documentation of this file.
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" );
158 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
159 .
$content->getModel() .
"` which is not supported via this interface." );
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';
getConfig()
Get the Config object.
A simple method to retrieve the plain source of an article, using "action=raw" in the GET request str...
error also a ContextSource you ll probably need to make sure the header is varied on $request
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.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
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.
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk page
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.