Skip to content

Commit

Permalink
Replace Linker::makeExternalLink with LinkRenderer (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Feb 12, 2025
1 parent 9e8575d commit b07a796
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## ChangeLog for RottenLinks

### 2.1.1 (12-02-2025)
* Replace deprecated `Linker::makeExternalLink` with `LinkRenderer`.
* Requires MediaWiki 1.43 or higher.

### 2.1.0 (06-10-2024)
* Add parser function (`{{#rl_status: URL}}`) and Scribunto library
Expand Down
4 changes: 2 additions & 2 deletions extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RottenLinks",
"version": "2.1.0",
"version": "2.1.1",
"author": [
"John Lewis",
"Paladox",
Expand All @@ -12,7 +12,7 @@
"license-name": "GPL-3.0-or-later",
"type": "specialpage",
"requires": {
"MediaWiki": ">= 1.42.0",
"MediaWiki": ">= 1.43.0",
"platform": {
"php": ">= 8.0"
}
Expand Down
7 changes: 4 additions & 3 deletions includes/RottenLinksPager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use MediaWiki\Context\IContextSource;
use MediaWiki\ExternalLinks\LinkFilter;
use MediaWiki\Html\Html;
use MediaWiki\Linker\Linker;
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\Pager\TablePager;
use MediaWiki\SpecialPage\SpecialPage;

class RottenLinksPager extends TablePager {

private Config $config;
private LinkRenderer $linkRenderer;
private bool $showBad;

public function __construct(
Expand All @@ -26,6 +26,7 @@ public function __construct(
parent::__construct( $context, $linkRenderer );

$this->config = $config;
$this->linkRenderer = $linkRenderer;
$this->showBad = $showBad;
}

Expand Down Expand Up @@ -64,10 +65,10 @@ public function formatValue( $name, $value ) {
$db = $this->getDatabase();
switch ( $name ) {
case 'rl_externallink':
$formatted = Linker::makeExternalLink(
$formatted = $this->linkRenderer->makeExternalLink(
(string)$row->rl_externallink,
( substr( (string)$row->rl_externallink, 0, 50 ) . '...' ),
true, '',
SpecialPage::getTitleFor( 'RottenLinks' ), '',
[ 'target' => $this->config->get( 'RottenLinksExternalLinkTarget' ) ]
);
break;
Expand Down

0 comments on commit b07a796

Please sign in to comment.