Merge branch 'release-5.0.0' into develop

This commit is contained in:
Daniel Kraus
2017-09-01 05:47:25 +02:00
10 changed files with 40 additions and 26 deletions

View File

@ -431,7 +431,7 @@ EXTRACT_ALL = NO
# be included in the documentation. # be included in the documentation.
# The default value is: NO. # The default value is: NO.
EXTRACT_PRIVATE = NO EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation. # scope will be included in the documentation.

17
NEWS
View File

@ -1,9 +1,22 @@
Version 7.1.0 (2017-08-24) Version 5.0.0 (2017-09-01)
------------------------------------------------------------------------ ------------------------------------------------------------------------
- Change: The $wgLinkTitlesBatchTimeLimit configuration variable was renamed to $wgLinkTitlesSpecialPageReloadAfter.
- Fix: Blacklist did not always work properly
- Fix: Contents of <noautolink> tags are now properly parsed as Wiki text.
- Fix: Links to other namespaces were not prefixed properly.
- Fix: The firstOnly option finally also works if a page contains a link to a given other page that was not currently added by the extension, i.e. that existed prior to an edit or that was manually added.
- Fix: When $wgCapitalLinks was true, the extension would not work with non-latin languages.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Version 4.1.0 (2017-08-25)
------------------------------------------------------------------------
- Fix: Properly handle templates that include other templates.
- New: Mark sections that are not to be automatically linked with the new `<noautolinks>..</noautolinks>` tag. - New: Mark sections that are not to be automatically linked with the new `<noautolinks>..</noautolinks>` tag.
- New: Mark sections that are to be automatically linked with the new `<autolinks>..</autolinks>` tag. This tag only makes sense on pages with the `__NOAUTOLINKS__` magic word, or if both `$wgLinkTitlesParseOnEdit` and `$wgLinkTitlesParseOnRender` are set to false. Note that this tag is parsed when a page is rendered, not when it is saved. Therefore, the links will not appear in the page source. - New: Mark sections that are to be automatically linked with the new `<autolinks>..</autolinks>` tag. This tag only makes sense on pages with the `__NOAUTOLINKS__` magic word, or if both `$wgLinkTitlesParseOnEdit` and `$wgLinkTitlesParseOnRender` are set to false. Note that this tag is parsed when a page is rendered, not when it is saved. Therefore, the links will not appear in the page source.
- Fix: Properly handle templates that include other templates.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

View File

@ -374,7 +374,7 @@ To add page titles to the black list, you can use statements such as
in your `LocalSettings.php` file. Use one of these for every page title that you want to in your `LocalSettings.php` file. Use one of these for every page title that you want to
put on the black list. Alternatively, you can specify the entire array: put on the black list. Alternatively, you can specify the entire array:
$wgLinkTitlesBlackList[] = [ 'Some special page title', 'Another one' ]; $wgLinkTitlesBlackList = [ 'Some special page title', 'Another one' ];
Keep in mind that a MediaWiki page title always starts with a capital letter Keep in mind that a MediaWiki page title always starts with a capital letter
unless you have `$wgCapitalLinks = false;` in your `LocalSettings.php`. unless you have `$wgCapitalLinks = false;` in your `LocalSettings.php`.

View File

