-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cleanup and modernize * Fix * Use namespace * Use namespace * Update CHANGELOG * Suppress UnusedPluginSuppression
- Loading branch information
1 parent
a005bff
commit f251554
Showing
16 changed files
with
393 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ | |
{ | ||
"name": "John Lewis" | ||
}, | ||
{ | ||
"name": "Paladox" | ||
}, | ||
{ | ||
"name": "Universal Omega" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,93 @@ | ||
{ | ||
"name": "RottenLinks", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": [ | ||
"John Lewis", | ||
"Universal Omega", | ||
"Paladox" | ||
"Paladox", | ||
"Universal Omega" | ||
], | ||
"url": "https://github.com/miraheze/RottenLinks", | ||
"descriptionmsg": "rottenlinks-desc", | ||
"namemsg": "rottenlinks-extensionname", | ||
"license-name": "GPL-3.0-or-later", | ||
"url": "https://github.com/miraheze/RottenLinks", | ||
"type": "specialpage", | ||
"requires": { | ||
"MediaWiki": ">= 1.40.0" | ||
}, | ||
"SpecialPages": { | ||
"RottenLinks": "SpecialRottenLinks" | ||
}, | ||
"JobClasses": { | ||
"RottenLinksJob": "RottenLinksJob" | ||
}, | ||
"MessagesDirs": { | ||
"RottenLinks": [ | ||
"i18n" | ||
] | ||
}, | ||
"ExtensionMessagesFiles": { | ||
"RottenLinksAliases": "includes/RottenLinksAliases.php" | ||
"RottenLinksAliases": "RottenLinksAliases.php" | ||
}, | ||
"AutoloadNamespaces": { | ||
"Miraheze\\RottenLinks\\": "includes/" | ||
}, | ||
"AutoloadClasses": { | ||
"RottenLinks": "includes/RottenLinks.php", | ||
"RottenLinksHooks": "includes/RottenLinksHooks.php", | ||
"RottenLinksJob": "includes/RottenLinksJob.php", | ||
"RottenLinksPager": "includes/RottenLinksPager.php", | ||
"SpecialRottenLinks": "includes/SpecialRottenLinks.php" | ||
"JobClasses": { | ||
"RottenLinksJob": "Miraheze\\RottenLinks\\RottenLinksJob" | ||
}, | ||
"SpecialPages": { | ||
"RottenLinks": { | ||
"class": "Miraheze\\RottenLinks\\SpecialRottenLinks", | ||
"services": [ | ||
"ConfigFactory", | ||
"DBLoadBalancer" | ||
] | ||
} | ||
}, | ||
"Hooks": { | ||
"LoadExtensionSchemaUpdates": [ | ||
"RottenLinksHooks::onRottenLinksSchemaUpdates" | ||
], | ||
"LinksUpdateComplete": [ | ||
"RottenLinksHooks::onLinksUpdateComplete" | ||
] | ||
"LinksUpdateComplete": { | ||
"handler": "Main" | ||
}, | ||
"LoadExtensionSchemaUpdates": { | ||
"handler": "Installer" | ||
} | ||
}, | ||
"HookHandlers": { | ||
"Installer": { | ||
"class": "Miraheze\\RottenLinks\\HookHandlers\\Installer" | ||
}, | ||
"Main": { | ||
"class": "Miraheze\\RottenLinks\\HookHandlers\\Main", | ||
"services": [ | ||
"JobQueueGroup" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"RottenLinksBadCodes": { | ||
"description": "Holds a list of HTTP codes that are considered bad. (array)", | ||
"public": true, | ||
"value": [ "0", "400", "401", "403", "404", "405", "502", "503", "504" ] | ||
"value": [ "0", "400", "401", "403", "404", "405", "502", "503", "504" ], | ||
"description": "Holds a list of HTTP codes that are considered bad. (array)" | ||
}, | ||
"RottenLinksCurlTimeout": { | ||
"description": "Sets the timeout for cURL in seconds. (integer)", | ||
"public": true, | ||
"value": 30 | ||
"value": 30, | ||
"description": "Sets the timeout for cURL in seconds. (integer)" | ||
}, | ||
"RottenLinksHTTPProxy": { | ||
"description": "Sets a proxy to use for requests. (string)", | ||
"public": true, | ||
"value": "" | ||
"value": "", | ||
"description": "Sets a proxy to use for requests. (string)" | ||
}, | ||
"RottenLinksExcludeProtocols": { | ||
"description": "Holds a list of protocols that should not be checked for validity. (array)", | ||
"public": true, | ||
"value": [ "tel", "mailto" ] | ||
"value": [ "tel", "mailto" ], | ||
"description": "Holds a list of protocols that should not be checked for validity. (array)" | ||
}, | ||
"RottenLinksExcludeWebsites": { | ||
"description": "List of websites to exclude checking of response codes for. (array)", | ||
"public": true, | ||
"value": false | ||
"value": false, | ||
"description": "List of websites to exclude checking of response codes for. (array)" | ||
}, | ||
"RottenLinksExternalLinkTarget": { | ||
"description": "Sets the external link target (_self for the current tab or _blank for a new tab). (string)", | ||
"public": true, | ||
"value": "_self" | ||
"value": "_self", | ||
"description": "Sets the external link target (_self for the current tab or _blank for a new tab). (string)" | ||
}, | ||
"RottenLinksUserAgent": { | ||
"description": "Overrides the user-agent to use for requests. Defaults to 'RottenLinks, MediaWiki extension (https://github.com/miraheze/RottenLinks), running on <Wiki base URL>'. (string)", | ||
"public": true, | ||
"value": "" | ||
"value": "", | ||
"description": "Overrides the user-agent to use for requests. Defaults to 'RottenLinks, MediaWiki extension (https://github.com/miraheze/RottenLinks), running on <Wiki base URL>'. (string)" | ||
} | ||
}, | ||
"ConfigRegistry": { | ||
"rottenlinks": "GlobalVarConfig::newInstance" | ||
"RottenLinks": "GlobalVarConfig::newInstance" | ||
}, | ||
"manifest_version": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Miraheze\RottenLinks\HookHandlers; | ||
|
||
use DatabaseUpdater; | ||
use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; | ||
|
||
class Installer implements LoadExtensionSchemaUpdatesHook { | ||
|
||
/** | ||
* @param DatabaseUpdater $updater | ||
*/ | ||
public function onLoadExtensionSchemaUpdates( $updater ) { | ||
$dir = __DIR__ . '/../../sql'; | ||
|
||
$updater->addExtensionTable( 'rottenlinks', "$dir/rottenlinks.sql" ); | ||
|
||
$updater->addExtensionField( 'rottenlinks', 'rl_id', "$dir/patches/patch-add-rl_id.sql" ); | ||
|
||
$updater->addExtensionIndex( 'rottenlinks', 'rl_externallink', "$dir/patches/20210215.sql" ); | ||
|
||
$updater->dropExtensionField( 'rottenlinks', 'rl_pageusage', "$dir/patches/patch-drop-rl_pageusage.sql" ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Miraheze\RottenLinks\HookHandlers; | ||
|
||
use JobQueueGroup; | ||
use MediaWiki\Deferred\LinksUpdate\LinksUpdate; | ||
use MediaWiki\Hook\LinksUpdateCompleteHook; | ||
use Miraheze\RottenLinks\RottenLinksJob; | ||
|
||
class Main implements LinksUpdateCompleteHook { | ||
|
||
/** @var JobQueueGroup */ | ||
private $jobQueueGroup; | ||
|
||
/** | ||
* @param JobQueueGroup $jobQueueGroup | ||
*/ | ||
public function __construct( JobQueueGroup $jobQueueGroup ) { | ||
$this->jobQueueGroup = $jobQueueGroup; | ||
} | ||
|
||
/** | ||
* Handler for LinksUpdateComplete hook. | ||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdateComplete | ||
* @param LinksUpdate $linksUpdate | ||
* @param mixed $ticket | ||
*/ | ||
public function onLinksUpdateComplete( $linksUpdate, $ticket ) { | ||
$addedExternalLinks = $linksUpdate->getAddedExternalLinks(); | ||
$removedExternalLinks = $linksUpdate->getRemovedExternalLinks(); | ||
|
||
if ( $addedExternalLinks || $removedExternalLinks ) { | ||
$params = [ | ||
'addedExternalLinks' => $addedExternalLinks, | ||
'removedExternalLinks' => $removedExternalLinks | ||
]; | ||
|
||
$this->jobQueueGroup->push( new RottenLinksJob( $params ) ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.