summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-03-05 09:06:02 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-03-05 09:06:02 +0100
commit0edd6983ba69e8195fa7cade96eca27df9ebf237 (patch)
treee0a5a8ee7fac4c7ce9d308419d13dbca13a7a609 /includes
parent8ef4b96a9b23b2cfc0eed4da0d6d324da9f9da2f (diff)
Update to MediaWiki 1.20.3
Diffstat (limited to 'includes')
-rw-r--r--includes/AutoLoader.php1
-rw-r--r--includes/DefaultSettings.php2
-rw-r--r--includes/HTMLForm.php19
-rw-r--r--includes/Html.php8
-rw-r--r--includes/HttpFunctions.php9
-rw-r--r--includes/Preferences.php7
-rw-r--r--includes/WebRequest.php4
-rw-r--r--includes/api/ApiUnblock.php2
-rw-r--r--includes/context/RequestContext.php33
9 files changed, 66 insertions, 19 deletions
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index d3a2c548..9bdfcd29 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -117,6 +117,7 @@ $wgAutoloadLocalClasses = array(
'HistoryBlobStub' => 'includes/HistoryBlob.php',
'Hooks' => 'includes/Hooks.php',
'Html' => 'includes/Html.php',
+ 'HTMLApiField' => 'includes/HTMLForm.php',
'HTMLCheckField' => 'includes/HTMLForm.php',
'HTMLEditTools' => 'includes/HTMLForm.php',
'HTMLFloatField' => 'includes/HTMLForm.php',
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 8216beb8..426c11ad 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -59,7 +59,7 @@ if( !defined( 'MEDIAWIKI' ) ) {
$wgConf = new SiteConfiguration;
/** MediaWiki version number */
-$wgVersion = '1.20.2';
+$wgVersion = '1.20.3';
/** Name of the site. It must be changed in LocalSettings.php */
$wgSitename = 'MediaWiki';
diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index 5c00b9f6..6f89d5b8 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -96,6 +96,7 @@ class HTMLForm extends ContextSource {
// A mapping of 'type' inputs onto standard HTMLFormField subclasses
static $typeMappings = array(
+ 'api' => 'HTMLApiField',
'text' => 'HTMLTextField',
'textarea' => 'HTMLTextAreaField',
'select' => 'HTMLSelectField',
@@ -2425,3 +2426,21 @@ class HTMLEditTools extends HTMLFormField {
return $msg;
}
}
+
+class HTMLApiField extends HTMLFormField {
+ public function getTableRow( $value ) {
+ return '';
+ }
+
+ public function getDiv( $value ) {
+ return $this->getTableRow( $value );
+ }
+
+ public function getRaw( $value ) {
+ return $this->getTableRow( $value );
+ }
+
+ public function getInputHTML( $value ) {
+ return '';
+ }
+}
diff --git a/includes/Html.php b/includes/Html.php
index 83af24af..b33d6fbb 100644
--- a/includes/Html.php
+++ b/includes/Html.php
@@ -479,7 +479,13 @@ class Html {
# server-side validation. Opera is the only other implementation at
# this time, and has ugly UI, so just kill the feature entirely until
# we have at least one good implementation.
- if ( in_array( $key, array( 'max', 'min', 'pattern', 'required', 'step' ) ) ) {
+
+ # As the default value of "1" for "step" rejects decimal
+ # numbers to be entered in 'type="number"' fields, allow
+ # the special case 'step="any"'.
+
+ if ( in_array( $key, array( 'max', 'min', 'pattern', 'required' ) ) ||
+ $key === 'step' && $value !== 'any' ) {
continue;
}
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 8453e62c..8e48da46 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -716,13 +716,8 @@ class CurlHttpRequest extends MWHttpRequest {
}
$this->curlOptions[CURLOPT_USERAGENT] = $this->reqHeaders['User-Agent'];
- if ( isset( $this->sslVerifyHost ) ) {
- $this->curlOptions[CURLOPT_SSL_VERIFYHOST] = $this->sslVerifyHost;
- }
-
- if ( isset( $this->sslVerifyCert ) ) {
- $this->curlOptions[CURLOPT_SSL_VERIFYPEER] = $this->sslVerifyCert;
- }
+ $this->curlOptions[CURLOPT_SSL_VERIFYHOST] = $this->sslVerifyHost ? 2 : 0;
+ $this->curlOptions[CURLOPT_SSL_VERIFYPEER] = $this->sslVerifyCert;
if ( $this->caInfo ) {
$this->curlOptions[CURLOPT_CAINFO] = $this->caInfo;
diff --git a/includes/Preferences.php b/includes/Preferences.php
index 216ba48c..db231573 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -1246,6 +1246,13 @@ class Preferences {
$formDescriptor = array_diff_key( $formDescriptor, $removeKeys );
}
+ // Remove type=api preferences. They are not intended for rendering in the form.
+ foreach ( $formDescriptor as $name => $info ) {
+ if ( isset( $info['type'] ) && $info['type'] === 'api' ) {
+ unset( $formDescriptor[$name] );
+ }
+ }
+
/**
* @var $htmlForm PreferencesForm
*/
diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index 2cc6338b..96279fb2 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -1297,6 +1297,10 @@ class FauxRequest extends WebRequest {
return $this->wasPosted;
}
+ public function getCookie( $key, $prefix = null, $default = null ) {
+ return $default;
+ }
+
public function checkSessionCookie() {
return false;
}
diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php
index e34771fc..ff9ac474 100644
--- a/includes/api/ApiUnblock.php
+++ b/includes/api/ApiUnblock.php
@@ -79,7 +79,7 @@ class ApiUnblock extends ApiBase {
$res['id'] = $block->getId();
$target = $block->getType() == Block::TYPE_AUTO ? '' : $block->getTarget();
- $res['user'] = $target;
+ $res['user'] = $target instanceof User ? $target->getName() : $target;
$res['userid'] = $target instanceof User ? $target->getId() : 0;
$res['reason'] = $params['reason'];
$this->getResult()->addValue( null, $this->getModuleName(), $res );
diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php
index 1ffbc08c..9e7837d9 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -261,21 +261,33 @@ class RequestContext implements IContextSource {
}
/**
- * Get the Language object
+ * Get the Language object.
+ * Initialization of user or request objects can depend on this.
*
* @return Language
* @since 1.19
*/
public function getLanguage() {
- if ( $this->lang === null ) {
+ if ( isset( $this->recursion ) ) {
+ trigger_error( "Recursion detected in " . __METHOD__, E_USER_WARNING );
+ $e = new Exception;
+ wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() );
+
+ global $wgLanguageCode;
+ $code = ( $wgLanguageCode ) ? $wgLanguageCode : 'en';
+ $this->lang = Language::factory( $code );
+ } elseif ( $this->lang === null ) {
+ $this->recursion = true;
+
global $wgLanguageCode, $wgContLang;
- $code = $this->getRequest()->getVal(
- 'uselang',
- $this->getUser()->getOption( 'language' )
- );
+
+ $request = $this->getRequest();
+ $user = $this->getUser();
+
+ $code = $request->getVal( 'uselang', $user->getOption( 'language' ) );
$code = self::sanitizeLangCode( $code );
- wfRunHooks( 'UserGetLanguageObject', array( $this->getUser(), &$code ) );
+ wfRunHooks( 'UserGetLanguageObject', array( $user, &$code, $this ) );
if( $code === $wgLanguageCode ) {
$this->lang = $wgContLang;
@@ -283,7 +295,10 @@ class RequestContext implements IContextSource {
$obj = Language::factory( $code );
$this->lang = $obj;
}
+
+ unset( $this->recursion );
}
+
return $this->lang;
}
@@ -378,8 +393,8 @@ class RequestContext implements IContextSource {
* language or a uselang param in the fauxrequest data may change the lang
* - Skin will be based on the anonymous user, should be the wiki's default skin
*
- * @param $title Title Title to use for the extraneous request
- * @param $request Mixed A WebRequest or data to use for a FauxRequest
+ * @param Title $title Title to use for the extraneous request
+ * @param WebRequest|array $request A WebRequest or data to use for a FauxRequest
* @return RequestContext
*/
public static function newExtraneousContext( Title $title, $request=array() ) {