Checklinks Action Documentation
Not included in official Wikka versionSee also:
Development: ChecklinksAction.Documentation
Short description
This administration tool checks the validity of hyperlinks on some or all of the wiki pages and displays a report of broken links.Parameters
name | type | required? | default | description |
---|---|---|---|---|
scope | string | optional | user | Allowed values are 'page' (check only this page), 'user' (check all pages owned by current user) and 'all' (check all pages for which current user has ACL-read-access) |
sort | string | optional | tag | Allowed values are 'tag' (sort on page tag), 'type' (sort on link type) and 'cnt' (sort on occurences count) |
opts | string | optional | Options: any combination of 'i' (internal=do not check external web pages), 't' (terse=show only summary report) and 'w' (check page tag format, i.e. that it is formatted as a valid WikiWord) |
Long description
Link checkers are a standard administration tool for webmasters and can be run on a wiki site. However, a standard link checker has the following drawbacks when used with WikkaWiki:- as it is not a registered wiki user, it can be denied access to ACL-protected pages
- it checks older versions of each page, adding significantly to execution time
- it is not always able to check for 'file://' hyperlinks
- it cannot point out non-existent (i.e. wanted) wiki pages, as the corresponding hyperlink points to an (existing) WikiWord/edit page tag
This action is a link checker adapted to the wiki context. It goes over the latest version of all wikka pages accessible in read mode to the current user and checks for the validity of various types of hyperlinks appearing on these pages.
Link categories checked are:
- intra-wiki (page) links ;
- inter-wiki links ;
- other web pages hosted on the same or a different server ;
- files on a local or shared directory ;
- actions.
When run by a Wiki Admin with a scope="all" parameter value, it checks the integrality of the wiki content.
Usage
{{checklinks [scope="page"] [sort="type"] [opts="[i][t][w]"]}}
Example
Let's create on purpose on this page a NonExistentWikiPageLink, a non-existent external link and a non-existent file link.The output of {{checklinks scope="page"}} would look like:
Link check summary
Link type | Valid links # | Broken links # |
---|---|---|
Action | 1 | 0 |
External | 1 | 1 |
Inter-wiki | 0 | 0 |
Wiki page | 3 | 1 |
File | 0 | 1 |
Total | 5 | 3 |
Detailed report
Link type | Page name | Link value | Error message | Occurences |
---|---|---|---|---|
File | ChecklinksActionInfo | ./files/nonexistentfile.abc | File not found | 1 |
External | ChecklinksActionInfo | http://www.nonexistentdomain.org/foo.htm | Not Found | 1 |
Wiki page | ChecklinksActionInfo | NonExistentWikiPageLink | Page non-existent | 1 |
To-do, bugs and limitations
- action does not check anchor-based links inside a page.
- action does not handle relative HTTP redirections (e.g. Location: ../foo.php in the HTTP reply header).
- execution time could be a limitation on a large wiki, especially when many external links are involved. Indeed, blocking socket calls are used, and neither multithreading nor parallelization speeds up the processing, so the performance of the external link checking engine is significantly lower than that of dedicated tools.
Other considerations
- the 'non-existent Wiki page' feature is somehow redundant with the WantedPages action. In order to avoid a double counting of non-existent pages, the action ignores all Wantedpages actions.
- credit is given to steven (at) haryan.to and to carinridge (at) hotmail.com for part of the external link checking code.
Author
DomBonjCategoryDocumentation
But sometimes (not always) I get the following errors:
Warning: asort() expects parameter 1 to be array, null given in /home/xxx/wiki2/actions/checklinks.php on line 339
Warning: Invalid argument supplied for foreach() in /home/xxx/wiki2/actions/checklinks.php on line 77
Any tips? I thought it is related to other actions on the page but it isn't.
works fine on my site altought it somehow locked up the mySQL DB when I placed the action on "FormattingRules" with "scope=page". But as nobody will do that I doubt that this is a real problem. Guessing from the logs the script got locked up in a loop.
One suggestion: I suggest excluding all "edit, history, info, revisions, referrers, backlinks etc."-links as they are not "real" links in the sense of pages or outgoing links. This reduces the time needed to check all links significantly.
----
HEAD /HomePage/revisions HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:53 +0100] "HEAD /HomePage/history HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:53 +0100] "HEAD /HomePage HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentChanges/revisions HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentChanges/history HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentChanges HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentlyCommented/revisions HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentlyCommented/history HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /RecentlyCommented HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /UserSettings/revisions HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /UserSettings/history HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /UserSettings HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /PageIndex/revisions HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
83.136.81.242 - - [15/Jan/2007:01:36:54 +0100] "HEAD /PageIndex/history HTTP/1.0" 200 - "-" "WikkaCheckLinks/1.0"
etc.
Thank you for your feedback.
On issue #1, I tested checklinks with both the 1.1.6.0 (http://wikkawiki.org/FormattingRules) and 1.1.6.2 (http://wikkawiki.org/FormattingRules1162) FormattingRules pages, and it worked OK, so I do not know what you experienced.
On issue #2, the behavior you report should definitely not happen. I believe this is due to mod_rewrite (which I had not tested and it seems you are using), so I have uploaded v0.92 which should settle this issue.