dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Exit maintenance script with non-zero status if execute() returns false"
[lhc/web/wiklou.git]
/
includes
/
WebRequest.php
diff --git
a/includes/WebRequest.php
b/includes/WebRequest.php
index
6f0307d
..
b499d86
100644
(file)
--- a/
includes/WebRequest.php
+++ b/
includes/WebRequest.php
@@
-28,6
+28,9
@@
use MediaWiki\Session\Session;
use MediaWiki\Session\SessionId;
use MediaWiki\Session\SessionManager;
use MediaWiki\Session\SessionId;
use MediaWiki\Session\SessionManager;
+// The point of this class is to be a wrapper around super globals
+// phpcs:disable MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals
+
/**
* The WebRequest class encapsulates getting at data passed in the
* URL or via a POSTed form stripping illegal input characters and
/**
* The WebRequest class encapsulates getting at data passed in the
* URL or via a POSTed form stripping illegal input characters and
@@
-126,7
+129,7
@@
class WebRequest {
$a = parse_url( $url );
Wikimedia\restoreWarnings();
if ( $a ) {
$a = parse_url( $url );
Wikimedia\restoreWarnings();
if ( $a ) {
- $path =
isset( $a['path'] ) ? $a['path'] :
'';
+ $path =
$a['path'] ??
'';
global $wgScript;
if ( $path == $wgScript && $want !== 'all' ) {
global $wgScript;
if ( $path == $wgScript && $want !== 'all' ) {
@@
-141,7
+144,7
@@
class WebRequest {
$router->add( "$wgScript/$1" );
if ( isset( $_SERVER['SCRIPT_NAME'] )
$router->add( "$wgScript/$1" );
if ( isset( $_SERVER['SCRIPT_NAME'] )
- && preg_match( '/\.php
5?
/', $_SERVER['SCRIPT_NAME'] )
+ && preg_match( '/\.php/', $_SERVER['SCRIPT_NAME'] )
) {
# Check for SCRIPT_NAME, we handle index.php explicitly
# But we do have some other .php files such as img_auth.php
) {
# Check for SCRIPT_NAME, we handle index.php explicitly
# But we do have some other .php files such as img_auth.php
@@
-272,8
+275,7
@@
class WebRequest {
// This method is called from various error handlers and should be kept simple.
if ( !self::$reqId ) {
// This method is called from various error handlers and should be kept simple.
if ( !self::$reqId ) {
- self::$reqId = isset( $_SERVER['UNIQUE_ID'] )
- ? $_SERVER['UNIQUE_ID'] : wfRandomString( 24 );
+ self::$reqId = $_SERVER['UNIQUE_ID'] ?? wfRandomString( 24 );
}
return self::$reqId;
}
return self::$reqId;
@@
-432,7
+434,7
@@
class WebRequest {
* selected by a drop-down menu). For freeform input, see getText().
*
* @param string $name
* selected by a drop-down menu). For freeform input, see getText().
*
* @param string $name
- * @param string $default Optional default (or null)
+ * @param string
|null
$default Optional default (or null)
* @return string|null
*/
public function getVal( $name, $default = null ) {
* @return string|null
*/
public function getVal( $name, $default = null ) {
@@
-455,7
+457,7
@@
class WebRequest {
* @return mixed Old value if one was present, null otherwise
*/
public function setVal( $key, $value ) {
* @return mixed Old value if one was present, null otherwise
*/
public function setVal( $key, $value ) {
- $ret =
isset( $this->data[$key] ) ? $this->data[$key] :
null;
+ $ret =
$this->data[$key] ??
null;
$this->data[$key] = $value;
return $ret;
}
$this->data[$key] = $value;
return $ret;
}
@@
-654,6
+656,18
@@
class WebRequest {
return $_GET;
}
return $_GET;
}
+ /**
+ * Get the values passed via POST.
+ * No transformation is performed on the values.
+ *
+ * @since 1.32
+ * @codeCoverageIgnore
+ * @return array
+ */
+ public function getPostValues() {
+ return $_POST;
+ }
+
/**
* Return the contents of the Query with no decoding. Use when you need to
* know exactly what was sent, e.g. for an OAuth signature over the elements.
/**
* Return the contents of the Query with no decoding. Use when you need to
* know exactly what was sent, e.g. for an OAuth signature over the elements.
@@
-699,7
+713,7
@@
class WebRequest {
* @return string
*/
public function getMethod() {
* @return string
*/
public function getMethod() {
- return
isset( $_SERVER['REQUEST_METHOD'] ) ? $_SERVER['REQUEST_METHOD'] :
'GET';
+ return
$_SERVER['REQUEST_METHOD'] ??
'GET';
}
/**
}
/**