41 public function header( $string, $replace =
true, $http_response_code = null ) {
42 header( $string, $replace, $http_response_code );
52 foreach ( headers_list()
as $header ) {
53 list(
$name, $val ) = explode(
':', $header, 2 );
54 if ( !strcasecmp(
$name, $key ) ) {
76 return headers_sent();
101 'prefix' => $wgCookiePrefix,
102 'domain' => $wgCookieDomain,
103 'path' => $wgCookiePath,
104 'secure' => $wgCookieSecure,
105 'httpOnly' => $wgCookieHttpOnly,
109 if ( $expire === null ) {
111 } elseif ( $expire == 0 && $wgCookieExpiration != 0 ) {
115 $func =
$options[
'raw'] ?
'setrawcookie' :
'setcookie';
120 'name' => (
string)$cookie,
121 'value' => (
string)
$value,
122 'expire' => (int)$expire,
125 'secure' => (
bool)
$options[
'secure'],
126 'httpOnly' => (bool)
$options[
'httpOnly'],
130 $key =
"{$data['name']}\n{$data['domain']}\n{$data['path']}";
134 if ( isset( $_COOKIE[$cookie] ) && !array_key_exists( $key, self::$setCookies ) ) {
135 self::$setCookies[$key] = [];
139 $deleting = ( $data[
'value'] ===
'' || $data[
'expire'] > 0 && $data[
'expire'] <= time() );
141 if ( $deleting && !isset( self::$setCookies[$key] ) ) {
142 wfDebugLog(
'cookie',
'already deleted ' . $func .
': "' . implode(
'", "', $data ) .
'"' );
143 } elseif ( !$deleting && isset( self::$setCookies[$key] ) &&
144 self::$setCookies[$key] === [ $func, $data ]
146 wfDebugLog(
'cookie',
'already set ' . $func .
': "' . implode(
'", "', $data ) .
'"' );
148 wfDebugLog(
'cookie', $func .
': "' . implode(
'", "', $data ) .
'"' );
149 if ( call_user_func_array( $func, array_values( $data ) ) ) {
150 self::$setCookies[$key] = $deleting ? null : [ $func, $data ];
176 return (
bool)self::$setCookies;
194 public function header( $string, $replace =
true, $http_response_code = null ) {
195 if ( substr( $string, 0, 5 ) ==
'HTTP/' ) {
196 $parts = explode(
' ', $string, 3 );
197 $this->
code = intval( $parts[1] );
199 list( $key, $val ) = array_map(
'trim', explode(
":", $string, 2 ) );
201 $key = strtoupper( $key );
203 if ( $replace || !isset( $this->
headers[$key] ) ) {
208 if ( $http_response_code !== null ) {
209 $this->
code = intval( $http_response_code );
230 $key = strtoupper( $key );
232 if ( isset( $this->
headers[$key] ) ) {
260 'prefix' => $wgCookiePrefix,
261 'domain' => $wgCookieDomain,
262 'path' => $wgCookiePath,
263 'secure' => $wgCookieSecure,
264 'httpOnly' => $wgCookieHttpOnly,
268 if ( $expire === null ) {
270 } elseif ( $expire == 0 && $wgCookieExpiration != 0 ) {
276 'expire' => (
int)$expire,
277 'path' => (
string)$options[
'path'],
278 'domain' => (
string)$options[
'domain'],
279 'secure' => (bool)$options[
'secure'],
280 'httpOnly' => (
bool)$options[
'httpOnly'],
281 'raw' => (bool)$options[
'raw'],
getHeader($key)
Get a response header.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
header($string, $replace=true, $http_response_code=null)
Output an HTTP header, wrapper for PHP's header()
hasCookies()
Checks whether this request is performing cookie operations.
setCookie($name, $value, $expire=0, $options=[])
Set the browser cookie.
$wgCookieDomain
Set to set an explicit domain on the login cookies eg, "justthis.domain.org" or ".any.subdomain.net".
$wgCookiePrefix
Cookies generated by MediaWiki have names starting with this prefix.
static header($code)
Output an HTTP status code header.
$wgCookieHttpOnly
Set authentication cookies to HttpOnly to prevent access by JavaScript, in browsers that support this...
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
when a variable name is used in a it is silently declared as a new local masking the global
wfDebugLog($logGroup, $text, $dest= 'all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
setCookie($name, $value, $expire=0, $options=[])
getStatusCode()
Get the HTTP response code, null if not set.
statusHeader($code)
Output an HTTP status code header.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add headers
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 as context as context $options
headersSent()
Test if headers have been sent.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
header($string, $replace=true, $http_response_code=null)
Stores a HTTP header.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
$wgCookieExpiration
Default cookie lifetime, in seconds.
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
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a third party developers and local administrators to define code that will be run at certain points in the mainline code
$wgCookiePath
Set this variable if you want to restrict cookies to a certain path within the domain specified by $w...
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack ...
clearCookie($name, $options=[])
Unset a browser cookie.
it sets a lot of them automatically from cookies
static array $setCookies
Used to record set cookies, because PHP's setcookie() will happily send an identical Set-Cookie to th...
Allows to change the fields on the form that will be generated $name