Set Geshi version in main php file

The version was set from the ExtensionTypes hook (which runs only on
Special:Version). WikiApiary and other API consumers were unable to
detect the version.

This is an amended resubmission of the reverted d69ae1f3ac, in which
the constant was declared twice.

Change include_once to require_once for langs file (follows-up 168e1296).

Bug: T75666
Change-Id: I836e0df942a066d80255c1b68472e7ee58124357
This commit is contained in:
paladox 2014-11-19 16:27:25 +00:00 committed by Timo Tijhof
parent f7a3487f56
commit 966ed89270
2 changed files with 4 additions and 15 deletions

View file

@ -501,18 +501,6 @@ class SyntaxHighlight_GeSHi {
return true;
}
/**
* Get the GeSHI's version information while Special:Version is read.
* @param $extensionTypes
* @return bool
*/
public static function extensionTypes( &$extensionTypes ) {
global $wgExtensionCredits;
self::initialise();
$wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi']['version'] = GESHI_VERSION;
return true;
}
/**
* Register a ResourceLoader module providing styles for each supported language.
*

View file

@ -40,14 +40,16 @@ if ( version_compare( $wgVersion, '1.24', '<' ) ) {
die( "This version of SyntaxHighlight GeSHi requires MediaWiki 1.24" );
}
include_once __DIR__ . '/SyntaxHighlight_GeSHi.langs.php';
require_once __DIR__ . '/SyntaxHighlight_GeSHi.langs.php';
require_once __DIR__ . '/geshi/geshi.php';
$wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'SyntaxHighlight',
'author' => array( 'Brion Vibber', 'Tim Starling', 'Rob Church', 'Niklas Laxström' ),
'descriptionmsg' => 'syntaxhighlight-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi',
'version' => GESHI_VERSION,
);
// Change these in LocalSettings.php
@ -62,7 +64,6 @@ $wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.clas
$wgAutoloadClasses['ResourceLoaderGeSHiModule'] = $dir . 'ResourceLoaderGeSHiModule.php';
$wgAutoloadClasses['ResourceLoaderGeSHiLocalModule'] = $dir . 'ResourceLoaderGeSHiLocalModule.php';
$wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::extensionTypes';
$wgHooks['ResourceLoaderRegisterModules'][] = 'SyntaxHighlight_GeSHi::resourceLoaderRegisterModules';
$wgHooks['ContentGetParserOutput'][] = 'SyntaxHighlight_GeSHi::renderHook';
$wgHooks['ApiFormatHighlight'][] = 'SyntaxHighlight_GeSHi::apiFormatHighlight';