From 966ed89270de78ee7e606db2b9d5d730a2f46297 Mon Sep 17 00:00:00 2001 From: paladox Date: Wed, 19 Nov 2014 16:27:25 +0000 Subject: [PATCH] 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 --- SyntaxHighlight_GeSHi.class.php | 12 ------------ SyntaxHighlight_GeSHi.php | 7 ++++--- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php index 4650c2c9..d179e77b 100644 --- a/SyntaxHighlight_GeSHi.class.php +++ b/SyntaxHighlight_GeSHi.class.php @@ -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. * diff --git a/SyntaxHighlight_GeSHi.php b/SyntaxHighlight_GeSHi.php index 32e22355..02ddfb68 100644 --- a/SyntaxHighlight_GeSHi.php +++ b/SyntaxHighlight_GeSHi.php @@ -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';