* User::makeGroupLinkWiki(), deprecated in 1.29, has been removed. Use
UserGroupMembership::getLink() instead.
* SavepointPostgres, deprecated in 1.31, has been removed.
-* Output::sectionEditLinksEnabled(), ParserOutput::getEditSectionTokens,
- ::getTOCEnabled, ::setEditSectionTokens, ::setTOCEnabled, deprecated in 1.31,
- have been removed.
+* OutputPage::enableSectionEditLinks(), OutputPage::sectionEditLinksEnabled(),
+ ParserOptions::getEditSection(), ParserOptions::setEditSection(), and
+ ParserOutput::getEditSectionTokens, ::getTOCEnabled, ::setEditSectionTokens,
+ and ::setTOCEnabled, deprecated in 1.31, have been removed.
* EditPage::safeUnicodeInput() and ::safeUnicodeOutput(), deprecated in 1.30,
have been removed.
* Four methods in OutputPage, deprecated in 1.32, have been removed. You should
removed.
* The $wgUseKeyHeader configuration option and the OutputPage::getKeyHeader()
method, deprecated in 1.32, have been removed.
+* WebInstallerOutput::addWikiText(), deprecated in 1.32, has been removed.
+* Parser::fetchFile(), deprecated in 1.32, has been removed. Use the method
+ Parser::fetchFileAndTitle() instead.
+* The global function wfBCP47, deprecated in 1.31, has been removed.
+* wfCountDown() function, deprecated in 1.31, has been removed. Use
+ \Maintenance::countDown() method instead.
* …
=== Deprecations in 1.34 ===
* temporary storage. Preprocessor_DOM generally uses less memory;
* the speed of the two is roughly the same.
*
- * If this parameter is not given, it uses Preprocessor_DOM if the
- * DOM module is available, otherwise it uses Preprocessor_Hash.
+ * If this parameter is not given, it uses Preprocessor_Hash.
*
* The Preprocessor_DOM class is deprecated, and will be removed in a future
* release.
return $lbFactory->waitForReplication( $opts );
}
-/**
- * Count down from $seconds to zero on the terminal, with a one-second pause
- * between showing each number. For use in command-line scripts.
- *
- * @deprecated since 1.31, use Maintenance::countDown()
- *
- * @codeCoverageIgnore
- * @param int $seconds
- */
-function wfCountDown( $seconds ) {
- wfDeprecated( __FUNCTION__, '1.31' );
- for ( $i = $seconds; $i >= 0; $i-- ) {
- if ( $i != $seconds ) {
- echo str_repeat( "\x08", strlen( $i + 1 ) );
- }
- echo $i;
- flush();
- if ( $i ) {
- sleep( 1 );
- }
- }
- echo "\n";
-}
-
/**
* Replace all invalid characters with '-'.
* Additional characters can be defined in $wgIllegalFileChars (see T22489).
return $val;
}
-/**
- * Get the normalised IETF language tag
- * See unit test for examples.
- * See mediawiki.language.bcp47 for the JavaScript implementation.
- *
- * @deprecated since 1.31, use LanguageCode::bcp47() directly.
- *
- * @param string $code The language code.
- * @return string The language code which complying with BCP 47 standards.
- */
-function wfBCP47( $code ) {
- wfDeprecated( __METHOD__, '1.31' );
- return LanguageCode::bcp47( $code );
-}
-
/**
* Get a specific cache object.
*
return $this->mEnableTOC;
}
- /**
- * Enables/disables section edit links, doesn't override __NOEDITSECTION__
- * @param bool $flag
- * @since 1.23
- * @deprecated since 1.31, use $poOptions to addParserOutput() instead.
- */
- public function enableSectionEditLinks( $flag = true ) {
- wfDeprecated( __METHOD__, '1.31' );
- }
-
/**
* Helper function to setup the PHP implementation of OOUI to use in this request.
*
}
/**
- * Given a list of blocks, return a list blocks where each block either has a
- * unique ID or has ID null.
+ * Given a list of blocks, return a list of unique blocks.
+ *
+ * This usually means that each block has a unique ID. For a block with ID null,
+ * if it's an autoblock, it will be filtered out if the parent block is present;
+ * if not, it is assumed to be a unique system block, and kept.
*
* @param AbstractBlock[] $blocks
* @return AbstractBlock[]
*/
private function getUniqueBlocks( $blocks ) {
- $blockIds = [];
- $uniqueBlocks = [];
+ $systemBlocks = [];
+ $databaseBlocks = [];
+
foreach ( $blocks as $block ) {
- $id = $block->getId();
- if ( $id === null ) {
- $uniqueBlocks[] = $block;
- } elseif ( !isset( $blockIds[$id] ) ) {
- $uniqueBlocks[] = $block;
- $blockIds[$block->getId()] = true;
+ if ( $block instanceof SystemBlock ) {
+ $systemBlocks[] = $block;
+ } elseif ( $block->getType() === DatabaseBlock::TYPE_AUTO ) {
+ if ( !isset( $databaseBlocks[$block->getParentBlockId()] ) ) {
+ $databaseBlocks[$block->getParentBlockId()] = $block;
+ }
+ } else {
+ $databaseBlocks[$block->getId()] = $block;
}
}
- return $uniqueBlocks;
+
+ return array_merge( $systemBlocks, $databaseBlocks );
}
/**
return $this;
}
+ /**
+ * @since 1.34
+ * @return int|null If this is an autoblock, ID of the parent block; otherwise null
+ */
+ public function getParentBlockId() {
+ return $this->mParentBlockId;
+ }
+
/**
* Get/set a flag determining whether the master is used for reads
*
* @since 1.34
*/
class ServiceOptions {
+ private $keys = [];
private $options = [];
/**
* @throws InvalidArgumentException if one of $keys is not found in any of $sources
*/
public function __construct( array $keys, ...$sources ) {
+ $this->keys = $keys;
foreach ( $keys as $key ) {
foreach ( $sources as $source ) {
if ( $source instanceof Config ) {
* @param string[] $expectedKeys
*/
public function assertRequiredOptions( array $expectedKeys ) {
- $actualKeys = array_keys( $this->options );
- $extraKeys = array_diff( $actualKeys, $expectedKeys );
- $missingKeys = array_diff( $expectedKeys, $actualKeys );
- Assert::precondition( !$extraKeys && !$missingKeys,
- (
- $extraKeys
- ? 'Unsupported options passed: ' . implode( ', ', $extraKeys ) . '!'
- : ''
- ) . ( $extraKeys && $missingKeys ? ' ' : '' ) . (
- $missingKeys
- ? 'Required options missing: ' . implode( ', ', $missingKeys ) . '!'
- : ''
- )
- );
+ if ( $this->keys !== $expectedKeys ) {
+ $extraKeys = array_diff( $this->keys, $expectedKeys );
+ $missingKeys = array_diff( $expectedKeys, $this->keys );
+ Assert::precondition( !$extraKeys && !$missingKeys,
+ (
+ $extraKeys
+ ? 'Unsupported options passed: ' . implode( ', ', $extraKeys ) . '!'
+ : ''
+ ) . ( $extraKeys && $missingKeys ? ' ' : '' ) . (
+ $missingKeys
+ ? 'Required options missing: ' . implode( ', ', $missingKeys ) . '!'
+ : ''
+ )
+ );
+ }
}
/**
$this->flush();
}
- /**
- * @param string $text
- * @deprecated since 1.32; use addWikiTextAsInterface instead
- */
- public function addWikiText( $text ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->addWikiTextAsInterface( $text );
- }
-
/**
* @param string $text
* @since 1.32
'deps' => $deps ];
}
- /**
- * Fetch a file and its title and register a reference to it.
- * If 'broken' is a key in $options then the file will appear as a broken thumbnail.
- * @param Title $title
- * @param array $options Array of options to RepoGroup::findFile
- * @return File|bool
- * @deprecated since 1.32, use fetchFileAndTitle instead
- */
- public function fetchFile( $title, $options = [] ) {
- wfDeprecated( __METHOD__, '1.32' );
- return $this->fetchFileAndTitle( $title, $options )[0];
- }
-
/**
* Fetch a file and its title and register a reference to it.
* If 'broken' is a key in $options then the file will appear as a broken thumbnail.
return wfSetVar( $this->mTimestamp, $x );
}
- /**
- * Create "edit section" links?
- * @deprecated since 1.31, use ParserOutput::getText() options instead.
- * @return bool
- */
- public function getEditSection() {
- wfDeprecated( __METHOD__, '1.31' );
- return true;
- }
-
- /**
- * Create "edit section" links?
- * @deprecated since 1.31, use ParserOutput::getText() options instead.
- * @param bool|null $x New value (null is no change)
- * @return bool Old value
- */
- public function setEditSection( $x ) {
- wfDeprecated( __METHOD__, '1.31' );
- return true;
- }
-
/**
* Set the redirect target.
*
"history": "Page history",
"history_short": "History",
"history_small": "history",
- "updatedmarker": "updated since my last visit",
+ "updatedmarker": "updated since your last visit",
"printableversion": "Printable version",
"permalink": "Permanent link",
"print": "Print",
//
// Please extend the regex instead of adding new ones!
// And add a test case to startup.test.js
- !ua.match( /MSIE 10|webOS\/1\.[0-4]|SymbianOS|Series60|NetFront|Opera Mini|S40OviBrowser|MeeGo|Android.+Glass|^Mozilla\/5\.0 .+ Gecko\/$|googleweblight|PLAYSTATION|PlayStation/ )
+ !ua.match( /MSIE 10|webOS\/1\.[0-4]|SymbianOS|NetFront|Opera Mini|S40OviBrowser|MeeGo|Android.+Glass|^Mozilla\/5\.0 .+ Gecko\/$|googleweblight|PLAYSTATION|PlayStation/ )
);
}
use MediaWiki\Block\BlockManager;
use MediaWiki\Block\DatabaseBlock;
+use MediaWiki\Block\SystemBlock;
/**
* @group Blocking
],
];
}
+
+ /**
+ * @covers ::getUniqueBlocks
+ */
+ public function testGetUniqueBlocks() {
+ $blockId = 100;
+
+ $class = new ReflectionClass( BlockManager::class );
+ $method = $class->getMethod( 'getUniqueBlocks' );
+ $method->setAccessible( true );
+
+ $blockManager = $this->getBlockManager( [] );
+
+ $block = $this->getMockBuilder( DatabaseBlock::class )
+ ->setMethods( [ 'getId' ] )
+ ->getMock();
+ $block->expects( $this->any() )
+ ->method( 'getId' )
+ ->willReturn( $blockId );
+
+ $autoblock = $this->getMockBuilder( DatabaseBlock::class )
+ ->setMethods( [ 'getParentBlockId', 'getType' ] )
+ ->getMock();
+ $autoblock->expects( $this->any() )
+ ->method( 'getParentBlockId' )
+ ->willReturn( $blockId );
+ $autoblock->expects( $this->any() )
+ ->method( 'getType' )
+ ->willReturn( DatabaseBlock::TYPE_AUTO );
+
+ $blocks = [ $block, $block, $autoblock, new SystemBlock() ];
+
+ $this->assertSame( 2, count( $method->invoke( $blockManager, $blocks ) ) );
+ }
}
* @author Antoine Musso
* @author Niklas Laxström
* @author Santhosh Thottingal
- * @author Timo Tijhof
* @copyright © 2012, Antoine Musso
* @copyright © 2012, Niklas Laxström
* @copyright © 2012, Santhosh Thottingal
- * @copyright © 2012, Timo Tijhof
*/
class ResourcesTest extends MediaWikiTestCase {
* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @package MediaWiki
* @author Lupo
- * @since 1.20
*/
// This file doesn't run as part of MediaWiki
* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @package MediaWiki
- * @author Timo Tijhof
- * @since 1.20
*/
// This file doesn't run as part of MediaWiki