// Prevent caching of responses with cookies (T127993)
$headers = [];
foreach ( headers_list() as $header ) {
- list( $name, $value ) = explode( ':', $header, 2 );
- $headers[strtolower( trim( $name ) )][] = trim( $value );
+ $header = explode( ':', $header, 2 );
+
+ // Note: The code below (currently) does not care about value-less headers
+ if ( isset( $header[1] ) ) {
+ $headers[ strtolower( trim( $header[0] ) ) ][] = trim( $header[1] );
+ }
}
if ( isset( $headers['set-cookie'] ) ) {
/**
* Do any deferred updates and clear the list
*
+ * If $stage is self::ALL then the queue of PRESEND updates will be resolved,
+ * followed by the queue of POSTSEND updates
+ *
* @param string $mode Use "enqueue" to use the job queue when possible [Default: "run"]
* @param int $stage DeferredUpdates constant (PRESEND, POSTSEND, or ALL) (since 1.27)
*/
* @param array $existing
* @return array
*/
- function getPropertyDeletions( $existing ) {
+ private function getPropertyDeletions( $existing ) {
return array_diff_assoc( $existing, $this->mProperties );
}
'wgCookieDomain' => $conf->get( 'CookieDomain' ),
'wgCookiePath' => $conf->get( 'CookiePath' ),
'wgCookieExpiration' => $conf->get( 'CookieExpiration' ),
- 'wgResourceLoaderMaxQueryLength' => $conf->get( 'ResourceLoaderMaxQueryLength' ),
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
*/
public function getScript( ResourceLoaderContext $context ) {
global $IP;
+ $conf = $this->getConfig();
+
if ( $context->getOnly() !== 'scripts' ) {
return '/* Requires only=script */';
}
if ( $context->getDebug() ) {
$mwLoaderCode .= file_get_contents( "$IP/resources/src/startup/mediawiki.log.js" );
}
- if ( $this->getConfig()->get( 'ResourceLoaderEnableJSProfiler' ) ) {
+ if ( $conf->get( 'ResourceLoaderEnableJSProfiler' ) ) {
$mwLoaderCode .= file_get_contents( "$IP/resources/src/startup/profiler.js" );
}
// Perform replacements for mediawiki.js
$mwLoaderPairs = [
'$VARS.baseModules' => ResourceLoader::encodeJsonForScript( $this->getBaseModules() ),
+ '$VARS.maxQueryLength' => ResourceLoader::encodeJsonForScript(
+ $conf->get( 'ResourceLoaderMaxQueryLength' )
+ ),
];
$profilerStubs = [
'$CODE.profileExecuteStart();' => 'mw.loader.profiler.onExecuteStart( module );',
'$CODE.profileScriptStart();' => 'mw.loader.profiler.onScriptStart( module );',
'$CODE.profileScriptEnd();' => 'mw.loader.profiler.onScriptEnd( module );',
];
- if ( $this->getConfig()->get( 'ResourceLoaderEnableJSProfiler' ) ) {
+ if ( $conf->get( 'ResourceLoaderEnableJSProfiler' ) ) {
// When profiling is enabled, insert the calls.
$mwLoaderPairs += $profilerStubs;
} else {
// Perform string replacements for startup.js
$pairs = [
'$VARS.wgLegacyJavaScriptGlobals' => ResourceLoader::encodeJsonForScript(
- $this->getConfig()->get( 'LegacyJavaScriptGlobals' )
+ $conf->get( 'LegacyJavaScriptGlobals' )
),
'$VARS.configuration' => ResourceLoader::encodeJsonForScript(
$this->getConfigSettings( $context )
protected function getFormFields() {
global $wgBlockAllowsUTEdit;
+ $this->getOutput()->enableOOUI();
+
$user = $this->getUser();
$suggestedDurations = self::getSuggestedDurations();
'type' => 'radio',
'cssclass' => 'mw-block-editing-restriction',
'options' => [
- $this->msg( 'ipb-sitewide' )->escaped() => 'sitewide',
- $this->msg( 'ipb-partial' )->escaped() => 'partial',
+ $this->msg( 'ipb-sitewide' )->escaped() .
+ new \OOUI\LabelWidget( [
+ 'classes' => [ 'oo-ui-inline-help' ],
+ 'label' => $this->msg( 'ipb-sitewide-help' )->text(),
+ ] ) => 'sitewide',
+ $this->msg( 'ipb-partial' )->escaped() .
+ new \OOUI\LabelWidget( [
+ 'classes' => [ 'oo-ui-inline-help' ],
+ 'label' => $this->msg( 'ipb-partial-help' )->text(),
+ ] ) => 'partial',
],
'section' => 'actions',
];
"ipb-confirm": "Confirm block",
"ipb-sitewide": "Sitewide",
"ipb-partial": "Partial",
+ "ipb-sitewide-help": "Every page on the wiki and all other contribution actions.",
+ "ipb-partial-help": "Specific pages or namespaces.",
"ipb-pages-label": "Pages",
"ipb-namespaces-label": "Namespaces",
"badipaddress": "Invalid IP address",
"ipb-confirm": "Used as hidden field in the form on [[Special:Block]].",
"ipb-sitewide": "A type of block the user can select from on [[Special:Block]].",
"ipb-partial": "A type of block the user can select from on [[Special:Block]].",
+ "ipb-sitewide-help": "Help text describing the effects of a sitewide block on [[Special:Block]]",
+ "ipb-partial-help": "Help text describing the effects of a partial block on [[Special:Block]]",
"ipb-pages-label": "The label for an autocomplete text field to specify pages to block a user from editing on [[Special:Block]].",
"ipb-namespaces-label": "The label for an autocomplete text field to specify namespaces to block a user from editing on [[Special:Block]].",
"badipaddress": "An error message shown when one entered an invalid IP address in blocking page.",
};
</script>
<script>
- // Mock startup.js
+ // Mock ResourceLoaderStartUpModule substitutions
window.$VARS = {
- baseModules: []
+ baseModules: [],
+ maxQueryLength: 2000
};
+ // Mock startup.js
window.RLQ = [];
</script>
<script src="modules/src/startup/mediawiki.js"></script>
* @param {string[]} batch
*/
function batchRequest( batch ) {
- var reqBase, splits, maxQueryLength, b, bSource, bGroup,
+ var reqBase, splits, b, bSource, bGroup,
source, group, i, modules, sourceLoadScript,
currReqBase, currReqBaseLength, moduleMap, currReqModules, l,
lastDotIndex, prefix, suffix, bytesAdded;
lang: mw.config.get( 'wgUserLanguage' ),
debug: mw.config.get( 'debug' )
};
- maxQueryLength = mw.config.get( 'wgResourceLoaderMaxQueryLength', 2000 );
// Split module list by source and by group.
splits = Object.create( null );
modules[ i ].length + 3; // '%7C'.length == 3
// If the url would become too long, create a new one, but don't create empty requests
- if ( maxQueryLength > 0 && currReqModules.length && l + bytesAdded > maxQueryLength ) {
+ if ( currReqModules.length && l + bytesAdded > mw.loader.maxQueryLength ) {
// Dispatch what we've got...
doRequest();
// .. and start again.
moduleMap = Object.create( null );
currReqModules = [];
- mw.track( 'resourceloader.splitRequest', { maxQueryLength: maxQueryLength } );
+ mw.track( 'resourceloader.splitRequest', { maxQueryLength: mw.loader.maxQueryLength } );
}
if ( !moduleMap[ prefix ] ) {
moduleMap[ prefix ] = [];
*/
moduleRegistry: registry,
+ /**
+ * Exposed for testing and debugging only.
+ *
+ * @see #batchRequest
+ * @property
+ * @private
+ */
+ maxQueryLength: $VARS.maxQueryLength,
+
/**
* @inheritdoc #newStyleTag
* @method
};
},
teardown: function () {
+ mw.loader.maxQueryLength = 2000;
// Teardown for StringSet shim test
if ( this.nativeSet ) {
window.Set = this.nativeSet;
[ 'testUrlIncDump', 'dump', [], null, 'testloader' ]
] );
- mw.config.set( 'wgResourceLoaderMaxQueryLength', 10 );
+ mw.loader.maxQueryLength = 10;
return mw.loader.using( [ 'testUrlIncDump', 'testUrlInc' ] ).then( function ( require ) {
assert.propEqual(