From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- maintenance/refreshLinks.inc | 48 ++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'maintenance/refreshLinks.inc') diff --git a/maintenance/refreshLinks.inc b/maintenance/refreshLinks.inc index e89db8aa..6d68e277 100644 --- a/maintenance/refreshLinks.inc +++ b/maintenance/refreshLinks.inc @@ -1,16 +1,14 @@ clearTagHooks(); - # Don't generate thumbnail images - $wgUseImageResize = false; + # Don't use HTML tidy $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 % $reportingInterval ) ) { + 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 ); @@ -41,7 +59,7 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $red $i = 0; while ( $row = $dbr->fetchObject( $res ) ) { - if ( !( ++$i % REPORTING_INTERVAL ) ) { + if ( !( ++$i % $reportingInterval ) ) { print "$i\n"; wfWaitForSlaves( $maxLag ); } @@ -59,7 +77,7 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $red for ($id = $start; $id <= $end; $id++) { - if ( !($id % REPORTING_INTERVAL) ) { + if ( !($id % $reportingInterval) ) { print "$id\n"; wfWaitForSlaves( $maxLag ); } @@ -121,7 +139,7 @@ function deleteLinksFromNonexistent( $maxLag = 0 ) { wfWaitForSlaves( $maxLag ); - $dbw = wfGetDB( DB_WRITE ); + $dbw = wfGetDB( DB_MASTER ); $linksTables = array( 'pagelinks' => 'pl_from', -- cgit v1.2.2