From b879fd409d0b0451762e1ba9fa85724c4954e171 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 09:33:38 +0200
Subject: [PATCH 1/8] Fix regex for existing link detection.
- Fix: Detection of existing links had a bug.
---
includes/Linker.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/includes/Linker.php b/includes/Linker.php
index 0065896..d875339 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -94,7 +94,7 @@ class Linker {
// A link to the current page should only be recognized if it appears in
// clear text, i.e. we do not count piped links as existing links.
// (Similarly, by design, redirections should not be counted as existing links.)
- if ( $limit == 1 && preg_match( '/[[' . $target->getCaseSensitiveLinkValueRegex() . ']]/' , $source->getText() ) ) {
+ if ( $limit == 1 && preg_match( '/\[\[' . $target->getCaseSensitiveLinkValueRegex() . ']]/' , $source->getText() ) ) {
continue;
}
From 95bd9e0cbcbb9185dd659c44c002c14d043f4d04 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 09:34:11 +0200
Subject: [PATCH 2/8] Correct default value for minimum title length.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 138d68e..5a19de6 100644
--- a/README.md
+++ b/README.md
@@ -350,7 +350,7 @@ page titles first, as these generally tend to be more specific.
### Filtering pages by title length
- $wgLinkTitlesMinimumTitleLength = 3;
+ $wgLinkTitlesMinimumTitleLength = 4;
Only link to page titles that have a certain minimum length. In my experience,
very short titles can be ambiguous. For example, "mg" may be "milligrams" on a
From d34b2090c00d68baee95b67b16b72238c12eeb63 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 09:35:11 +0200
Subject: [PATCH 3/8] Harden test for redirects.
- Fix: Do not crash when testing redirect target on empty page.
---
includes/Target.php | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/includes/Target.php b/includes/Target.php
index 9d61426..451c6e1 100644
--- a/includes/Target.php
+++ b/includes/Target.php
@@ -73,7 +73,6 @@ class Target {
* @param String &$title Title of the target page
*/
public function __construct( $namespace, $title, Config &$config ) {
- // print "\n>>>namespace=$namespace;title=$title<<<\n";
$this->title = \Title::makeTitleSafe( $namespace, $title );
$this->titleValue = $this->title->getTitleValue();
$this->config = $config;
@@ -95,7 +94,7 @@ class Target {
}
public function getPrefixedTitleText() {
- return $this->getNsPrefix() . $this->getTitleText();
+ return $this->title->getPrefixedText();
}
/**
@@ -204,11 +203,8 @@ class Target {
// If checking for redirects is enabled and the target page does
// indeed redirect to the current page, return the page title as-is
// (unlinked).
- if ( $this->config->checkRedirect ) {
- $redirectTitle = $this->getContent()->getUltimateRedirectTarget();
- if ( $redirectTitle && $redirectTitle->equals( $source->getTitle() ) ) {
- return false;
- }
+ if ( $this->config->checkRedirect && $this->redirectsTo( $source ) ) {
+ return false;
};
// If the magic word __NOAUTOLINKTARGET__ is enabled and the target
// page does indeed contain this magic word, return the page title
@@ -229,4 +225,16 @@ class Target {
public function isSameTitle( Source $source) {
return $this->title->equals( $source->getTitle() );
}
+
+ /**
+ * Checks whether this target redirects to the source.
+ * @param Source $source Source page.
+ * @return bool True if the target redirects to the source.
+ */
+ public function redirectsTo( $source ) {
+ if ( $this->getContent() ) {
+ $redirectTitle = $this->getContent()->getUltimateRedirectTarget();
+ return $redirectTitle && $redirectTitle->equals( $source->getTitle() );
+ }
+ }
}
From 34715f9dc83d9505811622324cab5f0a28a08457 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 13:02:13 +0200
Subject: [PATCH 4/8] Test namespace handling.
---
tests/phpunit/LinkerTest.php | 75 ++++++++++++++++++-----------------
tests/phpunit/TargetsTest.php | 12 +++---
2 files changed, 46 insertions(+), 41 deletions(-)
diff --git a/tests/phpunit/LinkerTest.php b/tests/phpunit/LinkerTest.php
index 6f9c4bc..dcade3f 100644
--- a/tests/phpunit/LinkerTest.php
+++ b/tests/phpunit/LinkerTest.php
@@ -41,7 +41,6 @@ class LinkTitlesLinkerTest extends LinkTitles\TestCase {
parent::setUp(); // call last to have the Targets object invalidated after inserting the page
}
-
public function addDBData() {
$this->title = $this->insertPage( 'source page', 'This page is the test page' )['title'];
$this->insertPage( 'link target', 'This page serves as a link target' );
@@ -83,7 +82,6 @@ class LinkTitlesLinkerTest extends LinkTitles\TestCase {
];
}
-
/**
* @dataProvider provideLinkContentSmartModeData
*/
@@ -217,40 +215,45 @@ class LinkTitlesLinkerTest extends LinkTitles\TestCase {
// Tests for namespace handling are commented out until I find a way to add
// a custom namespace during testing. (The assertTrue assertion below fails.)
- // /**
- // * @dataProvider provideLinkContentNamespacesData
- // */
- // public function testLinkContentNamespaces( $namespaces, $input, $expectedOutput ) {
- // $ns = 4000;
- // $this->setMwGlobals( [
- // "wgExtraNamespaces[$ns]" => 'custom_namespace'
- // ] );
- // // global $wgExtraNamespaces;
- // // global $wgContentNamespaces;
- // // $wgContentNamespaces[] = $ns;
- // // $wgExtraNamespaces[$ns] = 'custom_adsf';
- // $this->insertPage( 'in custom namespace', 'This is a page in a custom namespace', $ns );
- // $this->assertTrue( MWNamespace::exists( $ns ), "The name space with id $ns should exist!" );
- // LinKTitles\Targets::invalidate();
- // $config = new LinkTitles\Config();
- // $config->namespaces = $namespaces;
- // $linker = new LinkTitles\Linker( $config );
- // $this->assertSame( $expectedOutput, $linker->linkContent( $this->title, $input ));
- // }
+ /**
+ * @dataProvider provideLinkContentNamespacesData
+ */
+ public function testLinkContentTargetNamespaces( $namespaces, $input, $expectedOutput ) {
+ $config = new LinkTitles\Config();
+ $config->targetNamespaces = $namespaces;
- // public function provideLinkContentNamespacesData() {
- // return [
- // [
- // [], // namespaces
- // 'With namespaces = [], page in custom namespace should not be linked',
- // 'With namespaces = [], page in custom namespace should not be linked'
- // ],
- // [
- // [ 4000 ], // namespaces
- // 'With namespaces = [ 4000 ], page in custom namespace should be linked',
- // 'With namespaces = [ 4000 ], page [[custom_namespace:in custom namespace]] should be linked'
- // ],
- // ];
- // }
+ $ns = 4000;
+ $nsText = 'customnamespace';
+ $this->mergeMwGlobalArrayValue( 'wgExtraNamespaces', [ $ns => $nsText ] );
+ // Reset namespace caches.
+ // See https://stackoverflow.com/q/45974979/270712
+ MWNamespace::getCanonicalNamespaces( true );
+ global $wgContLang;
+ $wgContLang->resetNamespaces();
+ $this->assertTrue( MWNamespace::exists( $ns ), "The namespace with id $ns should exist!" );
+
+ $this->insertPage( "in custom namespace", 'This is a page in a custom namespace', $ns );
+ LinKTitles\Targets::invalidate();
+ $linker = new LinkTitles\Linker( $config );
+ $source = LinkTitles\Source::createFromTitleAndText( $this->title, $input, $config );
+ $result = $linker->linkContent( $source );
+ if ( !$result ) { $result = $input; }
+ $this->assertSame( $expectedOutput, $result );
+ }
+
+ public function provideLinkContentNamespacesData() {
+ return [
+ [
+ [], // namespaces
+ 'With targetNamespaces = [], page in custom namespace should not be linked',
+ 'With targetNamespaces = [], page in custom namespace should not be linked'
+ ],
+ [
+ [ 4000 ], // namespaces
+ 'With targetNamespaces = [ 4000 ], page in custom namespace should be linked',
+ 'With targetNamespaces = [ 4000 ], page [[customnamespace:In custom namespace|in custom namespace]] should be linked'
+ ],
+ ];
+ }
}
diff --git a/tests/phpunit/TargetsTest.php b/tests/phpunit/TargetsTest.php
index 351a0b2..a42397a 100644
--- a/tests/phpunit/TargetsTest.php
+++ b/tests/phpunit/TargetsTest.php
@@ -28,13 +28,15 @@
*/
class TargetsTest extends LinkTitles\TestCase {
- /**
- * This test asserts that the list of potential link targets is 0
- * @return [type] [description]
- */
public function testTargets() {
+ $config = new LinkTitles\Config();
+ // Include the custom namespace with index 4000 in the count. This is a
+ // very ugly hack. If the custom namespace index in
+ // LinkTitlesLinkerTest::testLinkContentTargetNamespaces() is every changed,
+ // this test will fail.
+ $config->targetNamespaces = [ 4000 ];
$title = \Title::newFromText( 'link target' );
- $targets = LinkTitles\Targets::singleton( $title, new LinkTitles\Config() );
+ $targets = LinkTitles\Targets::singleton( $title, $config );
// Count number of articles: Inspired by updateArticleCount.php maintenance
// script: https://doc.wikimedia.org/mediawiki-core/master/php/updateArticleCount_8php_source.html
From 2f76224ac0e1daa2940819f5fa9dae17e932e264 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 14:24:28 +0200
Subject: [PATCH 5/8] Enable localization of special page.
- Improved: Special Page can now be translated using messages.
---
i18n/de.json | 11 ++++++--
i18n/en.json | 11 ++++++--
i18n/qqq.json | 11 ++++++--
includes/Extension.php | 1 +
includes/Special.php | 63 ++++++++----------------------------------
5 files changed, 37 insertions(+), 60 deletions(-)
diff --git a/i18n/de.json b/i18n/de.json
index 4e11691..20d87ff 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -1,6 +1,11 @@
{
- "linktitles": "LinkTitles",
+ "linktitles": "LinkTitles",
"linktitles-desc": "Fügt beim Speichern von Seiten automatisch Querverweise zu vorhandenen Seiten ein.",
- "right-linktitles-batch": "LinkTitles-Stapelverarbeitung ausführen",
- "action-linktitles-batch": "LinkTitles-Stapelverarbeitung auszuführen"
+ "linktitles-special-info": "LinkTitles-Erweiterung: $1\n== Stapelverarbeitung ==\nKlicken Sie auf den Button, um die Stapelverarbeitung zu beginnen. Die Erweiterung wird nacheinander alle Seiten Ihres Wikis mit automatischen Links versehen. Um zu verhindern, daß der Server bei der Ausführung blockiert wird, wird diese Seite sich wiederholt selbst aufrufen. Um die Stapelverarbeitung abzubrechen, schließen Sie einfach diese Seite.",
+ "linktitles-special-progress": "== Verarbeite die Seiten... ==\nDie [$1 LinkTitles-Erweiterung] verarbeitet gerade alle Seiten Ihres Wikis.\n=== Aktuelle Seite: $2 ===",
+ "linktitles-special-page-count": "Seite $1 von $2.\n",
+ "linktitles-special-cancel-notice": "=== Um abzubrechen, schließen Sie diese Seite, oder klicken Sie den 'Stopp'-Knopf in Ihrem Browser ===\n[[Special:LinkTitles|Zu Special:LinkTitles zurückkehren.]]",
+ "linktitles-special-completed-info": "== Stapelverarbeitung abgeschlossen! ==\n{| class=\"wikitable\"\n|-\n| Anzahl der verarbeiteten Seiten: || $1\n|-\n| Verarbeitungsintervall [s]: || $2\n|-\n| Reloads: || $3\n|-\n| Seiten pro Reload: || $4\n|}",
+ "right-linktitles-batch": "LinkTitles-Stapelverarbeitung ausführen",
+ "action-linktitles-batch": "LinkTitles-Stapelverarbeitung auszuführen"
}
diff --git a/i18n/en.json b/i18n/en.json
index 9a9b7bf..dfa6ac2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -1,6 +1,11 @@
{
- "linktitles": "LinkTitles",
+ "linktitles": "LinkTitles",
"linktitles-desc": "Automatically adds links to existing pages whenever a page is saved.",
- "right-linktitles-batch": "Perform a LinkTitles batch operation",
- "action-linktitles-batch": "perform a LinkTitles batch operation"
+ "linktitles-special-info": "LinkTitles extension: $1\n== Batch Linking ==\nYou can start a batch linking process by clicking on the button below. This will go through every page in the normal namespace of your Wiki and insert links automatically. This page will repeatedly reload itself, in order to prevent blocking the server. To interrupt the process, simply close this page.",
+ "linktitles-special-progress": "== Processing pages... ==\nThe [$1 LinkTitles] extension is currently going through every page of your wiki, adding links to existing pages as appropriate.\n=== Current page: $2 ===",
+ "linktitles-special-page-count": "Page $1 of $2.\n",
+ "linktitles-special-cancel-notice": "=== To abort, close this page, or hit the 'Stop' button in your browser ===\n[[Special:LinkTitles|Return to Special:LinkTitles.]]",
+ "linktitles-special-completed-info": "== Batch processing completed! ==\n{| class=\"wikitable\"\n|-\n| total number of pages: || $1\n|-\n| timeout setting [s]: || $2\n|-\n| webpage reloads: || $3\n|-\n| pages scanned per reload interval: || $4\n|}",
+ "right-linktitles-batch": "Perform a LinkTitles batch operation",
+ "action-linktitles-batch": "perform a LinkTitles batch operation"
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index cd88e0e..8bc06d3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -1,6 +1,11 @@
{
- "linktitles": "Title of the LinkTitles extension; also used for the special page.",
+ "linktitles": "Name of the LinkTitles extension; also used for the special page.",
"linktitles-desc": "Description of the LinkTitles extension.",
- "right-linktitles-batch": "Describes the right to perform a LinkTitles batch operation.",
- "action-linktitles-batch": "Describes the action of performing a LinkTitles batch operation."
+ "linktitles-special-info": "Descriptive text that appears on the Special:LinkTitles page.",
+ "linktitles-special-progress": "Text that is shown on the Special:LinkTitles page while batch processing is executing.",
+ "linktitles-special-page-count": "Number of pages.",
+ "linktitles-special-cancel-notice": "Informs the user how to cancel the LinkTitles batch processing.",
+ "linktitles-special-completed-info": "Text and statistics table that appear when batch processing has completed.",
+ "right-linktitles-batch": "Describes the right to perform a LinkTitles batch operation.",
+ "action-linktitles-batch": "Describes the action of performing a LinkTitles batch operation."
}
diff --git a/includes/Extension.php b/includes/Extension.php
index 9550bb7..2d30046 100644
--- a/includes/Extension.php
+++ b/includes/Extension.php
@@ -27,6 +27,7 @@ namespace LinkTitles;
* Provides event handlers and entry points for the extension.
*/
class Extension {
+ const URL = 'https://github.com/bovender/LinkTitles';
/**
* Event handler for the PageContentSave hook.
diff --git a/includes/Special.php b/includes/Special.php
index 0c6873b..351f009 100644
--- a/includes/Special.php
+++ b/includes/Special.php
@@ -175,21 +175,8 @@ class Special extends \SpecialPage {
* and a form and button to start linking.
*/
private function buildInfoPage( &$request, &$output ) {
+ $output->addWikiText( $this->msg( 'linktitles-special-info', Extension::URL ) );
$url = $request->getRequestURL();
-
- // TODO: Put the page contents in messages in the i18n file.
- $output->addWikiText(
-<<addHTML(
<<
@@ -211,34 +198,18 @@ EOF
$progress = $index / $end * 100;
$percent = sprintf("%01.1f", $progress);
- $output->addWikiText(
+ $output->addWikiText( $this->msg( 'linktitles-special-progress', Extension::URL, $curTitle ) );
+ $pageInfo = $this->msg( 'linktitles-page-count', $index, $end );
+ $output->addWikiText( 'linktitles-special-page-count', $index, $end );
+ $output->addHTML( // TODO: do not use the style attribute (to make it work with CSP-enabled sites)
<<addHTML(
-<<Page ${index} of ${end}.
-
-
- ${percent}%
-
+
+ ${percent}%
EOF
);
- $output->addWikiText(
-<<addWikiText( $this->msg( 'linktitles-special-cancel-notice' ) );
}
/**
@@ -276,20 +247,10 @@ EOF
private function addCompletedInfo( &$output, $start, $end, $reloads ) {
$pagesPerReload = sprintf('%0.1f', $end / $reloads);
$output->addWikiText(
-<<specialPageReloadAfter}
-|-
-| webpage reloads: || ${reloads}
-|-
-| pages scanned per reload interval: || ${pagesPerReload}
-|}
-EOF
- );
+ $this->msg( 'linktitltes-special-completed-info', $end,
+ $config->specialPageReloadAfter, $reloads, $pagesPerReload
+ )
+ );
}
/**
From a0449eaf6d3f8719e1d8427c94660c0d478ac8d6 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 19:53:03 +0200
Subject: [PATCH 6/8] Fix special page I18N.
---
i18n/de.json | 3 ++-
i18n/en.json | 1 +
i18n/qqq.json | 1 +
includes/Special.php | 17 ++++++++---------
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/i18n/de.json b/i18n/de.json
index 20d87ff..24b9b35 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -1,7 +1,8 @@
{
"linktitles": "LinkTitles",
"linktitles-desc": "Fügt beim Speichern von Seiten automatisch Querverweise zu vorhandenen Seiten ein.",
- "linktitles-special-info": "LinkTitles-Erweiterung: $1\n== Stapelverarbeitung ==\nKlicken Sie auf den Button, um die Stapelverarbeitung zu beginnen. Die Erweiterung wird nacheinander alle Seiten Ihres Wikis mit automatischen Links versehen. Um zu verhindern, daß der Server bei der Ausführung blockiert wird, wird diese Seite sich wiederholt selbst aufrufen. Um die Stapelverarbeitung abzubrechen, schließen Sie einfach diese Seite.",
+ "linktitles-special-info": "LinkTitles-Erweiterung: <$1>\n== Stapelverarbeitung ==\nKlicken Sie auf den Button, um die Stapelverarbeitung zu beginnen. Die Erweiterung wird nacheinander alle Seiten Ihres Wikis mit automatischen Links versehen. Um zu verhindern, daß der Server bei der Ausführung blockiert wird, wird diese Seite sich wiederholt selbst aufrufen. Um die Stapelverarbeitung abzubrechen, schließen Sie einfach diese Seite.",
+ "linktitles-special-submit": "Stapelverarbeitung beginnen",
"linktitles-special-progress": "== Verarbeite die Seiten... ==\nDie [$1 LinkTitles-Erweiterung] verarbeitet gerade alle Seiten Ihres Wikis.\n=== Aktuelle Seite: $2 ===",
"linktitles-special-page-count": "Seite $1 von $2.\n",
"linktitles-special-cancel-notice": "=== Um abzubrechen, schließen Sie diese Seite, oder klicken Sie den 'Stopp'-Knopf in Ihrem Browser ===\n[[Special:LinkTitles|Zu Special:LinkTitles zurückkehren.]]",
diff --git a/i18n/en.json b/i18n/en.json
index dfa6ac2..251f206 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -2,6 +2,7 @@
"linktitles": "LinkTitles",
"linktitles-desc": "Automatically adds links to existing pages whenever a page is saved.",
"linktitles-special-info": "LinkTitles extension: $1\n== Batch Linking ==\nYou can start a batch linking process by clicking on the button below. This will go through every page in the normal namespace of your Wiki and insert links automatically. This page will repeatedly reload itself, in order to prevent blocking the server. To interrupt the process, simply close this page.",
+ "linktitles-special-submit": "Start linking now",
"linktitles-special-progress": "== Processing pages... ==\nThe [$1 LinkTitles] extension is currently going through every page of your wiki, adding links to existing pages as appropriate.\n=== Current page: $2 ===",
"linktitles-special-page-count": "Page $1 of $2.\n",
"linktitles-special-cancel-notice": "=== To abort, close this page, or hit the 'Stop' button in your browser ===\n[[Special:LinkTitles|Return to Special:LinkTitles.]]",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8bc06d3..0762bfc 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -2,6 +2,7 @@
"linktitles": "Name of the LinkTitles extension; also used for the special page.",
"linktitles-desc": "Description of the LinkTitles extension.",
"linktitles-special-info": "Descriptive text that appears on the Special:LinkTitles page.",
+ "linktitles-special-submit": "Label for submit button to start linking.",
"linktitles-special-progress": "Text that is shown on the Special:LinkTitles page while batch processing is executing.",
"linktitles-special-page-count": "Number of pages.",
"linktitles-special-cancel-notice": "Informs the user how to cancel the LinkTitles batch processing.",
diff --git a/includes/Special.php b/includes/Special.php
index 351f009..27ca411 100644
--- a/includes/Special.php
+++ b/includes/Special.php
@@ -175,12 +175,13 @@ class Special extends \SpecialPage {
* and a form and button to start linking.
*/
private function buildInfoPage( &$request, &$output ) {
- $output->addWikiText( $this->msg( 'linktitles-special-info', Extension::URL ) );
+ $output->addWikiMsg( 'linktitles-special-info', Extension::URL );
$url = $request->getRequestURL();
+ $submitButtonLabel = $this->msg( 'linktitles-special-submit' );
$output->addHTML(
<<
-
+
EOF
@@ -198,9 +199,9 @@ EOF
$progress = $index / $end * 100;
$percent = sprintf("%01.1f", $progress);
- $output->addWikiText( $this->msg( 'linktitles-special-progress', Extension::URL, $curTitle ) );
+ $output->addWikiMsg( 'linktitles-special-progress', Extension::URL, $curTitle );
$pageInfo = $this->msg( 'linktitles-page-count', $index, $end );
- $output->addWikiText( 'linktitles-special-page-count', $index, $end );
+ $output->addWikiMsg( 'linktitles-special-page-count', $index, $end );
$output->addHTML( // TODO: do not use the style attribute (to make it work with CSP-enabled sites)
<<
@@ -209,7 +210,7 @@ EOF
EOF
);
- $output->addWikiText( $this->msg( 'linktitles-special-cancel-notice' ) );
+ $output->addWikiMsg( 'linktitles-special-cancel-notice' );
}
/**
@@ -246,10 +247,8 @@ EOF
*/
private function addCompletedInfo( &$output, $start, $end, $reloads ) {
$pagesPerReload = sprintf('%0.1f', $end / $reloads);
- $output->addWikiText(
- $this->msg( 'linktitltes-special-completed-info', $end,
- $config->specialPageReloadAfter, $reloads, $pagesPerReload
- )
+ $output->addWikiMsg( 'linktitltes-special-completed-info', $end,
+ $config->specialPageReloadAfter, $reloads, $pagesPerReload
);
}
From fa9d10bd639e44330dc210a446309f9f55aa2af1 Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 20:02:31 +0200
Subject: [PATCH 7/8] Localize comment that is added by processPage.
- Improved: The comment that is added when pages are edited by the maintenance script can now be translated using a message.
---
i18n/de.json | 1 +
i18n/en.json | 1 +
i18n/qqq.json | 1 +
includes/Extension.php | 2 +-
4 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/i18n/de.json b/i18n/de.json
index 24b9b35..448b258 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -7,6 +7,7 @@
"linktitles-special-page-count": "Seite $1 von $2.\n",
"linktitles-special-cancel-notice": "=== Um abzubrechen, schließen Sie diese Seite, oder klicken Sie den 'Stopp'-Knopf in Ihrem Browser ===\n[[Special:LinkTitles|Zu Special:LinkTitles zurückkehren.]]",
"linktitles-special-completed-info": "== Stapelverarbeitung abgeschlossen! ==\n{| class=\"wikitable\"\n|-\n| Anzahl der verarbeiteten Seiten: || $1\n|-\n| Verarbeitungsintervall [s]: || $2\n|-\n| Reloads: || $3\n|-\n| Seiten pro Reload: || $4\n|}",
+ "linktitles-bot-comment": "Die LinkTitles-Erweiterung hat automatisch Links zu anderen Seiten hinzugefügt ($1).",
"right-linktitles-batch": "LinkTitles-Stapelverarbeitung ausführen",
"action-linktitles-batch": "LinkTitles-Stapelverarbeitung auszuführen"
}
diff --git a/i18n/en.json b/i18n/en.json
index 251f206..5481835 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,6 +7,7 @@
"linktitles-special-page-count": "Page $1 of $2.\n",
"linktitles-special-cancel-notice": "=== To abort, close this page, or hit the 'Stop' button in your browser ===\n[[Special:LinkTitles|Return to Special:LinkTitles.]]",
"linktitles-special-completed-info": "== Batch processing completed! ==\n{| class=\"wikitable\"\n|-\n| total number of pages: || $1\n|-\n| timeout setting [s]: || $2\n|-\n| webpage reloads: || $3\n|-\n| pages scanned per reload interval: || $4\n|}",
+ "linktitles-bot-comment": "The LinkTitles extension automatically added links to existing pages ($1).",
"right-linktitles-batch": "Perform a LinkTitles batch operation",
"action-linktitles-batch": "perform a LinkTitles batch operation"
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0762bfc..e49d4c4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -7,6 +7,7 @@
"linktitles-special-page-count": "Number of pages.",
"linktitles-special-cancel-notice": "Informs the user how to cancel the LinkTitles batch processing.",
"linktitles-special-completed-info": "Text and statistics table that appear when batch processing has completed.",
+ "linktitles-bot-comment": "Comment to add when pages are processed by LinkTitles\\Extension::processPage. The parameter may take the URL the the extension's homepage.",
"right-linktitles-batch": "Describes the right to perform a LinkTitles batch operation.",
"action-linktitles-batch": "Describes the action of performing a LinkTitles batch operation."
}
diff --git a/includes/Extension.php b/includes/Extension.php
index 2d30046..d46cad8 100644
--- a/includes/Extension.php
+++ b/includes/Extension.php
@@ -84,7 +84,7 @@ class Extension {
$content = $source->getContent()->getContentHandler()->unserializeContent( $result );
$source->getPage()->doEditContent(
$content,
- "Links to existing pages added by LinkTitles bot.", // TODO: i18n
+ \wfMessage( 'linktitles-bot-comment', self::URL ),
EDIT_MINOR | EDIT_FORCE_BOT,
false, // baseRevId
$context->getUser()
From 012817eb92a372aafd0e4261e9c556d61cdbd3be Mon Sep 17 00:00:00 2001
From: Daniel Kraus
Date: Sun, 3 Sep 2017 20:04:59 +0200
Subject: [PATCH 8/8] Prepare release 5.0.1.
---
NEWS | 33 +++++++++++++++++++++++++++++++++
extension.json | 2 +-
gh-pages | 2 +-
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 500ec0c..d9c29f2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,39 @@
+Version 5.0.1 (2017-09-03)
+------------------------------------------------------------------------
+
+- Fix: Detection of existing links had a bug.
+- Fix: Do not crash when testing redirect target on empty page.
+- Improved: Special Page can now be translated using messages.
+- Improved: The comment that is added when pages are edited by the maintenance script can now be translated using a message.
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+
Version 5.0.0 (2017-09-01)
------------------------------------------------------------------------
+Version 5 is a major rewrite of the LinKTitles extension. The code is
+now much better organized, and it included automatic (unit) testing,
+which will greatly facilitate future maintenance and development.
+
+Namespace support was overhauled, and a couple of **breaking changes**
+were introduced in this version. Most notably, the
+`$wgLinkTitlesNamespaces` configuration variable was removed and
+replaced with `$wgLinKTitlesSourceNamespaces`,
+`$wgLinkTitlesTargetNamespaces`, and `$wgLinkTitlesSameNamespace`.
+`$wgLinKTitlesTimeLimit` was renamed to
+`$wgLinkTitlesSpecialPageReloadAfter`.
+
+Version 5 offers more fine-grained control over where to link and what
+to link. In addition to the `__NOAUTOLINKS__` and
+`__NOAUTOLINKSTARGET__` magic words, you can have
+`..` and `..` tags in your
+page source to explicitly include or exclude sections from linking.
+
+Several long-standing bugs were fixed.
+
+Please see the detailed documentation in the README.md file, and the
+NEWS file.
- 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.
diff --git a/extension.json b/extension.json
index 45470f8..7503d0b 100644
--- a/extension.json
+++ b/extension.json
@@ -9,7 +9,7 @@
],
"type": "parserhook",
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
- "version": "5.0.0",
+ "version": "5.0.1",
"license-name": "GPL-2.0+",
"descriptionmsg": "linktitles-desc",
"requires": {
diff --git a/gh-pages b/gh-pages
index b89d3cf..55f2ec1 160000
--- a/gh-pages
+++ b/gh-pages
@@ -1 +1 @@
-Subproject commit b89d3cf098636f3ecb2e5bc57441cd23203bdd54
+Subproject commit 55f2ec1fc1381085299106a1126cc19d0c3cab9f