Inform about MW 1.32+ compatibility.

This commit is contained in:
Daniel Kraus
2019-12-31 14:13:18 +01:00
parent 3525202e88
commit a267a0da2d
5 changed files with 147 additions and 90 deletions

View File

@ -1,6 +1,10 @@
.PHONY: test .PHONY: test
test: test:
# With MW version 1.34, there is one test that is expected to fail
# because linking on page save no longer works with MediaWiki 1.32
# and newer. The test that is expected to fail is:
# ExtensionTest::testParseOnEdit with data set #0
docker run -it --rm bovender/linktitles docker run -it --rm bovender/linktitles
build-test-container: build-test-container:

24
NEWS.md Normal file
View File

@ -0,0 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
For changes prior to version 6.0.0, please see [`NEWS.old`](news.old).
## [6.0.0][] - 2019-12-31
### Changed
- Because automatic linking upon page save no longer works with MediaWiki
versions 1.32 and newer, the default value of the `$wgLinkTitlesParseOnRender`
is now `true`. Please see `README.md` for more information.
### Fixed
- Prevent crash that occurred with MediaWiki version 1.34 due to a renamed
constant (DB_SLAVE was renamed to DB_REPLICA). NOTE that the minimum
required version of MediaWiki is now 1.28 (which is an obsolete version).
[6.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v6.0.0

View File

View File

@ -4,7 +4,7 @@ LinkTitles
[MediaWiki extension](https://www.mediawiki.org/wiki/Extension:LinkTitles) that [MediaWiki extension](https://www.mediawiki.org/wiki/Extension:LinkTitles) that
automatically adds links to words that match titles of existing pages. automatically adds links to words that match titles of existing pages.
Minimum requirements: MediaWiki 1.25, PHP 5.3. Source code documentation can be Minimum requirement: MediaWiki 1.28. Source code documentation can be
found at the [Github project pages](https://bovender.github.io/LinkTitles). found at the [Github project pages](https://bovender.github.io/LinkTitles).
@ -14,7 +14,8 @@ Table of contents
1. [Oveview](#overview) 1. [Oveview](#overview)
- [Versions](#versions) - [Versions](#versions)
2. [Installation](#installation) 2. [Installation](#installation)
3. [Usage](#usage) 3. [Important note for MediaWiki versions 1.32 and newer](#important-note-for-mediawiki-versions-1.32-and-newer)
4. [Usage](#usage)
- [Editing a page](#editing-a-page) - [Editing a page](#editing-a-page)
- [Preventing automatic linking after minor edits](#preventing-automatic-linking-after-minor-edits) - [Preventing automatic linking after minor edits](#preventing-automatic-linking-after-minor-edits)
- [Viewing a page](#viewing-a-page) - [Viewing a page](#viewing-a-page)
@ -24,7 +25,7 @@ Table of contents
- [Batch processing](#batch-processing) - [Batch processing](#batch-processing)
- [Special:LinkTitles](#special-linktitles) - [Special:LinkTitles](#special-linktitles)
- [Maintenance script](#maintenance-script) - [Maintenance script](#maintenance-script)
4. [Configuration](#configuration) 5. [Configuration](#configuration)
- [Linking when a page is edited and saved](#linking-when-a-page-is-edited-and-saved) - [Linking when a page is edited and saved](#linking-when-a-page-is-edited-and-saved)
- [Linking when a page is rendered for display](#linking-when-a-page-is-rendered-for-display) - [Linking when a page is rendered for display](#linking-when-a-page-is-rendered-for-display)
- [Enabling case-insensitive linking (smart mode)](#enabling-case-insensitive-linking-(smart-mode)) - [Enabling case-insensitive linking (smart mode)](#enabling-case-insensitive-linking-(smart-mode))
@ -37,10 +38,10 @@ Table of contents
- [Multiple links to the same page](#multiple-links-to-the-same-page) - [Multiple links to the same page](#multiple-links-to-the-same-page)
- [Partial words](#partial-words) - [Partial words](#partial-words)
- [Special page configuration](#special-page-configuration) - [Special page configuration](#special-page-configuration)
5. [Development](#development) 6. [Development](#development)
- [Contributors](#contributors) - [Contributors](#contributors)
- [Testing](#testing) - [Testing](#testing)
6. [License](#license) 7. [License](#license)
Overview Overview
@ -75,19 +76,20 @@ are fixed.
Version | Date | Major changes || Version | Date | Major changes ||
-|-|-|- -|-|-|-
6 | 12-2019 | Renamed deprecated MW constant for compatibility with MW version 1.34, minimum required version is 1.28. | [Details][v6.0.0]
5 | 09-2017 | Rewrote the entire extension; vastly improved namespace support; some breaking changes | [Details][v5.0.0] 5 | 09-2017 | Rewrote the entire extension; vastly improved namespace support; some breaking changes | [Details][v5.0.0]
4 | 11-2016 | Changed format of the extension for MediaWiki version 1.25; added basic namespace support | [Details][v4.0.0] 4 | 11-2016 | Changed format of the extension for MediaWiki version 1.25; added basic namespace support | [Details][v4.0.0]
3 | 02-2015 | Added magic words; improved performance | [Details][3.0.0] 3 | 02-2015 | Added magic words; improved performance | [Details][3.0.0]
2 | 11-2013 | Introduced smart mode | [Details][2.0.0] 2 | 11-2013 | Introduced smart mode | [Details][2.0.0]
1 | 05-2012 | First stable release | 1 | 05-2012 | First stable release |
[v6.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v6.0.0
[v5.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v5.0.0 [v5.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v5.0.0
[v4.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v4.0.0 [v4.0.0]: https://github.com/bovender/LinkTitles/releases/tag/v4.0.0
[3.0.0]: https://github.com/bovender/LinkTitles/compare/2.4.1...3.0.0 [3.0.0]: https://github.com/bovender/LinkTitles/compare/2.4.1...3.0.0
[2.0.0]: https://github.com/bovender/LinkTitles/compare/1.8.1...2.0.0 [2.0.0]: https://github.com/bovender/LinkTitles/compare/1.8.1...2.0.0
For more details, click the 'Details' links, see the `NEWS` file in the For more details, click the 'Details' links, see the `NEWS.md` file in the
repository for a user-friendly changelog, or study the commit messages. repository for a user-friendly changelog, or study the commit messages.
@ -113,17 +115,43 @@ Do not forget to adjust the [configuration](#configuration) to your needs.
If your MediaWiki version is really old (1.24 and older), you need to use If your MediaWiki version is really old (1.24 and older), you need to use
a [different mechanism](https://www.mediawiki.org/wiki/Manual:Extensions#Installing_an_extension). a [different mechanism](https://www.mediawiki.org/wiki/Manual:Extensions#Installing_an_extension).
Important note for MediaWiki versions 1.32 and newer
----------------------------------------------------
**Links can no longer be automatically added when a page is saved with
MediaWiki versions 1.32 and newer.** This is because MediaWiki changed the
signature of an important callback function. See [GitHub issue #43][issue-43]
and [T222413][] for more information. There's a slight chance that link-on-edit
will work again in a future version of MediaWiki (that is, if/when pull request
[467308][] is merged). Until that happens, admins are advised to use the
link-on-render feature (which is now enabled by default).
A workaround is to set up a cron job for the command-line tool, e.g.
# /etc/crontab
# Runs at 1 a.m. every morning.
# m h dom mon dow user command
0 1 * * * www-data php -f /var/www/html/extensions/LinkTitles/linktitles-cli.php
[issue-43]: https://github.com/bovender/LinkTitles/issues/43
[T222413]: https://phabricator.wikimedia.org/T222413
[467308]: https://gerrit.wikimedia.org/r/467308
Usage Usage
----- -----
### Editing a page ### Editing a page
By default, the LinkTitles extension will add links to existing pages whenever *By default, the LinkTitles extension will **no longer** add links to existing
you edit and save a page. Unless you changed the configuration variables, it will pages whenever you edit and save a page. This is because MediaWiki 1.32 changed
link whole words only, prefer longer target page titles over shorter ones, skip an important callback function that the LinkTitles extension relied on (see above).*
headings, and add multiple links if a page title appears more than once on the
page. All of this is configurable; see the [Configuration](#configuration) When linking-on-edit is enabled (with MW versions prior to 1.33), the extension
section. will by default link whole words only, prefer longer target page titles over
shorter ones, skip headings, and add multiple links if a page title appears
more than once on the page. All of this is configurable; see the
[Configuration](#configuration) section.
### Preventing automatic linking after minor edits ### Preventing automatic linking after minor edits
@ -436,9 +464,9 @@ Development
----------- -----------
If you wish to contribute, please issue pull requests against the `develop` If you wish to contribute, please issue pull requests against the `develop`
branch, as I follow Vincent Driessen's advice on [A successful Git branching branch, as I roughly follow Vincent Driessen's advice on [A successful Git
model](http://nvie.com/git-model) (knowing that there are [alternative branching model](http://nvie.com/git-model) (knowing that there are
workflows](http://scottchacon.com/2011/08/31/github-flow.html)). [alternative workflows](http://scottchacon.com/2011/08/31/github-flow.html)).
The `master` branch contains stable releases only, so it is safe to pull the The `master` branch contains stable releases only, so it is safe to pull the
master branch if you want to install the extension for your own Wiki. master branch if you want to install the extension for your own Wiki.
@ -475,7 +503,7 @@ use Ubuntu).
git clone --depth 1 https://phabricator.wikimedia.org/source/mediawiki.git git clone --depth 1 https://phabricator.wikimedia.org/source/mediawiki.git
2. Install [composer](https://getcomposer.org) locally and fetch the 2. Install [composer](https://getcomposer.org) locally and fetch the
dependencies (including development dependencies): dependencies (including development dependencies):
Follow the instructions on the [composer download page](https://getcomposer.org/download), Follow the instructions on the [composer download page](https://getcomposer.org/download),
but instead of running `php composer-setup.php`, run: but instead of running `php composer-setup.php`, run:
@ -484,12 +512,12 @@ dependencies (including development dependencies):
bin/composer install bin/composer install
3. Install phpunit (it was already installed on my Ubuntu system when I began 3. Install phpunit (it was already installed on my Ubuntu system when I began
testing LinkTitles, so I leave it up to you to figure out how to do it). testing LinkTitles, so I leave it up to you to figure out how to do it).
4. Copy your `LocalSettings.php` over from your local MediaWiki installation 4. Copy your `LocalSettings.php` over from your local MediaWiki installation
and remove (or comment out) any lines that reference extensions or skins that and remove (or comment out) any lines that reference extensions or skins that
you are not going to install to your test environment. For the purposes of you are not going to install to your test environment. For the purposes of
testing the LinkTitles extension, leave the following line in place: testing the LinkTitles extension, leave the following line in place:
wfLoadExtensions( 'LinkTitles' ); wfLoadExtensions( 'LinkTitles' );
@ -503,7 +531,7 @@ testing the LinkTitles extension, leave the following line in place:
ln -s ~/Code/LinkTitles ln -s ~/Code/LinkTitles
6. Make sure your local MediaWiki instance is up to date. Otherwise phpunit may 6. Make sure your local MediaWiki instance is up to date. Otherwise phpunit may
fail and tell you about database problems. fail and tell you about database problems.
This is because the local database is used as a template for the unit tests. This is because the local database is used as a template for the unit tests.
For example, I initially had MW 1.26 installed on my laptop, but the cloned For example, I initially had MW 1.26 installed on my laptop, but the cloned
@ -523,7 +551,7 @@ fail and tell you about database problems.
License License
------- -------
Copyright 2012-2018 Daniel Kraus <mailto:bovender@bovender.de> (@bovender) Copyright 2012-2020 Daniel Kraus <mailto:bovender@bovender.de> (GitHub: @bovender)
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -6,19 +6,20 @@
"Brent Laabs (labster)", "Brent Laabs (labster)",
"tetsuya-zama", "tetsuya-zama",
"yoshida", "yoshida",
"Caleb Mingle (dentafrice)" "Caleb Mingle (dentafrice)",
"paladox"
], ],
"type": "parserhook", "type": "parserhook",
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles", "url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
"version": "5.0.7", "version": "6.0.0",
"license-name": "GPL-2.0+", "license-name": "GPL-2.0+",
"descriptionmsg": "linktitles-desc", "descriptionmsg": "linktitles-desc",
"requires": { "requires": {
"MediaWiki": ">= 1.25.0" "MediaWiki": ">= 1.28.0"
}, },
"config": { "config": {
"LinkTitlesParseOnEdit": true, "LinkTitlesParseOnEdit": true,
"LinkTitlesParseOnRender": false, "LinkTitlesParseOnRender": true,
"LinkTitlesParseHeadings": false, "LinkTitlesParseHeadings": false,
"LinkTitlesSkipTemplates": true, "LinkTitlesSkipTemplates": true,
"LinkTitlesPreferShortTitles": true, "LinkTitlesPreferShortTitles": true,