88 $class = get_class(
$job );
89 $title =
$job->getTitle();
92 if ( isset(
$params[
'pages'] ) || empty(
$params[
'recursive'] ) ) {
95 wfWarn( __METHOD__ .
" called on {$job->getType()} leaf job (explosive recursion)." );
96 } elseif ( isset(
$params[
'range'] ) ) {
98 $ranges =
$params[
'range'][
'subranges'];
99 $realBSize =
$params[
'range'][
'batchSize'];
102 $ranges = $title->getBacklinkCache()->partition(
$params[
'table'], $bSize );
106 $extraParams = isset( $opts[
'params'] ) ? $opts[
'params'] : [];
110 if ( isset( $ranges[0] ) ) {
111 list( $start, $end ) = $ranges[0];
112 $iter = $title->getBacklinkCache()->getLinks(
$params[
'table'], $start, $end );
113 $titles = iterator_to_array( $iter );
115 foreach ( array_chunk(
$titles, $cSize ) as $titleBatch ) {
117 foreach ( $titleBatch as $tl ) {
118 $pages[$tl->getArticleID()] = [ $tl->getNamespace(), $tl->getDBkey() ];
120 $jobs[] =
new $class(
122 [
'pages' => $pages ] + $extraParams
127 if ( isset( $ranges[1] ) ) {
128 $jobs[] =
new $class(
134 'start' => $ranges[1][0],
135 'end' => $ranges[count( $ranges ) - 1][1],
136 'batchSize' => $realBSize,
137 'subranges' => array_slice( $ranges, 1 )
140 'division' => isset(
$params[
'division'] )