X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=maintenance%2FrefreshLinks.php;h=651255b7327b461ecfa2bf869c9f3a221e5f2240;hb=8aa6c9f43e9b54e4157a5feee42229a9a48b1764;hp=06e1449e15114b9d9140f1c5e3966a464cdc8fab;hpb=1f0857f26f400e484041ba4c55eba6ddd934c5fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 06e1449e15..651255b732 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -31,7 +31,7 @@ require_once __DIR__ . '/Maintenance.php'; class RefreshLinks extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Refresh link tables"; + $this->addDescription( 'Refresh link tables' ); $this->addOption( 'dfn-only', 'Delete links from nonexistent articles only' ); $this->addOption( 'new-only', 'Only affect articles with just a single edit' ); $this->addOption( 'redirects-only', 'Only fix redirects, not all links' ); @@ -73,10 +73,8 @@ class RefreshLinks extends Maintenance { private function doRefreshLinks( $start, $newOnly = false, $end = null, $redirectsOnly = false, $oldRedirectsOnly = false ) { - global $wgParser; - $reportingInterval = 100; - $dbr = wfGetDB( DB_SLAVE ); + $dbr = $this->getDB( DB_SLAVE ); if ( $start === null ) { $start = 1; @@ -85,9 +83,6 @@ class RefreshLinks extends Maintenance { // Give extensions a chance to optimize settings Hooks::run( 'MaintenanceRefreshLinksInit', array( $this ) ); - # Don't generate extension images (e.g. Timeline) - $wgParser->clearTagHooks(); - $what = $redirectsOnly ? "redirects" : "links"; if ( $oldRedirectsOnly ) { @@ -192,7 +187,7 @@ class RefreshLinks extends Maintenance { */ private function fixRedirect( $id ) { $page = WikiPage::newFromID( $id ); - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); if ( $page === null ) { // This page doesn't exist (any more) @@ -242,13 +237,8 @@ class RefreshLinks extends Maintenance { return; } - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); - $updates = $content->getSecondaryDataUpdates( $page->getTitle() ); DataUpdate::runUpdates( $updates ); - - $dbw->commit( __METHOD__ ); } /** @@ -267,7 +257,7 @@ class RefreshLinks extends Maintenance { ) { wfWaitForSlaves(); $this->output( "Deleting illegal entries from the links tables...\n" ); - $dbr = wfGetDB( DB_SLAVE ); + $dbr = $this->getDB( DB_SLAVE ); do { // Find the start of the next chunk. This is based only // on existent page_ids. @@ -307,8 +297,8 @@ class RefreshLinks extends Maintenance { * @param int $batchSize The size of deletion batches */ private function dfnCheckInterval( $start = null, $end = null, $batchSize = 100 ) { - $dbw = wfGetDB( DB_MASTER ); - $dbr = wfGetDB( DB_SLAVE ); + $dbw = $this->getDB( DB_MASTER ); + $dbr = $this->getDB( DB_SLAVE ); $linksTables = array( // table name => page_id field 'pagelinks' => 'pl_from',