Extension:ExternalLinks
|
ExternalLinks Release status: stable |
|
|---|---|
| Implementation | Special page |
| Description | Returns a list of all external links on the wiki |
| Author(s) | Subfader |
| Last version | 1.1.2 (2012-11-16) |
| MediaWiki | 1.12+ (check) |
| Database changes | no (optional) |
| License | GPL |
| Download | See here |
| Example | Screenshots: 1, 2 |
Contents |
Description [edit]
This extension adds [[Special:ExternalLinks]] which lists all external links used on the wiki including dynamic URLs by templates.
The results table lists the pages which use the URL (edit link with preview).
URLs can be filtered with a truncated text string.
URL validation [edit]
The extension also works as link checker by validating the reported URLs.
For each result page you can let PHP check the availability of each URL target by reporting its server response header (requires the $wgELvalidationMode setting, see below).
You could also use a browser plugin like Pinger for Firefox.
Although e-mail addresses cannot be validated too easily, they can be added to the report list.
Download & Installation [edit]
Download and extract it into your extensions folder:
Add this to 'LocalSettings.php' in your wiki installation folder.
require_once( "$IP/extensions/ExternalLinks/ExternalLinks.php" );
[[Special:ExternalLinks]] should appear on your Special:Version.
Configuration [edit]
$wgELuserRight- Override the default user right "edit" which is required to view the page.
$wgELtableClass- Add class names to the result table.
$wgELpageLinkClass- Add class names to the page (article) links.
$wgELmaxPerPage- Overrides the default 200 results per page.
$wgELenableSessionStoring- Enables the options
- Mark all URLs on result pages as "checked today"
- Last validation older than: X days
- Requires a new date row 'el_last_validated' in table 'externallinks' (see #Skip previously checked URLs).
$wgELvalidationMode- Define the validation mode, e.g.
$wgELvalidationMode = 'cURL';. - If enabled, this setting will ignore your $wgMiserMode setting and can slow down your server.
- Options:
- "
cURL" uses cURL as PHP extension. This validation mode is recommended.
Inphpinfo()"cURL support" should be "enabled". - "
getHeaders" uses PHP's get_headers() and requiresallow_url_fopen = on(security risk!) and only supports thehttp://-protocol.
Inphpinfo()"allow_url_fopen" should be "on".
- "
$wgELvalidationMaxPerPage- Validating URLs with a
$wgELvalidationModecan take very long. If$wgELvalidationModeis set, the default number of results (or$wgELmaxPerPage) is overwritten with a new maximum of 25. Override these 25 with$wgELvalidationMaxPerPage. $wgELtoolboxLink- Adds a toolbox link in the sidebar to "validate external URLs" used on the current page. The link will appear on non-special pages to users allowed by
$wgELuserRight.
Example configuration [edit]
require_once( "$IP/extensions/ExternalLinks/ExternalLinks.php" ); $wgELuserRight = 'delete'; // default: edit $wgELtableClass = "wikitable sortable alternate"; // default: "wikitable sortable" $wgELpageLinkClass = "targetBlank"; $wgELmaxPerPage = 100; // default: 200 $wgELenableSessionStoring = true; // default: false (requires a new date row 'el_last_validated' in table 'externallinks') $wgELvalidationMode = 'cURL'; // default: none (disabled) $wgELvalidationMaxPerPage = '50'; // default: 25 $wgELtoolboxLink = true; // default: false
Skip previously checked URLs [edit]
Optional: When you validate URLs you can store the date and skip these URLs next time, e.g. by hiding all URLs which have been validated (and stored) in the past X days.
$wgELenableSessionStoring = true; will add the option Mark all URLs on result pages as "checked today".
To store the date you need to add a new row el_last_validated to the externallinks-table. Run this SQL command:
ALTER TABLE `externallinks` ADD `el_last_validated` DATE NOT NULL
With stored dates you can later use the option Last validation is older than: [___] days
Contribution [edit]
Translations [edit]
Translations can be posted here.
Coding [edit]
Please post if you have a working solution for
- grouping results of different wiki pages with the same URL (same URLs should only be listed once with a list of the pages they're used on, should also work with
$wgELtoolboxLink) - a page name filter that excludes pages with a given string (like URL string filter)
- a namespace selector as on Special:Search
- validating https-URLs
- validating flash-URLs (
*.swf?foo=bar) - removing the toolbox link if the page doesn't use external URLs
- This can be tricky since a simple javascript check for a link is not enough. An URL could be used in a templare to produce some content without a link of that URL (varying link, flash content, etc.).
MW version tests [edit]
In theory this should work in MediaWiki 1.5+ where the "externallinks"-table was introduced. Nontheless it would be nice if this was tested.
- Tested and working on MW 1.19.2 --Stefahn (talk) 16:32, 25 October 2012 (UTC)
- Tested and working on MW 1.19.1 --Nrobbins (talk) 19:50, 9 October 2012 (UTC)
- Tested and working on MW 1.18.1 --Subfader (talk) 21:11, 29 June 2012 (UTC)
- Tested and working on MW 1.16alpha --Subfader (talk) 21:11, 29 June 2012 (UTC)
Versions [edit]
- 1.1.2 (2012-11-16) bug fix (
$wgELuserRightis now really optional and falls back to 'edit', thanks User:Stefahn) - 1.1.1 (2012-10-19) bug fix of 1.1 for MW 1.15 and below
- 1.1 (2012-10-16) Postgres support (thanks User:Hbswn),
$wgELtoolboxLinkadds a new toolbox-link to validate all URLs on the current page, i18n improvements - 1.0 (2012-07-14) cURL support,
$wgELvalidationMaxPerPage, URL exclude input,$wgELenableSessionStoring - 0.1 (2012-06-29) Extension added