Dereckson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/331217 )
Change subject: Display Lilypond version on Special:Version ...................................................................... Display Lilypond version on Special:Version Users wants to know which Lilypond version is active on a wiki. Bug: T133014 Change-Id: I35702ff61a5399664fc3439192edc6152d2c7d70 --- M Score.body.php M Score.hooks.php M extension.json 3 files changed, 21 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/17/331217/1 diff --git a/Score.body.php b/Score.body.php index fd1e27c..89ef172 100644 --- a/Score.body.php +++ b/Score.body.php @@ -107,13 +107,21 @@ ); } + public static function getLilypondVersion() { + if ( self::$lilypondVersion === null ) { + self::fetchLilypondVersion(); + } + + return self::$lilypondVersion; + } + /** * Determines the version of LilyPond in use and writes the version * string to self::$lilypondVersion. * * @throws ScoreException if LilyPond could not be executed properly. */ - private static function getLilypondVersion() { + private static function fetchLilypondVersion() { global $wgScoreLilyPond; if ( !is_executable( $wgScoreLilyPond ) ) { @@ -725,11 +733,7 @@ * @throws ScoreException if determining the LilyPond version fails. */ private static function embedLilypondCode( $lilypondCode ) { - /* Get LilyPond version if we don't know it yet */ - if ( self::$lilypondVersion === null ) { - self::getLilypondVersion(); - } - $version = self::$lilypondVersion; + $version = self::getLilypondVersion(); /* Raw code. In Scheme, ##f is false and ##t is true. */ /* Set the default MIDI tempo to 100, 60 is a bit too slow */ diff --git a/Score.hooks.php b/Score.hooks.php index 934878d..855a7b4 100644 --- a/Score.hooks.php +++ b/Score.hooks.php @@ -14,4 +14,12 @@ $parser->setHook( 'score', 'Score::render' ); return true; } + + public static function onSoftwareInfo( array &$software ) { + try { + $software[ '[http://lilypond.org/ LilyPond]' ] = Score::getLilypondVersion(); + } catch ( ScoreException $ex ) { + // LilyPond executable can't found + } + } } diff --git a/extension.json b/extension.json index 9cb53b4..5540b83 100644 --- a/extension.json +++ b/extension.json @@ -61,6 +61,9 @@ "Hooks": { "ParserFirstCallInit": [ "ScoreHooks::onParserFirstCallInit" + ], + "SoftwareInfo": [ + "ScoreHooks::onSoftwareInfo" ] }, "config": { -- To view, visit https://gerrit.wikimedia.org/r/331217 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I35702ff61a5399664fc3439192edc6152d2c7d70 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: Dereckson <dereck...@espace-win.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits