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' );
92 $privateCache = !User::isEveryoneAllowed(
'read' ) &&
93 ( $smaxage == 0 || MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent() );
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' ) {
111 if ( !Hooks::run(
'RawPageViewBeforeOutput', [ &$this, &$text ] ) ) {
112 wfDebug( __METHOD__ .
": RawPageViewBeforeOutput hook broke raw page output.\n" );
138 if ( $text ===
false ) {
146 $request->response()->header(
"Last-modified: $lastmod" );
156 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
157 .
$content->getModel() .
"` which is not supported via this interface." );
176 if ( $text !==
false && $text !==
'' &&
$request->getVal(
'templates' ) ===
'expand' ) {
193 $oldid = $this->
getRequest()->getInt(
'oldid' );
194 switch ( $this->
getRequest()->getText(
'direction' ) ) {
196 # output next revision, or nothing if there isn't one
199 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
201 $oldid = $nextid ?: -1;
204 # output previous revision, or nothing if there isn't one
206 # get the current revision so we can get the penultimate one
207 $oldid = $this->
page->getLatest();
209 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
210 $oldid = $previd ?: -1;
226 $ctype = $this->
getRequest()->getVal(
'ctype' );
228 if ( $ctype ==
'' ) {
230 if ( $gen ==
'js' ) {
231 $ctype =
'text/javascript';
232 } elseif ( $gen ==
'css' ) {
237 $allowedCTypes = [
'text/x-wiki',
'text/javascript',
'text/css',
'application/x-zope-edit' ];
238 if ( $ctype ==
'' || !in_array( $ctype, $allowedCTypes ) ) {
239 $ctype =
'text/x-wiki';
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfHttpError( $code, $label, $desc)
Provide a simple HTTP error.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getTitle()
Shortcut to get the Title object from the page.
getContext()
Get the IContextSource in use here.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
getConfig()
Get the Config object.
static singleton()
Get the signleton instance of this class.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
A simple method to retrieve the plain source of an article, using "action=raw" in the GET request str...
getContentType()
Get the content type to use for the response.
getRawText()
Get the text that should be returned, or false if the page or revision was not found.
getName()
Return the name of the action this object responds to.
requiresWrite()
Whether this action requires the wiki not to be locked.
onView()
Show something on GET request.
requiresUnblock()
Whether this action can still be executed by a blocked user.
getOldId()
Get the ID of the revision that should used to get the text.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
Content object implementation for representing flat text.
when a variable name is used in a it is silently declared as a new local masking the global
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
error also a ContextSource you ll probably need to make sure the header is varied on $request
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' 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 one of or reset my talk page
this hook is for auditing only $response
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
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
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.