@ -4,11 +4,12 @@
"[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus (bovender)]", "[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus (bovender)]",
"Ulrich Strauss (c0nnex)", "Ulrich Strauss (c0nnex)",
"Brent Laabs (labster)", "Brent Laabs (labster)",
"tetsuya-zama" "tetsuya-zama",
"yoshida"
], ],
"type": "parserhook", "type": "parserhook",
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles", "url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
"version": "4.1.0", "version": "5.0.0",
"license-name": "GPL-2.0+", "license-name": "GPL-2.0+",
"descriptionmsg": "linktitles-desc", "descriptionmsg": "linktitles-desc",
"requires": { "requires": {

View File

@ -76,8 +76,8 @@ class Linker {
$limitReached = false; $limitReached = false;
$newLinks = false; // whether or not new links were added $newLinks = false; // whether or not new links were added
$newText = $source->getText(); $newText = $source->getText();
$splitter = Splitter::default( $this->config ); $splitter = Splitter::singleton( $this->config );
$targets = Targets::default( $source->getTitle(), $this->config ); $targets = Targets::singleton( $source->getTitle(), $this->config );
// Iterate through the target page titles // Iterate through the target page titles
foreach( $targets->queryResult as $row ) { foreach( $targets->queryResult as $row ) {

View File

@ -52,7 +52,7 @@ class Splitter {
* *
* @param Config|null $config LinkTitles configuration. * @param Config|null $config LinkTitles configuration.
*/ */
public static function default( Config &$config = null ) { public static function singleton( Config &$config = null ) {
if ( self::$instance === null ) { if ( self::$instance === null ) {
if ( $config === null ) { if ( $config === null ) {
$config = new Config(); $config = new Config();

View File

@ -40,7 +40,7 @@ class Targets {
* @param String $sourceNamespace The namespace of the current page. * @param String $sourceNamespace The namespace of the current page.
* @param Config $config LinkTitles configuration. * @param Config $config LinkTitles configuration.
*/ */
public static function default( \Title $title, Config $config ) { public static function singleton( \Title $title, Config $config ) {
if ( ( self::$instance === null ) || ( self::$instance->sourceNamespace != $title->getNamespace() ) ) { if ( ( self::$instance === null ) || ( self::$instance->sourceNamespace != $title->getNamespace() ) ) {
self::$instance = new Targets( $title, $config ); self::$instance = new Targets( $title, $config );
} }
@ -48,7 +48,7 @@ class Targets {
} }
/** /**
* Invalidates the cache; the next call of Targets::default() will trigger * Invalidates the cache; the next call of Targets::singleton() will trigger
* a database query. * a database query.
* *
* Use this in unit tests which are performed in a single request cycle so that * Use this in unit tests which are performed in a single request cycle so that

View File

@ -34,7 +34,7 @@ class SplitterTest extends MediaWikiTestCase {
$config->skipTemplates = $skipTemplates; $config->skipTemplates = $skipTemplates;
$config->parseHeadings = $parseHeadings; $config->parseHeadings = $parseHeadings;
LinkTitles\Splitter::invalidate(); LinkTitles\Splitter::invalidate();
$splitter = LinkTitles\Splitter::default( $config ); $splitter = LinkTitles\Splitter::singleton( $config );
$this->assertSame( $skipTemplates, $splitter->config->skipTemplates, 'Splitter has incorrect skipTemplates config'); $this->assertSame( $skipTemplates, $splitter->config->skipTemplates, 'Splitter has incorrect skipTemplates config');
$this->assertSame( $parseHeadings, $splitter->config->parseHeadings, 'Splitter has incorrect parseHeadings config'); $this->assertSame( $parseHeadings, $splitter->config->parseHeadings, 'Splitter has incorrect parseHeadings config');
$this->assertSame( $expectedOutput, $splitter->split( $input ) ); $this->assertSame( $expectedOutput, $splitter->split( $input ) );

View File

@ -34,7 +34,7 @@ class TargetsTest extends LinkTitles\TestCase {
*/ */
public function testTargets() { public function testTargets() {
$title = \Title::newFromText( 'link target' ); $title = \Title::newFromText( 'link target' );
$targets = LinkTitles\Targets::default( $title, new LinkTitles\Config() ); $targets = LinkTitles\Targets::singleton( $title, new LinkTitles\Config() );
// Count number of articles: Inspired by updateArticleCount.php maintenance // Count number of articles: Inspired by updateArticleCount.php maintenance
// script: https://doc.wikimedia.org/mediawiki-core/master/php/updateArticleCount_8php_source.html // script: https://doc.wikimedia.org/mediawiki-core/master/php/updateArticleCount_8php_source.html