56 if ( !
$request->checkUrlExtension() ) {
60 if ( $this->
getOutput()->checkLastModified( $this->
page->getTouched() ) ) {
65 if ( $gen ==
'css' || $gen ==
'js' ) {
71 $maxage =
$request->getInt(
'maxage', $config->get(
'SquidMaxage' ) );
72 $smaxage =
$request->getIntOrNull(
'smaxage' );
73 if ( $smaxage ===
null ) {
74 if ( $contentType ==
'text/css' || $contentType ==
'text/javascript' ) {
78 $smaxage = intval( $config->get(
'ForcedRawSMaxage' ) );
87 if ( $config->get(
'UseKeyHeader' ) ) {
93 $privateCache = !User::isEveryoneAllowed(
'read' ) &&
94 ( $smaxage == 0 || MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent() );
96 $privateCache = $privateCache || $this->
getUser()->isLoggedIn();
97 $mode = $privateCache ?
'private' :
'public';
99 'Cache-Control: ' . $mode .
', s-maxage=' . $smaxage .
', max-age=' . $maxage
107 if (
$title->isCssJsSubpage() && $contentType !==
'text/x-wiki' ) {
110 $rootPage = strtok(
$title->getText(),
'/' );
111 $userFromTitle = User::newFromName( $rootPage,
'usable' );
112 if ( !$userFromTitle || $userFromTitle->getId() === 0 ) {
113 $log = LoggerFactory::getInstance(
"security" );
115 "Unsafe JS/CSS/Json load - {user} loaded {title} with {ctype}",
118 'title' =>
$title->getPrefixedDBKey(),
119 'ctype' => $contentType,
122 $msg =
wfMessage(
'unregistered-user-config' );
134 $contentType ===
'text/javascript' &&
137 !in_array(
'sysop',
$title->getRestrictions(
'edit' ) ) &&
138 !in_array(
'editprotected',
$title->getRestrictions(
'edit' ) )
141 $log = LoggerFactory::getInstance(
"security" );
142 $log->info(
"Blocked loading unprotected JS {title} for {user}",
145 'title' =>
$title->getPrefixedDBKey(),
151 $response->header(
'Content-type: ' . $contentType .
'; charset=UTF-8' );
159 if ( $text ===
false && $contentType ==
'text/x-wiki' ) {
165 if ( !Hooks::run(
'RawPageViewBeforeOutput', [ &$rawAction, &$text ] ) ) {
166 wfDebug( __METHOD__ .
": RawPageViewBeforeOutput hook broke raw page output.\n" );
192 if ( $text ===
false ) {
200 $request->response()->header(
"Last-modified: $lastmod" );
210 wfHttpError( 415,
"Unsupported Media Type",
"The requested page uses the content model `"
211 .
$content->getModel() .
"` which is not supported via this interface." );
230 if ( $text !==
false && $text !==
'' &&
$request->getVal(
'templates' ) ===
'expand' ) {
247 $oldid = $this->
getRequest()->getInt(
'oldid' );
248 switch ( $this->
getRequest()->getText(
'direction' ) ) {
250 # output next revision, or nothing if there isn't one
253 $nextid = $this->
getTitle()->getNextRevisionID( $oldid );
255 $oldid = $nextid ?: -1;
258 # output previous revision, or nothing if there isn't one
260 # get the current revision so we can get the penultimate one
261 $oldid = $this->
page->getLatest();
263 $previd = $this->
getTitle()->getPreviousRevisionID( $oldid );
264 $oldid = $previd ?: -1;
280 $ctype = $this->
getRequest()->getVal(
'ctype' );
282 if ( $ctype ==
'' ) {
284 if ( $gen ==
'js' ) {
285 $ctype =
'text/javascript';
286 } elseif ( $gen ==
'css' ) {
291 $allowedCTypes = [
'text/x-wiki',
'text/javascript',
'text/css',
'application/x-zope-edit' ];
292 if ( $ctype ==
'' || !in_array( $ctype, $allowedCTypes ) ) {
293 $ctype =
'text/x-wiki';
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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.
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
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.
Show an error that looks like an HTTP server error.
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
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 an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
namespace and then decline to actually register it file or subcat img or subcat $title
error also a ContextSource you ll probably need to make sure the header is varied on $request
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