Add a hook to Special:Version so we can customize the version URL
authorChad Horohoe <chadh@wikimedia.org>
Thu, 29 Nov 2012 17:06:25 +0000 (12:06 -0500)
committerChad Horohoe <chadh@wikimedia.org>
Thu, 29 Nov 2012 20:01:54 +0000 (15:01 -0500)
Change-Id: I02fe38c7b13dcfe570e78d28783098fc18756204

docs/hooks.txt
includes/specials/SpecialVersion.php

index c81e86a..0c8780d 100644 (file)
@@ -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.
index 7ace5f8..0ff5fc9 100644 (file)
@@ -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]";
        }
 
        /**