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
66 $gen = $request->getVal(
'gen' );
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 );
94 $response->header(
'Content-type: ' . $contentType .
'; charset=UTF-8' );
95 # Output may contain user-specific data;
96 # vary generated content for open sessions on private wikis
100 $privateCache = $privateCache ?: $this->
getUser()->isLoggedIn();
101 # allow the client to cache this for 24 hours
102 $mode = $privateCache ?
'private' :
'public';
104 'Cache-Control: ' . $mode .
', s-maxage=' . $smaxage .
', max-age=' . $maxage
109 if ( $text ===
false && $contentType ==
'text/x-wiki' ) {
110 # Don't return a 404 response for CSS or JavaScript;
111 # 404s aren't generally cached and it would create
112 # extra hits when user CSS/JS are on and the user doesn't
114 $response->header(
'HTTP/1.x 404 Not Found' );
117 if ( !
wfRunHooks(
'RawPageViewBeforeOutput',
array( &$this, &$text ) ) ) {
118 wfDebug( __METHOD__ .
": RawPageViewBeforeOutput hook broke raw page output.\n" );
149 if ( $text ===
false ) {
157 $request->response()->header(
"Last-modified: $lastmod" );
160 $content =
$rev->getContent();
162 if ( $content ===
null ) {
167 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
168 . $content->getModel() .
"` which is not supported via this interface." );
172 $section = $request->getIntOrNull(
'section' );
174 $content = $content->getSection(
$section );
177 if ( $content ===
null || $content ===
false ) {
181 $text = $content->getNativeData();
187 if ( $text !==
false && $text !==
'' && $request->getVal(
'templates' ) ===
'expand' ) {
204 $oldid = $this->
getRequest()->getInt(
'oldid' );
205 switch ( $this->
getRequest()->getText(
'direction' ) ) {
207 # output next revision, or nothing if there isn't one
209 $oldid = $this->
getTitle()->getNextRevisionID( $oldid );
211 $oldid = $oldid ? $oldid : -1;
214 # output previous revision, or nothing if there isn't one
216 # get the current revision so we can get the penultimate one
217 $oldid = $this->
page->getLatest();
219 $prev = $this->
getTitle()->getPreviousRevisionID( $oldid );
220 $oldid = $prev ? $prev : -1;
236 $ctype = $this->
getRequest()->getVal(
'ctype' );
238 if ( $ctype ==
'' ) {
240 if ( $gen ==
'js' ) {
241 $ctype =
'text/javascript';
242 } elseif ( $gen ==
'css' ) {
247 $allowedCTypes =
array(
'text/x-wiki',
'text/javascript',
'text/css',
'application/x-zope-edit' );
248 if ( $ctype ==
'' || !in_array( $ctype, $allowedCTypes ) ) {
249 $ctype =
'text/x-wiki';
270 parent::__construct(
$page );
272 if ( $request !==
false ) {
284 # Some extensions like to set $mOldId
285 if ( $this->mOldId !==
null ) {
289 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)
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