$batch = new LinkBatch;
foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
- $batch->addObj( $this->getRedirectTarget( $row ) );
+ $redirTarget = $this->getRedirectTarget( $row );
+ if ( $redirTarget ) {
+ $batch->addObj( $redirTarget );
+ }
}
$batch->execute();
$res->seek( 0 );
}
+ /**
+ * @param stdClass $row
+ * @return Title|null
+ */
protected function getRedirectTarget( $row ) {
if ( isset( $row->rd_title ) ) {
return Title::makeTitle( $row->rd_namespace,
* @return string
*/
function formatResult( $skin, $result ) {
+ $linkRenderer = $this->getLinkRenderer();
# Make a link to the redirect itself
$rd_title = Title::makeTitle( $result->namespace, $result->title );
- $rd_link = Linker::link(
+ $rd_link = $linkRenderer->makeLink(
$rd_title,
null,
[],
# Make a link to the destination page
$lang = $this->getLanguage();
$arr = $lang->getArrow() . $lang->getDirMark();
- $targetLink = Linker::link( $target );
+ $targetLink = $linkRenderer->makeLink( $target );
return "$rd_link $arr $targetLink";
} else {