48 $session =
null, $protocol =
'http'
55 throw new MWException(
"FauxRequest() got bogus data" );
58 if ( $session instanceof
MediaWiki\Session\Session ) {
59 $this->sessionId = $session->getSessionId();
61 $mwsession = SessionManager::singleton()->getEmptySession( $this );
62 $this->sessionId = $mwsession->getSessionId();
63 foreach ( $session as $key =>
$value ) {
64 $mwsession->set( $key,
$value );
66 }
elseif ( $session !==
null ) {
67 throw new MWException(
"FauxRequest() got bogus session" );
84 public function getText( $name, $default =
'' ) {
85 # Override; don't recode since we're using internal data
86 return (
string)$this->
getVal( $name, $default );
108 return $this->
wasPosted ?
'POST' :
'GET';
115 return $this->wasPosted;
118 public function getCookie( $key, $prefix =
null, $default =
null ) {
119 if ( $prefix ===
null ) {
123 $name = $prefix . $key;
124 return $this->cookies[
$name] ?? $default;
143 if ( $prefix ===
null ) {
148 $name = $prefix . $key;
158 $this->requestUrl = $url;
167 if ( $this->requestUrl ===
null ) {
170 return $this->requestUrl;
174 return $this->protocol;
190 foreach ( $headers as $name => $val ) {
200 if ( $this->sessionId !==
null ) {
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgCookiePrefix
Cookies generated by MediaWiki have names starting with this prefix.
WebRequest clone which takes values from a provided array.
setCookie( $key, $value, $prefix=null)
getText( $name, $default='')
getRawPostString()
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
initHeaders()
Initialise the header list.
checkUrlExtension( $extWhitelist=[])
getRawInput()
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
setCookies( $cookies, $prefix=null)
getProtocol()
Get the current URL protocol (http or https)
getMethod()
Get the HTTP method used for this request.
__construct( $data=[], $wasPosted=false, $session=null, $protocol='http')
getCookie( $key, $prefix=null, $default=null)
Get a cookie from the $_COOKIE jar.
getRawQueryString()
FauxRequests shouldn't depend on raw request data (but that could be implemented here)
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
string $protocol
Cached URL protocol.
getSession()
Return the session for this request.
getVal( $name, $default=null)
Fetch a scalar from the input or return $default if it's not set.
Allows to change the fields on the form that will be generated $name
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)