88 $class = get_class(
$job );
89 $title =
$job->getTitle();
92 $backlinkCache = MediaWikiServices::getInstance()->getBacklinkCacheFactory()
93 ->getBacklinkCache( $title );
94 if ( isset(
$params[
'pages'] ) || empty(
$params[
'recursive'] ) ) {
98 wfWarn( __METHOD__ .
" called on {$job->getType()} leaf job (explosive recursion)." );
99 } elseif ( isset(
$params[
'range'] ) ) {
101 $ranges =
$params[
'range'][
'subranges'];
102 $realBSize =
$params[
'range'][
'batchSize'];
105 $ranges = $backlinkCache->partition(
$params[
'table'], $bSize );
109 $extraParams = $opts[
'params'] ?? [];
113 if ( isset( $ranges[0] ) ) {
114 [ $start, $end ] = $ranges[0];
116 $iter = $backlinkCache->getLinkPages(
$params[
'table'], $start, $end );
117 $pageSources = iterator_to_array( $iter );
119 foreach ( array_chunk( $pageSources, $cSize ) as $pageBatch ) {
121 foreach ( $pageBatch as $page ) {
122 $pages[$page->getId()] = [ $page->getNamespace(), $page->getDBkey() ];
124 $jobs[] =
new $class(
126 [
'pages' => $pages ] + $extraParams
131 if ( isset( $ranges[1] ) ) {
132 $jobs[] =
new $class(
138 'start' => $ranges[1][0],
139 'end' => $ranges[count( $ranges ) - 1][1],
140 'batchSize' => $realBSize,
141 'subranges' => array_slice( $ranges, 1 )
144 'division' => isset(
$params[
'division'] )