Go to the documentation of this file.
51 global $wgSquidMaxage, $wgForcedRawSMaxage;
56 if ( !
$request->checkUrlExtension() ) {
60 if ( $this->
getOutput()->checkLastModified( $this->
page->getTouched() ) ) {
64 # special case for 'generated' raw things: user css/js
65 # This is deprecated and will only return empty content
67 $smaxage =
$request->getIntOrNull(
'smaxage' );
69 if ( $gen ==
'css' || $gen ==
'js' ) {
71 if ( $smaxage ===
null ) {
72 $smaxage = $wgSquidMaxage;
80 # Force caching for CSS and JS raw content, default: 5 minutes.
81 # Note: If using a canonical url for userpage css/js, we send an HTCP purge.
82 if ( $smaxage ===
null ) {
83 if ( $contentType ==
'text/css' || $contentType ==
'text/javascript' ) {
84 $smaxage = intval( $wgForcedRawSMaxage );
90 $maxage =
$request->getInt(
'maxage', $wgSquidMaxage );
100 $response->header(
'Content-type: ' . $contentType .
'; charset=UTF-8' );
101 # Output may contain user-specific data;
102 # vary generated content for open sessions on private wikis
106 $privateCache = $privateCache ?: $this->
getUser()->isLoggedIn();
107 # allow the client to cache this for 24 hours
108 $mode = $privateCache ?
'private' :
'public';
110 'Cache-Control: ' . $mode .
', s-maxage=' . $smaxage .
', max-age=' . $maxage
115 if ( $text ===
false && $contentType ==
'text/x-wiki' ) {
116 # Don't return a 404 response for CSS or JavaScript;
117 # 404s aren't generally cached and it would create
118 # extra hits when user CSS/JS are on and the user doesn't
120 $response->header(
'HTTP/1.x 404 Not Found' );
123 if ( !
wfRunHooks(
'RawPageViewBeforeOutput',
array( &$this, &$text ) ) ) {
124 wfDebug( __METHOD__ .
": RawPageViewBeforeOutput hook broke raw page output.\n" );
155 if ( $text ===
false ) {
163 $request->response()->header(
"Last-modified: $lastmod" );
166 $content =
$rev->getContent();
168 if ( $content ===
null ) {
173 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
174 . $content->getModel() .
"` which is not supported via this interface." );
180 $content = $content->getSection(
$section );
183 if ( $content ===
null || $content ===
false ) {
187 $text = $content->getNativeData();
193 if ( $text !==
false && $text !==
'' &&
$request->getVal(
'templates' ) ===
'expand' ) {
210 $oldid = $this->
getRequest()->getInt(
'oldid' );
211 switch ( $this->
getRequest()->getText(
'direction' ) ) {
213 # output next revision, or nothing if there isn't one
215 $oldid = $this->
getTitle()->getNextRevisionID( $oldid );
217 $oldid = $oldid ? $oldid : -1;
220 # output previous revision, or nothing if there isn't one
222 # get the current revision so we can get the penultimate one
223 $oldid = $this->
page->getLatest();
225 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
226 $oldid = $prev ? $prev : -1;
242 $ctype = $this->
getRequest()->getVal(
'ctype' );
244 if ( $ctype ==
'' ) {
246 if ( $gen ==
'js' ) {
247 $ctype =
'text/javascript';
248 } elseif ( $gen ==
'css' ) {
253 $allowedCTypes =
array(
'text/x-wiki',
'text/javascript',
'text/css',
'application/x-zope-edit' );
254 if ( $ctype ==
'' || !in_array( $ctype, $allowedCTypes ) ) {
255 $ctype =
'text/x-wiki';
276 parent::__construct(
$page );
290 # Some extensions like to set $mOldId
291 if ( $this->mOldId !==
null ) {
295 return parent::getOldId();
A simple method to retrieve the plain source of an article, using "action=raw" in the GET request str...
Abstract class for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
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 my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest $request
getOldId()
Get the ID of the revision that should used to get the text.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
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.
__construct(Page $page, $request=false)
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.
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
getContext()
Get the IContextSource in use here.
An IContextSource implementation which will inherit context from another source but allow individual ...
getContentType()
Get the content type to use for the response.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
requiresUnblock()
Whether this action can still be executed by a blocked user.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static singleton()
Get the signleton instance of this class.
onView()
Show something on GET request.
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
getUser()
Shortcut to get the User being used for this instance.
IContextSource $context
IContextSource if specified; otherwise we'll use the Context from the Page $context.
presenting them properly to the user as errors is done by the caller $title
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.
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
Backward compatibility for extensions.
static isEveryoneAllowed( $right)
Check if all users have the given permission.
wfHttpError( $code, $label, $desc)
Provide a simple HTTP error.
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action $page.
getOutput()
Get the OutputPage being used for this instance.
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
requiresWrite()
Whether this action requires the wiki not to be locked.
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 my talk page