Update callers of deprecated BacklinkCache methods

Bug: T290015
Change-Id: I73a111d064f7778bbeb90fd4ea85d8bec201427b
This commit is contained in:
TChin 2021-09-03 10:39:13 -04:00
parent 10490802e7
commit fd5915823f
3 changed files with 11 additions and 9 deletions

View file

@ -397,7 +397,7 @@ class BacklinkCache {
return $this->partitionCache[$table][$wgUpdateRowsPerJob]['numRows'];
} else { // probably some sane limit
// Fetch the full title info, since the caller will likely need it next
$count = $this->getLinks( $table, false, false, $max )->count();
$count = iterator_count( $this->getLinkPages( $table, false, false, $max ) );
if ( $count < $max ) { // full count
$this->wanCache->set( $memcKey, $count, self::CACHE_EXPIRY );
}

View file

@ -375,9 +375,9 @@ class LinksUpdate extends DataUpdate {
// These jobs duplicate a subset of the above ones, but can run sooner.
// Which ever runs first generally no-ops the other one.
$jobs = [];
foreach ( $backlinkCache->getCascadeProtectedLinks() as $title ) {
foreach ( $backlinkCache->getCascadeProtectedLinkPages() as $page ) {
$jobs[] = RefreshLinksJob::newPrioritized(
$title,
$page,
[
'causeAction' => $action,
'causeAgent' => $agent

View file

@ -22,6 +22,7 @@
*/
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\PageIdentity;
/**
* Class with Backlink related Job helper methods
@ -113,13 +114,14 @@ class BacklinkJobUtils {
// Combine the first range (of size $bSize) backlinks into leaf jobs
if ( isset( $ranges[0] ) ) {
list( $start, $end ) = $ranges[0];
$iter = $backlinkCache->getLinks( $params['table'], $start, $end );
$titles = iterator_to_array( $iter );
/** @var Title[] $titleBatch */
foreach ( array_chunk( $titles, $cSize ) as $titleBatch ) {
$iter = $backlinkCache->getLinkPages( $params['table'], $start, $end );
$pageSources = iterator_to_array( $iter );
/** @var PageIdentity[] $pageBatch */
foreach ( array_chunk( $pageSources, $cSize ) as $pageBatch ) {
$pages = [];
foreach ( $titleBatch as $tl ) {
$pages[$tl->getArticleID()] = [ $tl->getNamespace(), $tl->getDBkey() ];
foreach ( $pageBatch as $page ) {
$pages[$page->getId()] = [ $page->getNamespace(), $page->getDBkey() ];
}
$jobs[] = new $class(
$title, // maintain parent job title