From 73451c606b72acbacc45ee0ab72949dedb4e63b7 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 29 Nov 2012 12:06:25 -0500 Subject: [PATCH] Add a hook to Special:Version so we can customize the version URL Change-Id: I02fe38c7b13dcfe570e78d28783098fc18756204 --- docs/hooks.txt | 4 ++++ includes/specials/SpecialVersion.php | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index c81e86af34..0c8780dd28 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2131,6 +2131,10 @@ $form: The SpecialUpload object use this to change the tables headers $extTypes: associative array of extensions types +'SpecialVersionVersionUrl': called when building the URL for Special:Version +$wgVersion: Current $wgVersion for you to use +&$versionUrl: Raw url to link to (eg: release notes) + 'SpecialWatchlistFilters': called after building form options at Watchlist $special: the special page object &$filters: associative array of filter definitions. The keys are the HTML name/URL parameters. diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 7ace5f8de9..0ff5fc913d 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -263,9 +263,13 @@ class SpecialVersion extends SpecialPage { */ private static function getwgVersionLinked() { global $wgVersion; - $versionParts = array(); - preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts ); - return "[https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]} $wgVersion]"; + $versionUrl = ""; + if( wfRunHooks( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) { + $versionParts = array(); + preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts ); + $versionUrl = "https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]}"; + } + return "[$versionUrl $wgVersion]"; } /** -- 2.20.1