| Index: trunk/phase3/docs/hooks.txt |
| — | — | @@ -564,6 +564,16 @@ |
| 565 | 565 | $user: user |
| 566 | 566 | $result: result of checking autopromote condition |
| 567 | 567 | |
| | 568 | +'BacklinkCacheGetPrefix': allows to set prefix for a spefific link table |
| | 569 | +$table: table name |
| | 570 | +&$prefix: prefix |
| | 571 | + |
| | 572 | +'BacklinkCacheGetConditions': allows to set conditions for query when links to certain title |
| | 573 | +are fetched |
| | 574 | +$table: table name |
| | 575 | +$title: title of the page to which backlinks are sought |
| | 576 | +&$conds: query conditions |
| | 577 | + |
| 568 | 578 | 'BadImage': When checking against the bad image list |
| 569 | 579 | $name: Image name being checked |
| 570 | 580 | &$bad: Whether or not the image is "bad" |
| Index: trunk/phase3/includes/LinksUpdate.php |
| — | — | @@ -241,6 +241,7 @@ |
| 242 | 242 | foreach ( $batches as $batch ) { |
| 243 | 243 | list( $start, $end ) = $batch; |
| 244 | 244 | $params = array( |
| | 245 | + 'table' => 'templatelinks', |
| 245 | 246 | 'start' => $start, |
| 246 | 247 | 'end' => $end, |
| 247 | 248 | ); |
| Index: trunk/phase3/includes/BacklinkCache.php |
| — | — | @@ -190,7 +190,13 @@ |
| 191 | 191 | if ( isset( $prefixes[$table] ) ) { |
| 192 | 192 | return $prefixes[$table]; |
| 193 | 193 | } else { |
| 194 | | - throw new MWException( "Invalid table \"$table\" in " . __CLASS__ ); |
| | 194 | + $prefix = null; |
| | 195 | + wfRunHooks( 'BacklinkCacheGetPrefix', array( $table, &$prefix ) ); |
| | 196 | + if( $prefix ) { |
| | 197 | + return $prefix; |
| | 198 | + } else { |
| | 199 | + throw new MWException( "Invalid table \"$table\" in " . __CLASS__ ); |
| | 200 | + } |
| 195 | 201 | } |
| 196 | 202 | } |
| 197 | 203 | |
| — | — | @@ -237,7 +243,10 @@ |
| 238 | 244 | ); |
| 239 | 245 | break; |
| 240 | 246 | default: |
| 241 | | - throw new MWException( "Invalid table \"$table\" in " . __CLASS__ ); |
| | 247 | + $conds = null; |
| | 248 | + wfRunHooks( 'BacklinkCacheGetConditions', array( $table, $this->title, &$conds ) ); |
| | 249 | + if( !$conds ) |
| | 250 | + throw new MWException( "Invalid table \"$table\" in " . __CLASS__ ); |
| 242 | 251 | } |
| 243 | 252 | |
| 244 | 253 | return $conds; |
| Index: trunk/phase3/includes/job/RefreshLinksJob.php |
| — | — | @@ -89,7 +89,7 @@ |
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | $titles = $this->title->getBacklinkCache()->getLinks( |
| 93 | | - 'templatelinks', $this->params['start'], $this->params['end']); |
| | 93 | + $this->params['table'], $this->params['start'], $this->params['end']); |
| 94 | 94 | |
| 95 | 95 | # Not suitable for page load triggered job running! |
| 96 | 96 | # Gracefully switch to refreshLinks jobs if this happens. |