Manual:refreshLinks.php

From MediaWiki.org
(Redirected from RefreshLinks.php)
Jump to: navigation, search
Translate this page; This page contains changes which are not marked for translation.

Other languages:
català • ‎Deutsch • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Nederlands • ‎polski • ‎português • ‎português do Brasil

Details[edit]

refreshLinks.php file is a maintenance script to [re]fill pagelinks, categorylinks, imagelinks tables. You should run it if you found that Categories are empty or don't show all pages, if "What links here?" doesn't work well or in some other link-related trouble. Additionally this script purges those links, which point to non-existing pages, from the tables pagelinks, imagelinks, categorylinks, templatelinks, externallinks, iwlinks, langlinks, redirect, and page_props.

Usage[edit]

Basic[edit]

php maintenance/refreshLinks.php [starting_article]

for example, if you want the script to start with the page with id 8000:

php maintenance/refreshLinks.php 8000

Advanced[edit]

php refreshLinks.php [--conf|--dbpass|--dbuser|--dfn-only|--e|--globals|--help|--m|--new-only|--old-redirects-only|--quiet|--redirects-only|--wiki] <start>

Parameters[edit]

Option/Parameter Description
--dfn-only Delete links from nonexistent articles only
--e <page_id> Last page id to refresh
--m <max_lag> Maximum replication lag
--new-only Only affect articles with just a single edit
--old-redirects-only Only fix redirects with no redirect table entry
--redirects-only Only fix redirects, not all links
--wiki For specifying the wiki ID
--help Show help text
--category Only fix pages in this category
--tracking-category Only fix pages in this tracking category
<start> Article number (page_id) to start at
no parameters Will refresh all articles

This also supports the common options as well.

Example output[edit]

me@server:/var/www/htdocs/mw/w/maintenance$ php refreshLinks.php
Refreshing redirects table.
Starting from page_id 1 of 309.
100
200
300
Refreshing links tables.
Starting from page_id 1 of 309.
100         
200
300
Retrieving illegal entries from pagelinks... 0..0
Retrieving illegal entries from imagelinks... 0..0
Retrieving illegal entries from categorylinks... 0..0
Retrieving illegal entries from templatelinks... 0..0
Retrieving illegal entries from externallinks... 0..0
Retrieving illegal entries from iwlinks... 0..0
Retrieving illegal entries from langlinks... 0..0
Retrieving illegal entries from redirect... 0..0
Retrieving illegal entries from page_props... 0..0

Avoiding memory issues[edit]

This script may run into memory issues. To avoid this you may like to set a last page_id to refresh.

php refreshLinks.php --e 1500

To do the next set of page_ids you enter

php refreshLinks.php --e 3000 -- 1500

Just continue until all page ids in your wiki were refreshed.

If you forgot to set a last page_id to refresh and the script runs out of memory simply rerun it with the last output page_id as the article to start at, e.g.

php refreshLinks.php -- 1600