diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
commit | 72e90545454c0e014318fa3c81658e035aac58c1 (patch) | |
tree | 9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/RefreshLinksJob.php | |
parent | 565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff) |
applying patch to version 1.15.0
Diffstat (limited to 'includes/RefreshLinksJob.php')
-rw-r--r-- | includes/RefreshLinksJob.php | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/includes/RefreshLinksJob.php b/includes/RefreshLinksJob.php index 1c119a8d..91cff40b 100644 --- a/includes/RefreshLinksJob.php +++ b/includes/RefreshLinksJob.php @@ -82,35 +82,21 @@ class RefreshLinksJob2 extends Job { wfProfileOut( __METHOD__ ); return false; } - $start = intval($this->params['start']); - $end = intval($this->params['end']); - - $dbr = wfGetDB( DB_SLAVE ); - $res = $dbr->select( array( 'templatelinks', 'page' ), - array( 'page_namespace', 'page_title' ), - array( - 'page_id=tl_from', - "tl_from >= '$start'", - "tl_from <= '$end'", - 'tl_namespace' => $this->title->getNamespace(), - 'tl_title' => $this->title->getDBkey() - ), __METHOD__ - ); + $titles = $this->title->getBacklinkCache()->getLinks( + 'templatelinks', $this->params['start'], $this->params['end']); # Not suitable for page load triggered job running! # Gracefully switch to refreshLinks jobs if this happens. if( php_sapi_name() != 'cli' ) { $jobs = array(); - while( $row = $dbr->fetchObject( $res ) ) { - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); + foreach ( $titles as $title ) { $jobs[] = new RefreshLinksJob( $title, '' ); } Job::batchInsert( $jobs ); return true; } # Re-parse each page that transcludes this page and update their tracking links... - while( $row = $dbr->fetchObject( $res ) ) { - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); + foreach ( $titles as $title ) { $revision = Revision::newFromTitle( $title ); if ( !$revision ) { $this->error = 'refreshLinks: Article not found "' . $title->getPrefixedDBkey() . '"'; |