diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
commit | 8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch) | |
tree | cd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /maintenance/refreshLinks.inc | |
parent | d7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff) |
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'maintenance/refreshLinks.inc')
-rw-r--r-- | maintenance/refreshLinks.inc | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/maintenance/refreshLinks.inc b/maintenance/refreshLinks.inc index 7a560e97..9e4eea8d 100644 --- a/maintenance/refreshLinks.inc +++ b/maintenance/refreshLinks.inc @@ -8,7 +8,7 @@ define( "REPORTING_INTERVAL", 100 ); #define( "REPORTING_INTERVAL", 1 ); -function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0 ) { +function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $redirectsOnly = false ) { global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy; $fname = 'refreshLinks'; @@ -25,8 +25,10 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0 ) { $wgUseImageResize = false; $wgUseTidy = false; + $what = ($redirectsOnly)? "redirects" : "links"; + if ( $newOnly ) { - print "Refreshing links from "; + print "Refreshing $what from "; $res = $dbr->select( 'page', array( 'page_id' ), array( @@ -43,11 +45,13 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0 ) { print "$i\n"; wfWaitForSlaves( $maxLag ); } - - fixLinksFromArticle( $row->page_id ); + if($redirectsOnly) + fixRedirect( $row->page_id ); + else + fixLinksFromArticle( $row->page_id ); } } else { - print "Refreshing link table.\n"; + print "Refreshing $what table.\n"; if ( !$end ) { $end = $dbr->selectField( 'page', 'max(page_id)', false ); } @@ -59,11 +63,33 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0 ) { print "$id\n"; wfWaitForSlaves( $maxLag ); } - fixLinksFromArticle( $id ); + if($redirectsOnly) + fixRedirect( $id ); + else + fixLinksFromArticle( $id ); } } } +function fixRedirect( $id ){ + global $wgTitle, $wgArticle; + + $wgTitle = Title::newFromID( $id ); + $dbw = wfGetDB( DB_MASTER ); + + if ( is_null( $wgTitle ) ) { + return; + } + $wgArticle = new Article($wgTitle); + + $rt = $wgArticle->followRedirect(); + + if($rt == false || !is_object($rt)) + return; + + $wgArticle->updateRedirectOn($dbw,$rt); +} + function fixLinksFromArticle( $id ) { global $wgTitle, $wgParser; |