* (bug 13112) Added Special:RelatedChanges alias to Special:Recentchangeslinked
* (bug 13130) Moved edit token and autosummary fields above edit tools to
reduce broken form submissions
-
+* Add --old-redirects-only option to maintenance/refreshLinks.php, to add old
+ redirects to the redirect table
=== Bug fixes in 1.13 ===
define( "REPORTING_INTERVAL", 100 );
#define( "REPORTING_INTERVAL", 1 );
-function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $redirectsOnly = false ) {
+function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $redirectsOnly = false, $oldRedirectsOnly = false ) {
global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy;
$fname = 'refreshLinks';
$wgUseImageResize = false;
$wgUseTidy = false;
- $what = ($redirectsOnly)? "redirects" : "links";
+ $what = $redirectsOnly ? "redirects" : "links";
+
+ if( $oldRedirectsOnly ) {
+ # This entire code path is cut-and-pasted from below. Hurrah.
+ $res = $dbr->query(
+ "SELECT page_id ".
+ "FROM page ".
+ "LEFT JOIN redirect ON page_id=rd_from ".
+ "WHERE page_is_redirect=1 AND rd_from IS NULL AND ".
+ ($end == 0 ? "page_id >= $start"
+ : "page_id BETWEEN $start AND $end"),
+ $fname
+ );
+ $num = $dbr->numRows( $res );
+ print "Refreshing $num old redirects from $start...\n";
- if ( $newOnly ) {
+ while( $row = $dbr->fetchObject( $res ) ) {
+ if ( !( ++$i % REPORTING_INTERVAL ) ) {
+ print "$i\n";
+ wfWaitForSlaves( $maxLag );
+ }
+ fixRedirect( $row->page_id );
+ }
+ } elseif( $newOnly ) {
print "Refreshing $what from ";
$res = $dbr->select( 'page',
array( 'page_id' ),
array(
'page_is_new' => 1,
- "page_id > $start" ),
+ "page_id >= $start" ),
$fname
);
$num = $dbr->numRows( $res );
if( isset( $options['help'] ) ) {
echo <<<TEXT
-Usage: php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--help]
-
- --help : This help message
- --dfn-only : Delete links from nonexistent articles only
- -m <number> : Maximum replication lag
- <start> : First page id to refresh
- -e <number> : Last page id to refresh
+Usage:
+ php refreshLinks.php --help
+ php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--dfn-only]
+ [--new-only] [--redirects-only]
+ php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] --old-redirects-only
+
+ --help : This help message
+ --dfn-only : Delete links from nonexistent articles only
+ --new-only : Only affect articles with just a single edit
+ --redirects-only : Only fix redirects, not all links
+ --old-redirects-only : Only fix redirects with no redirect table entry
+ -m <number> : Maximum replication lag
+ <start> : First page id to refresh
+ -e <number> : Last page id to refresh
TEXT;
exit(0);
$start = 1;
}
- refreshLinks( $start, $options['new-only'], $options['m'], $options['e'], $options['redirects-only'] );
+ refreshLinks( $start, $options['new-only'], $options['m'], $options['e'], $options['redirects-only'], $options['old-redirects-only'] );
}
// this bit's bad for replication: disabling temporarily
// --brion 2005-07-16