* ResourceLoaderContext::getConfig and ResourceLoaderContext::getLogger have
been deprecated. Inside ResourceLoaderModule subclasses, use the local methods
instead. Elsewhere, use the methods from the ResourceLoader class.
+* The Preprocessor_DOM implementation has been deprecated. It will be
+ removed in a future release. Use the Preprocessor_Hash implementation
+ instead.
=== Other changes in 1.34 ===
* …
* If this parameter is not given, it uses Preprocessor_DOM if the
* DOM module is available, otherwise it uses Preprocessor_Hash.
*
+ * The Preprocessor_DOM class is deprecated, and will be removed in a future
+ * release.
+ *
* The entire associative array will be passed through to the constructor as
* the first parameter. Note that only Setup.php can use this variable --
* the configuration will change at runtime via Parser member functions, so
$phpInfo = $this->getPHPInfo();
$minimumVersion = $phpInfo['minSupported'];
$otherInfo = $this->getPHPInfo( $phpInfo['implementation'] === 'HHVM' ? 'PHP' : 'HHVM' );
- if (
- !function_exists( 'version_compare' )
- || version_compare( $phpInfo['version'], $minimumVersion ) < 0
- ) {
+ if ( version_compare( $phpInfo['version'], $minimumVersion ) < 0 ) {
$shortText = "MediaWiki $this->mwVersion requires at least {$phpInfo['implementation']}"
. " version $minimumVersion or {$otherInfo['implementation']} version "
. "{$otherInfo['minSupported']}, you are using {$phpInfo['implementation']} "
} else {
$block = new CompositeBlock( [
'address' => $ip,
+ 'byText' => 'MediaWiki default',
+ 'reason' => wfMessage( 'blockedtext-composite-reason' )->plain(),
'originalBlocks' => $blocks,
] );
}
return $this->originalBlocks;
}
+ /**
+ * @inheritDoc
+ */
+ public function getExpiry() {
+ $maxExpiry = null;
+ foreach ( $this->originalBlocks as $block ) {
+ $expiry = $block->getExpiry();
+ if ( $maxExpiry === null || $expiry === '' || $expiry > $maxExpiry ) {
+ $maxExpiry = $expiry;
+ }
+ }
+ return $maxExpiry;
+ }
+
/**
* @inheritDoc
*/
public function getPermissionsError( IContextSource $context ) {
$params = $this->getBlockErrorParams( $context );
- $msg = $this->isSitewide() ? 'blockedtext' : 'blockedtext-partial';
+ $msg = 'blockedtext-composite';
array_unshift( $params, $msg );
] );
$styleUrl = $server . dirname( dirname( $this->parent->getUrl() ) ) .
'/mw-config/config-cc.css';
- $iframeUrl = '//creativecommons.org/license/?' .
+ $iframeUrl = 'https://creativecommons.org/license/?' .
wfArrayToCgi( [
'partner' => 'MediaWiki',
'exit_url' => $exitUrl,
<div id="mw-panel">
<div class="portal" id="p-logo">
- <a style="background-image: url(images/installer-logo.png);"
- href="https://www.mediawiki.org/"
- title="Main Page"></a>
+ <a href="https://www.mediawiki.org/" title="Main Page"></a>
</div>
<?php
$message = wfMessage( 'config-sidebar' )->plain();
/**
* Expansion frame with custom arguments
+ * @deprecated since 1.34, use PPCustomFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
/**
* An expansion frame, used as a context to expand the result of preprocessToObj()
+ * @deprecated since 1.34, use PPFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
*/
/**
+ * @deprecated since 1.34, use PPNode_Hash_{Tree,Text,Array,Attr}
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
/**
* Expansion frame with template arguments
+ * @deprecated since 1.34, use PPTemplateFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* Which class should we use for the preprocessor if not otherwise specified?
*
* @since 1.34
+ * @deprecated since 1.34, removing configurability of preprocessor
* @return string
*/
public static function getDefaultPreprocessorClass() {
- if ( wfIsHHVM() ) {
- # Under HHVM Preprocessor_Hash is much faster than Preprocessor_DOM
- return Preprocessor_Hash::class;
- }
- if ( extension_loaded( 'domxml' ) ) {
- # PECL extension that conflicts with the core DOM extension (T15770)
- wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" );
- return Preprocessor_Hash::class;
- }
- if ( extension_loaded( 'dom' ) ) {
- return Preprocessor_DOM::class;
- }
return Preprocessor_Hash::class;
}
*
* @file
* @ingroup Parser
+ * @deprecated since 1.34, use Preprocessor_Hash
*/
/**
const CACHE_PREFIX = 'preprocess-xml';
public function __construct( $parser ) {
+ wfDeprecated( __METHOD__, '1.34' ); // T204945
$this->parser = $parser;
$mem = ini_get( 'memory_limit' );
$this->memoryLimit = false;
*/
public function getDirection() {
if ( $this->direction === null ) {
- $this->direction = $this->getRequest()->getRawVal( 'dir' );
- if ( !$this->direction ) {
+ $direction = $this->getRequest()->getRawVal( 'dir' );
+ if ( $direction === 'ltr' || $direction === 'rtl' ) {
+ $this->direction = $direction;
+ } else {
// Determine directionality based on user language (T8100)
$this->direction = Language::factory( $this->getLanguage() )->getDir();
}
$result = (int)$s->user_id;
}
- self::$idCacheByName[$name] = $result;
-
- if ( count( self::$idCacheByName ) > 1000 ) {
+ if ( count( self::$idCacheByName ) >= 1000 ) {
self::$idCacheByName = [];
}
+ self::$idCacheByName[$name] = $result;
+
return $result;
}
"autoblockedtext": "Your IP address has been automatically blocked because it was used by another user, who was blocked by $1.\nThe reason given is:\n\n:<em>$2</em>\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n\nYou may contact $1 or one of the other [[{{MediaWiki:Grouppage-sysop}}|administrators]] to discuss the block.\n\nNote that you may not use the \"{{int:emailuser}}\" feature unless you have a valid email address registered in your [[Special:Preferences|user preferences]] and you have not been blocked from using it.\n\nYour current IP address is $3, and the block ID is #$5.\nPlease include all above details in any queries you make.",
"systemblockedtext": "Your username or IP address has been automatically blocked by MediaWiki.\nThe reason given is:\n\n:<em>$2</em>\n\n* Start of block: $8\n* Expiration of block: $6\n* Intended blockee: $7\n\nYour current IP address is $3.\nPlease include all above details in any queries you make.",
"blockednoreason": "no reason given",
+ "blockedtext-composite": "<strong>Your username or IP address has been blocked.</strong>\n\nThe reason given is:\n\n:<em>$2</em>.\n\n* Start of block: $8\n* Expiration of longest block: $6\n\nYour current IP address is $3.\nPlease include all above details in any queries you make.",
+ "blockedtext-composite-reason": "There are multiple blocks against your account and/or IP address",
"whitelistedittext": "Please $1 to edit pages.",
"confirmedittext": "You must confirm your email address before editing pages.\nPlease set and validate your email address through your [[Special:Preferences|user preferences]].",
"nosuchsectiontitle": "Cannot find section",
"exif-copyrighted": "Copyright status. This is a true or false field showing either Copyrighted or Public Domain. It should be noted that Copyrighted includes freely-licensed works.",
"exif-copyrightowner": "{{exif-qqq}}\n\nCopyright owner. Can have more than one person or entity.",
"exif-usageterms": "Terms under which you're allowed to use the image/media.",
- "exif-webstatement": "{{exif-qqq}}\n\nURL detailing the copyright status of the image, and how you're allowed to use the image. Often this is a link to a creative commons license, however the creative commons people recommend using a page that generally contains specific information about the image, and recommend using {{msg-mw|exif-licenseurl}} for linking to the license. See http://wiki.creativecommons.org/XMP",
+ "exif-webstatement": "{{exif-qqq}}\n\nURL detailing the copyright status of the image, and how you're allowed to use the image. Often this is a link to a creative commons license, however the creative commons people recommend using a page that generally contains specific information about the image, and recommend using {{msg-mw|exif-licenseurl}} for linking to the license. See https://wiki.creativecommons.org/wiki/XMP",
"exif-originaldocumentid": "A unique ID of the original document (image) that this document (image) is based on.",
"exif-licenseurl": "{{exif-qqq}}\n\nURL for copyright license. This is almost always a creative commons license since this information comes from the creative commons namespace of XMP (but could be a link to any type of license). See also {{msg-mw|exif-webstatement}}",
"exif-morepermissionsurl": "A URL where you can \"buy\" (or otherwise negotiate) to get more rights for the image.",
"blockedtext": "Text displayed to blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link)\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Autoblockedtext|notext=1}}\n* {{msg-mw|Systemblockedtext|notext=1}}",
"autoblockedtext": "Text displayed to automatically blocked users.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the block (in case of autoblocks: {{msg-mw|autoblocker}})\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the blocking sysop's username (plain text, without the link). Use it for GENDER.\n* $5 - the unique numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the block (what the blocking user specified in the blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Systemblockedtext|notext=1}}",
"systemblockedtext": "Text displayed to requests blocked by MediaWiki configuration.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - (Unused) A dummy user attributed as the blocker, possibly as a link to a user page.\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the dummy blocking user's username (plain text, without the link).\n* $5 - A short string indicating the type of system block.\n* $6 - the expiry of the block\n* $7 - the intended target of the block\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Autoblockedtext|notext=1}}",
+ "blockedtext-composite": "Text displayed to requests blocked by more than one block.\n\n\"email this user\" should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - (Unused) A dummy user attributed as the blocker, possibly as a link to a user page.\n* $2 - the reason for the block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the dummy blocking user's username (plain text, without the link).\n* $5 - (Unused) placeholder for the block ID.\n* $6 - the expiry of the block with the longest duration\n* $7 - (Unused) the intended target of the block\n* $8 - the timestamp when the block started\nSee also:\n* {{msg-mw|Systemblockedtext|notext=1}}",
+ "blockedtext-composite-reason": "Reason given to blocked users who are affected by more than one block.\n\nSee also:\n* {{msg-mw|blockedtext-composite}}",
"blockednoreason": "Substituted with <code>$2</code> in the following message if the reason is not given:\n* {{msg-mw|cantcreateaccount-text}}.\n{{Identical|No reason given}}",
"whitelistedittext": "Used as error message. Parameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description\n* $2 - an URL to the same\n\nSee also:\n* {{msg-mw|Nocreatetext}}\n* {{msg-mw|Uploadnologintext}}\n* {{msg-mw|Loginreqpagetext}}",
"confirmedittext": "Used as error message.",
border: 1px solid #5dc9f4;
margin-left: 20px;
}
+
+#p-logo a {
+ background-image: url( images/installer-logo.png );
+}
* familiarise yourself with that CSS before making any changes to this code.
*
* Dual licensed:
- * - CC BY 3.0 <http://creativecommons.org/licenses/by/3.0>
+ * - CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>
* - GPL2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
*
* @class jQuery.plugin.makeCollapsible
q = {};
// using replace to iterate over a string
if ( uri.query ) {
- uri.query.replace( /(?:^|&)([^&=]*)(?:(=)([^&]*))?/g, function ( $0, $1, $2, $3 ) {
- var k, v;
- if ( $1 ) {
- k = Uri.decode( $1 );
- v = ( $2 === '' || $2 === undefined ) ? null : Uri.decode( $3 );
+ uri.query.replace( /(?:^|&)([^&=]*)(?:(=)([^&]*))?/g, function ( match, k, eq, v ) {
+ if ( k ) {
+ k = Uri.decode( k );
+ v = ( eq === '' || eq === undefined ) ? null : Uri.decode( v );
// If overrideKeys, always (re)set top level value.
// If not overrideKeys but this key wasn't set before, then we set it as well.
$class = $wgParserConf['class'];
$parser = new $class( [ 'preprocessorClass' => $preprocessor ] + $wgParserConf );
+ if ( $preprocessor ) {
+ # Suppress deprecation warning for Preprocessor_DOM while testing
+ Wikimedia\suppressWarnings();
+ wfDeprecated( 'Preprocessor_DOM::__construct' );
+ Wikimedia\restoreWarnings();
+ $parser->getPreprocessor();
+ }
ParserTestParserHook::setup( $parser );
return $parser;
$this->mOptions = ParserOptions::newFromUserAndLang( new User,
MediaWikiServices::getInstance()->getContentLanguage() );
+ # Suppress deprecation warning for Preprocessor_DOM while testing
+ $this->hideDeprecated( 'Preprocessor_DOM::__construct' );
+
$this->mPreprocessors = [];
foreach ( self::$classNames as $className ) {
$this->mPreprocessors[$className] = new $className( $this );
$this->assertEquals( 'zh|fallback|||styles|||||', $ctx->getHash() );
}
+ public static function provideDirection() {
+ yield 'LTR language' => [
+ [ 'lang' => 'en' ],
+ 'ltr',
+ ];
+ yield 'RTL language' => [
+ [ 'lang' => 'he' ],
+ 'rtl',
+ ];
+ yield 'explicit LTR' => [
+ [ 'lang' => 'he', 'dir' => 'ltr' ],
+ 'ltr',
+ ];
+ yield 'explicit RTL' => [
+ [ 'lang' => 'en', 'dir' => 'rtl' ],
+ 'rtl',
+ ];
+ // Not supported, but tested to cover the case and detect change
+ yield 'invalid dir' => [
+ [ 'lang' => 'he', 'dir' => 'xyz' ],
+ 'rtl',
+ ];
+ }
+
+ /**
+ * @dataProvider provideDirection
+ */
+ public function testDirection( array $params, $expected ) {
+ $ctx = new ResourceLoaderContext( $this->getResourceLoader(), new FauxRequest( $params ) );
+ $this->assertEquals( $expected, $ctx->getDirection() );
+ }
+
public function testShouldInclude() {
$ctx = new ResourceLoaderContext( $this->getResourceLoader(), new FauxRequest( [] ) );
$this->assertTrue( $ctx->shouldIncludeScripts(), 'Scripts in combined' );
'wgServer' => 'http://acme.test',
'wgCanonicalServer' => 'http://acme.test',
'wgArticlePath' => '/wiki/$1',
- 'wgRightsUrl' => '//creativecommons.org/licenses/by-sa/3.0/',
+ 'wgRightsUrl' => 'https://creativecommons.org/licenses/by-sa/3.0/',
] );
$dumpScript =