Extension:BrokenLinks

This special page was written for a small wiki (150 articles) which has a small editing team. We wanted a quick(er) way to check external links throughout the article without having to visit each article to do so. This was written to help our administration, just thought someone else somewhere might want the same thing.

The page will collect URLs from table Externallinks_table and check each URL in turn for a successful server response. It then reports those links, and the page(s) they appear on, which fail to respond.

If you're looking for a tool to use on a large wiki, try: w:en:User:Dispenser/Link_checker

News

 * 2009-06-09: Released version 0.1

Compatibility
Tested on our release of MediaWiki 1.14.0 only.

On MediaWiki 1.18.1 you have to make a little change in BrokenLinks.php (about line 59)

Instead of you have to write Otherwise you will get this error: Catchable fatal error: Argument 1 passed to ContextSource::setContext must implement interface IContextSource, null given, called in /path/to/your/wiki/includes/OutputPage.php on line 228 and defined in /path/to/your/wiki/includes/RequestContext.php on line 348

In the BrokenLinks.php file if you have a DB server that needs a PREFIX you will have to change the code that reads the DB to this. $page = $dbr->tableName( $wgDBprefix.'page' ); $externallinks = $dbr->tableName( $wgDBprefix.'externallinks' );

Usage
Install, as per the instructions below, then go to your wiki/Special:BrokenLinks. Select the number of errors you wish to report on and click the button.

Since the script simply steps through each URL in turn the response may take some time, as each URL will have a timeout to observe.

Download instructions
Please cut and paste the code found below and place it in.
 * Note #1: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
 * Note #2: You must provide a link to an Ajax loading image in the .js file that you create (BrokenLinks.js) in order for this extension to work. For example: var ajax_loader = '';

Installation
To install this extension, add the following to LocalSettings.php:

extensions/BrokenLinks/BrokenLinks.js
That's the lot.