mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-12 17:29:30 +02:00
Inform about MW 1.32+ compatibility.
This commit is contained in:
4
Makefile
4
Makefile
@ -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
24
NEWS.md
Normal 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
|
200
README.md
200
README.md
@ -4,43 +4,44 @@ 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).
|
||||||
|
|
||||||
|
|
||||||
Table of contents
|
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)
|
||||||
- [Editing a page](#editing-a-page)
|
4. [Usage](#usage)
|
||||||
- [Preventing automatic linking after minor edits](#preventing-automatic-linking-after-minor-edits)
|
- [Editing a page](#editing-a-page)
|
||||||
- [Viewing a page](#viewing-a-page)
|
- [Preventing automatic linking after minor edits](#preventing-automatic-linking-after-minor-edits)
|
||||||
- [Including and excluding pages with Magic Words](#including-and-excluding-pages-with-magic-words)
|
- [Viewing a page](#viewing-a-page)
|
||||||
- [Enable or disable automatic linking for sections](#enable-or-disable-automatic-linking-for-sections)
|
- [Including and excluding pages with Magic Words](#including-and-excluding-pages-with-magic-words)
|
||||||
- [Namespace support](#namespace-support)
|
- [Enable or disable automatic linking for sections](#enable-or-disable-automatic-linking-for-sections)
|
||||||
- [Batch processing](#batch-processing)
|
- [Namespace support](#namespace-support)
|
||||||
- [Special:LinkTitles](#special-linktitles)
|
- [Batch processing](#batch-processing)
|
||||||
- [Maintenance script](#maintenance-script)
|
- [Special:LinkTitles](#special-linktitles)
|
||||||
4. [Configuration](#configuration)
|
- [Maintenance script](#maintenance-script)
|
||||||
- [Linking when a page is edited and saved](#linking-when-a-page-is-edited-and-saved)
|
5. [Configuration](#configuration)
|
||||||
- [Linking when a page is rendered for display](#linking-when-a-page-is-rendered-for-display)
|
- [Linking when a page is edited and saved](#linking-when-a-page-is-edited-and-saved)
|
||||||
- [Enabling case-insensitive linking (smart mode)](#enabling-case-insensitive-linking-(smart-mode))
|
- [Linking when a page is rendered for display](#linking-when-a-page-is-rendered-for-display)
|
||||||
- [Dealing with custom namespaces](#dealing-with-custom-namespaces)
|
- [Enabling case-insensitive linking (smart mode)](#enabling-case-insensitive-linking-(smart-mode))
|
||||||
- [Linking or skipping headings](#linking-or-skipping-headings)
|
- [Dealing with custom namespaces](#dealing-with-custom-namespaces)
|
||||||
- [Prioritizing pages with short titles](#prioritizing-pages-with-short-titles)
|
- [Linking or skipping headings](#linking-or-skipping-headings)
|
||||||
- [Filtering pages by title length](#filtering-pages-by-title-length)
|
- [Prioritizing pages with short titles](#prioritizing-pages-with-short-titles)
|
||||||
- [Excluding pages from being linked to](#excluding-pages-from-being-linked-to)
|
- [Filtering pages by title length](#filtering-pages-by-title-length)
|
||||||
- [Dealing with templates](#dealing-with-templates)
|
- [Excluding pages from being linked to](#excluding-pages-from-being-linked-to)
|
||||||
- [Multiple links to the same page](#multiple-links-to-the-same-page)
|
- [Dealing with templates](#dealing-with-templates)
|
||||||
- [Partial words](#partial-words)
|
- [Multiple links to the same page](#multiple-links-to-the-same-page)
|
||||||
- [Special page configuration](#special-page-configuration)
|
- [Partial words](#partial-words)
|
||||||
5. [Development](#development)
|
- [Special page configuration](#special-page-configuration)
|
||||||
- [Contributors](#contributors)
|
6. [Development](#development)
|
||||||
- [Testing](#testing)
|
- [Contributors](#contributors)
|
||||||
6. [License](#license)
|
- [Testing](#testing)
|
||||||
|
7. [License](#license)
|
||||||
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
@ -50,17 +51,17 @@ The **LinkTitles** extension automatically adds links to existing page titles
|
|||||||
that occur on a given page. This will automatically cross-reference your wiki
|
that occur on a given page. This will automatically cross-reference your wiki
|
||||||
for you. The extension can operate in three ways that can be used independently:
|
for you. The extension can operate in three ways that can be used independently:
|
||||||
|
|
||||||
1. Whenever a page is edited and saved, the extension will look if any existing
|
1. Whenever a page is edited and saved, the extension will look if any existing
|
||||||
page titles occur in the text, and automatically add links (`[[...]]]`) to the
|
page titles occur in the text, and automatically add links (`[[...]]]`) to the
|
||||||
corresponding pages.
|
corresponding pages.
|
||||||
|
|
||||||
2. Links may also be added on the fly whenever a page is rendered for display.
|
2. Links may also be added on the fly whenever a page is rendered for display.
|
||||||
Most of the time, MediaWiki will fetch previously rendered pages from cache upon
|
Most of the time, MediaWiki will fetch previously rendered pages from cache upon
|
||||||
a page request, but whenever a page is refreshed, the LinkTitles extension can
|
a page request, but whenever a page is refreshed, the LinkTitles extension can
|
||||||
add its page links. These links are not hard-coded in the Wiki text. The
|
add its page links. These links are not hard-coded in the Wiki text. The
|
||||||
original content will not be modified.
|
original content will not be modified.
|
||||||
|
|
||||||
3. Batch mode enables Wiki administrators to process all pages in a Wiki at
|
3. Batch mode enables Wiki administrators to process all pages in a Wiki at
|
||||||
once. Batch processing can either be started from a special page, or from the
|
once. Batch processing can either be started from a special page, or from the
|
||||||
server's command line (see [below](#batch-processing)).
|
server's command line (see [below](#batch-processing)).
|
||||||
|
|
||||||
@ -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.
|
||||||
@ -446,13 +474,13 @@ master branch if you want to install the extension for your own Wiki.
|
|||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
- Daniel Kraus (@bovender), main developer
|
- Daniel Kraus (@bovender), main developer
|
||||||
- Ulrich Strauss (@c0nnex), initial support for namespaces
|
- Ulrich Strauss (@c0nnex), initial support for namespaces
|
||||||
- Brent Laabs (@labster), code review and bug fixes
|
- Brent Laabs (@labster), code review and bug fixes
|
||||||
- @tetsuya-zama, bug fix
|
- @tetsuya-zama, bug fix
|
||||||
- @yoshida3669, namespace-related bug fixes
|
- @yoshida3669, namespace-related bug fixes
|
||||||
- Caleb Mingle (@dentafrice), bug fix
|
- Caleb Mingle (@dentafrice), bug fix
|
||||||
- @paladox, bug fixes
|
- @paladox, bug fixes
|
||||||
|
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
@ -469,61 +497,61 @@ The following assumes that you have an instance of MediaWiki running locally on
|
|||||||
your development machine. This assumes that you are running Linux (I personally
|
your development machine. This assumes that you are running Linux (I personally
|
||||||
use Ubuntu).
|
use Ubuntu).
|
||||||
|
|
||||||
1. Pull the MediaWiki repository:
|
1. Pull the MediaWiki repository:
|
||||||
|
|
||||||
cd ~/Code
|
cd ~/Code
|
||||||
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:
|
||||||
|
|
||||||
php composer-setup.php --install-dir=bin --filename=composer
|
php composer-setup.php --install-dir=bin --filename=composer
|
||||||
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' );
|
||||||
|
|
||||||
And ensure the settings file contains the following:
|
And ensure the settings file contains the following:
|
||||||
|
|
||||||
$wgShowDBErrorBacktrace = true;
|
$wgShowDBErrorBacktrace = true;
|
||||||
|
|
||||||
5. Create a symbolic link to your copy of the LinkTitles repository:
|
5. Create a symbolic link to your copy of the LinkTitles repository:
|
||||||
|
|
||||||
cd ~/Code/mediawiki/extensions
|
cd ~/Code/mediawiki/extensions
|
||||||
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
|
||||||
repository was MW 1.29.1. It's probably also possible to clone the repository
|
repository was MW 1.29.1. It's probably also possible to clone the repository
|
||||||
with a specific version tag which matches your local installation.
|
with a specific version tag which matches your local installation.
|
||||||
|
|
||||||
7. Run the tests:
|
7. Run the tests:
|
||||||
|
|
||||||
cd ~/Code/mediawiki/tests/phpunit
|
cd ~/Code/mediawiki/tests/phpunit
|
||||||
php phpunit.php --group bovender
|
php phpunit.php --group bovender
|
||||||
|
|
||||||
This will run all tests from the 'bovender' group, i.e. tests for my extensions.
|
This will run all tests from the 'bovender' group, i.e. tests for my extensions.
|
||||||
If you linked just the LinkTitles extension in step 5, only this extension
|
If you linked just the LinkTitles extension in step 5, only this extension
|
||||||
will be tested.
|
will be tested.
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -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,
|
||||||
|
Reference in New Issue
Block a user