35 $this->removeDuplicates = !isset(
$params[
'start'] ) && !isset(
$params[
'end'] );
43 global $wgUpdateRowsPerJob;
48 if ( is_null( $this->
title ) ) {
49 $this->error =
"refreshLinks2: Invalid title";
54 $table = isset( $this->params[
'table'] ) ? $this->params[
'table'] :
'templatelinks';
61 if ( isset( $this->params[
'masterPos'] ) ) {
62 $masterPos = $this->params[
'masterPos'];
63 } elseif (
wfGetLB()->getServerCount() > 1 ) {
64 $masterPos =
wfGetLB()->getMasterPos();
69 $tbc = $this->
title->getBacklinkCache();
72 if ( isset( $this->params[
'start'] ) && isset( $this->params[
'end'] ) ) {
73 # This is a partition job to trigger the insertion of leaf jobs...
76 # This is a base job to trigger the insertion of partitioned jobs...
77 if ( $tbc->getNumLinks( $table, $wgUpdateRowsPerJob + 1 ) <= $wgUpdateRowsPerJob ) {
78 # Just directly insert the single per-title jobs
81 # Insert the partition jobs to make per-title jobs
82 foreach ( $tbc->partition( $table, $wgUpdateRowsPerJob )
as $batch ) {
89 'masterPos' => $masterPos,
96 if ( count( $jobs ) ) {
109 # The "start"/"end" fields are not set for the base jobs
110 $start = isset( $this->params[
'start'] ) ? $this->params[
'start'] :
false;
111 $end = isset( $this->params[
'end'] ) ? $this->params[
'end'] :
false;
112 $titles = $this->
title->getBacklinkCache()->getLinks( $table, $start, $end );
113 # Convert into single page refresh links jobs.
114 # This handles well when in sapi mode and is useful in any case for job
115 # de-duplication. If many pages use template A, and that template itself
116 # uses template B, then an edit to both will create many duplicate jobs.
117 # Roughly speaking, for each page, one of the "RefreshLinksJob" jobs will
118 # get run first, and when it does, it will remove the duplicates. Of course,
119 # one page could have its job popped when the other page's job is still
120 # buried within the logic of a refreshLinks2 job.
134 $info = parent::getDeduplicationInfo();
136 if ( is_array( $info[
'params'] ) ) {
137 unset( $info[
'params'][
'masterPos'] );