From 96bce45172bda17f2e28a5e0dad2a918825cfbe1 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Fri, 1 Sep 2017 05:39:51 +0200 Subject: [PATCH 1/2] Do not use the reserved word default as function name. --- includes/Linker.php | 4 ++-- includes/Splitter.php | 2 +- includes/Targets.php | 4 ++-- tests/phpunit/SplitterTest.php | 2 +- tests/phpunit/TargetsTest.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 4718b87..0065896 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -76,8 +76,8 @@ class Linker { $limitReached = false; $newLinks = false; // whether or not new links were added $newText = $source->getText(); - $splitter = Splitter::default( $this->config ); - $targets = Targets::default( $source->getTitle(), $this->config ); + $splitter = Splitter::singleton( $this->config ); + $targets = Targets::singleton( $source->getTitle(), $this->config ); // Iterate through the target page titles foreach( $targets->queryResult as $row ) { diff --git a/includes/Splitter.php b/includes/Splitter.php index c13952c..349f1b8 100644 --- a/includes/Splitter.php +++ b/includes/Splitter.php @@ -52,7 +52,7 @@ class Splitter { * * @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 ( $config === null ) { $config = new Config(); diff --git a/includes/Targets.php b/includes/Targets.php index 144c056..d129d72 100644 --- a/includes/Targets.php +++ b/includes/Targets.php @@ -40,7 +40,7 @@ class Targets { * @param String $sourceNamespace The namespace of the current page. * @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() ) ) { 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. * * Use this in unit tests which are performed in a single request cycle so that diff --git a/tests/phpunit/SplitterTest.php b/tests/phpunit/SplitterTest.php index c503b73..5557335 100644 --- a/tests/phpunit/SplitterTest.php +++ b/tests/phpunit/SplitterTest.php @@ -34,7 +34,7 @@ class SplitterTest extends MediaWikiTestCase { $config->skipTemplates = $skipTemplates; $config->parseHeadings = $parseHeadings; 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( $parseHeadings, $splitter->config->parseHeadings, 'Splitter has incorrect parseHeadings config'); $this->assertSame( $expectedOutput, $splitter->split( $input ) ); diff --git a/tests/phpunit/TargetsTest.php b/tests/phpunit/TargetsTest.php index 0638cee..351a0b2 100644 --- a/tests/phpunit/TargetsTest.php +++ b/tests/phpunit/TargetsTest.php @@ -34,7 +34,7 @@ class TargetsTest extends LinkTitles\TestCase { */ public function testTargets() { $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 // script: https://doc.wikimedia.org/mediawiki-core/master/php/updateArticleCount_8php_source.html From 608355a5140e9397f6508788739d282c74338e9a Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Fri, 1 Sep 2017 05:40:21 +0200 Subject: [PATCH 2/2] Prepare release v5.0.0. --- Doxyfile | 2 +- NEWS | 41 +++++++++++++++++++++++++++-------------- README.md | 2 +- extension.json | 5 +++-- gh-pages | 2 +- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Doxyfile b/Doxyfile index 330868a..39790ca 100644 --- a/Doxyfile +++ b/Doxyfile @@ -431,7 +431,7 @@ EXTRACT_ALL = NO # be included in the documentation. # 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 # scope will be included in the documentation. diff --git a/NEWS b/NEWS index 0c1d448..500ec0c 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,24 @@ -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 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 `..` tag. - New: Mark sections that are to be automatically linked with the new `..` 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. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.9 (2017-03-21) @@ -13,7 +26,7 @@ Version 4.0.9 (2017-03-21) - Fix: __NOAUTOLINKS__ was not respected during rendering. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.8 (2017-02-16) @@ -23,7 +36,7 @@ Version 4.0.8 (2017-02-16) - Fix: The special page and the maintenance script did not work in MW 1.28. - Fix: The special page did not work. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.7 (2017-01-02) @@ -31,7 +44,7 @@ Version 4.0.7 (2017-01-02) - Improvement: Increase performance of special page and maintenance script. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.6 (2016-12-28) @@ -40,7 +53,7 @@ Version 4.0.6 (2016-12-28) - Fix: Bug fixes. - Fix: Custom namespace weights were not respected. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.5 (2016-12-14) @@ -50,7 +63,7 @@ Version 4.0.5 (2016-12-14) - Fix: Remove leftover error log call. - Improvement: Refactored maintenance script, improving user interaction. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.4 (2016-11-30) @@ -58,7 +71,7 @@ Version 4.0.4 (2016-11-30) - Fix: Do not link titles twice if $wgLinkTitlesFirstOnly and $wgLinkTitlesSmartMode are both true. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.3 (2016-11-22) @@ -66,7 +79,7 @@ Version 4.0.3 (2016-11-22) - Fix: __NOAUTOLINKS__ magic word would not be respected when saving an edited page. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.2 (2016-11-09) @@ -75,7 +88,7 @@ Version 4.0.2 (2016-11-09) - FIX: Removed a fatal bug in the LinkTitles_Maintenance script. - FIX: Repaired severely broken namespaces support. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.1 (2016-11-08) @@ -83,7 +96,7 @@ Version 4.0.1 (2016-11-08) - FIX: Prevent syntax error when accessing special page. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 4.0.0 (2016-11-05) @@ -95,7 +108,7 @@ Version 4.0.0 (2016-11-05) - NEW: Support namespaces. - NEW: Use the new extension format introduced by MediaWiki 1.25; the extension will no longer run with older MediaWiki versions. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Version 3.1.0. (2015-02-05) @@ -103,7 +116,7 @@ Version 3.1.0. (2015-02-05) - IMPROVEMENT: Do not link inside ... tags. -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/README.md b/README.md index 19eb926..138d68e 100644 --- a/README.md +++ b/README.md @@ -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 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 unless you have `$wgCapitalLinks = false;` in your `LocalSettings.php`. diff --git a/extension.json b/extension.json index 00057fd..45470f8 100644 --- a/extension.json +++ b/extension.json @@ -4,11 +4,12 @@ "[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus (bovender)]", "Ulrich Strauss (c0nnex)", "Brent Laabs (labster)", - "tetsuya-zama" + "tetsuya-zama", + "yoshida" ], "type": "parserhook", "url": "https://www.mediawiki.org/wiki/Extension:LinkTitles", - "version": "4.1.0", + "version": "5.0.0", "license-name": "GPL-2.0+", "descriptionmsg": "linktitles-desc", "requires": { diff --git a/gh-pages b/gh-pages index 076be77..b89d3cf 160000 --- a/gh-pages +++ b/gh-pages @@ -1 +1 @@ -Subproject commit 076be774a2dcf5d625adf292c7fd97bddc4bfddd +Subproject commit b89d3cf098636f3ecb2e5bc57441cd23203bdd54