-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign RottenLinks to not depend on a maintenance script
- Loading branch information
1 parent
0cb4be9
commit d291981
Showing
19 changed files
with
500 additions
and
149 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
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,78 +1,93 @@ | ||
{ | ||
"name": "RottenLinks", | ||
"version": "1.0.20", | ||
"version": "2.0.0", | ||
"author": [ | ||
"John Lewis", | ||
"Paladox", | ||
"Universal Omega" | ||
], | ||
"url": "https://github.com/WikiForge/RottenLinks", | ||
"descriptionmsg": "rottenlinks-desc", | ||
"namemsg": "rottenlinks-extensionname", | ||
"license-name": "GPL-3.0-or-later", | ||
"url": "https://github.com/WikiForge/RottenLinks", | ||
"type": "specialpage", | ||
"requires": { | ||
"MediaWiki": ">= 1.35.3" | ||
}, | ||
"SpecialPages": { | ||
"RottenLinks": "SpecialRottenLinks" | ||
"MediaWiki": ">= 1.40.0" | ||
}, | ||
"MessagesDirs": { | ||
"RottenLinks": [ | ||
"i18n" | ||
] | ||
}, | ||
"ExtensionMessagesFiles": { | ||
"RottenLinksAliases": "includes/RottenLinksAliases.php" | ||
"RottenLinksAliases": "RottenLinksAliases.php" | ||
}, | ||
"AutoloadClasses": { | ||
"RottenLinks": "includes/RottenLinks.php", | ||
"RottenLinksHooks": "includes/RottenLinksHooks.php", | ||
"RottenLinksPager": "includes/RottenLinksPager.php", | ||
"SpecialRottenLinks": "includes/SpecialRottenLinks.php" | ||
"AutoloadNamespaces": { | ||
"WikiForge\\RottenLinks\\": "includes/" | ||
}, | ||
"JobClasses": { | ||
"RottenLinksJob": "WikiForge\\RottenLinks\\RottenLinksJob" | ||
}, | ||
"SpecialPages": { | ||
"RottenLinks": { | ||
"class": "WikiForge\\RottenLinks\\SpecialRottenLinks", | ||
"services": [ | ||
"ConfigFactory", | ||
"DBLoadBalancer" | ||
] | ||
} | ||
}, | ||
"Hooks": { | ||
"LoadExtensionSchemaUpdates": [ | ||
"RottenLinksHooks::fnRottenLinksSchemaUpdates" | ||
] | ||
"LinksUpdateComplete": { | ||
"handler": "Main" | ||
}, | ||
"LoadExtensionSchemaUpdates": { | ||
"handler": "Installer" | ||
} | ||
}, | ||
"HookHandlers": { | ||
"Installer": { | ||
"class": "WikiForge\\RottenLinks\\HookHandlers\\Installer" | ||
}, | ||
"Main": { | ||
"class": "WikiForge\\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/WikiForge/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 WikiForge\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 WikiForge\RottenLinks\HookHandlers; | ||
|
||
use JobQueueGroup; | ||
use MediaWiki\Deferred\LinksUpdate\LinksUpdate; | ||
use MediaWiki\Hook\LinksUpdateCompleteHook; | ||
use WikiForge\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.