Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/162754
Change subject: Don't rely on $wgTitle in WebRequest
......................................................................
Don't rely on $wgTitle in WebRequest
All callers have been updated to provide their own getLocalUrl() calls as
appropriate, so deprecate calling appendQueryValue() and appendQueryArray()
with $onlyquery = false.
appendQuery() is now unused and deprecated as it always assumed $onlyquery =
false
Change-Id: I142195c39f278165118a52143031008d9c68e01a
---
M includes/WebRequest.php
1 file changed, 12 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/54/162754/1
diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index b187c4a..9753136 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -705,21 +705,22 @@
/**
* Take an arbitrary query and rewrite the present URL to include it
+ * @deprecated Use appendQueryValue/appendQueryArray instead
* @param string $query Query string fragment; do not include initial
'?'
- *
* @return string
*/
public function appendQuery( $query ) {
+ wfDeprecated( __METHOD__, '1.25' );
return $this->appendQueryArray( wfCgiToArray( $query ) );
}
/**
* @param string $key
* @param string $value
- * @param bool $onlyquery
+ * @param bool $onlyquery [deprecated]
* @return string
*/
- public function appendQueryValue( $key, $value, $onlyquery = false ) {
+ public function appendQueryValue( $key, $value, $onlyquery = true ) {
return $this->appendQueryArray( array( $key => $value ),
$onlyquery );
}
@@ -727,16 +728,21 @@
* Appends or replaces value of query variables.
*
* @param array $array Array of values to replace/add to query
- * @param bool $onlyquery Whether to only return the query string and
not the complete URL
+ * @param bool $onlyquery Whether to only return the query string and
not the complete URL [deprecated]
* @return string
*/
- public function appendQueryArray( $array, $onlyquery = false ) {
+ public function appendQueryArray( $array, $onlyquery = true ) {
global $wgTitle;
$newquery = $this->getQueryValues();
unset( $newquery['title'] );
$newquery = array_merge( $newquery, $array );
$query = wfArrayToCgi( $newquery );
- return $onlyquery ? $query : $wgTitle->getLocalURL( $query );
+ if ( $onlyquery ) {
+ wfDeprecated( __METHOD__, '1.25' );
+ return $wgTitle->getLocalURL( $query );
+ }
+
+ return $query;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/162754
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I142195c39f278165118a52143031008d9c68e01a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits