From d632b281801a32f7ba949ad07337c58fdd6c2bce Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Fri, 4 Dec 2020 22:42:41 -0500 Subject: GentooPackages: Correctly place the addModule per docs Signed-off-by: Brian Evans --- GentooPackages/GentooPackages.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/GentooPackages/GentooPackages.php b/GentooPackages/GentooPackages.php index 978ca50f..d287b920 100644 --- a/GentooPackages/GentooPackages.php +++ b/GentooPackages/GentooPackages.php @@ -2,22 +2,22 @@ class GentooPackages { // implements MediaWiki\Hook\ParserFirstCallInitHook { public static function packageInfo($input, array $args, Parser $parser, PPFrame $frame) { + $parser->getOutput()->addModules('ext.gentooPackages'); $atom = $args['atom']; $type = $args['type']; if ($atom === NULL) { return "Package name missing"; - } else { - $cache = new CacheHelper(); - $cache->setExpiry(60 * 60 * 24); // 1 day - $cache->setCacheKey(['packageInfo', $atom, $type]); - try { - $packageInfo = $cache->getCachedValue('self::fetchOrError', [$atom, $type]); - $cache->saveCache(); - return [$packageInfo, 'markerType' => 'nowiki']; - } catch (Exception $ex) { - return [$ex->message, 'markerType' => 'nowiki']; - } + } + $cache = new CacheHelper(); + $cache->setExpiry(60 * 60 * 24); // 1 day + $cache->setCacheKey(['packageInfo', $atom, $type]); + try { + $packageInfo = $cache->getCachedValue('self::fetchOrError', [$atom, $type]); + $cache->saveCache(); + return [$packageInfo, 'markerType' => 'nowiki']; + } catch (Exception $ex) { + return [$ex->message, 'markerType' => 'nowiki']; } } @@ -120,7 +120,5 @@ HTML; public static function onParserFirstCallInit($parser) { $parser->setHook('package-info', 'GentooPackages::packageInfo'); - $output = $parser->getOutput(); - $output->addModules('ext.gentooPackages'); } } -- cgit v1.2.3-65-gdbad