diff options
author | 2020-12-04 22:42:41 -0500 | |
---|---|---|
committer | 2020-12-04 22:42:41 -0500 | |
commit | d632b281801a32f7ba949ad07337c58fdd6c2bce (patch) | |
tree | e4f1ecf1b3f37c446dd6ea0e7c540ce2324c9dea | |
parent | Comment out implements while more research is done (diff) | |
download | extensions-d632b281801a32f7ba949ad07337c58fdd6c2bce.tar.gz extensions-d632b281801a32f7ba949ad07337c58fdd6c2bce.tar.bz2 extensions-d632b281801a32f7ba949ad07337c58fdd6c2bce.zip |
GentooPackages: Correctly place the addModule per docs
Signed-off-by: Brian Evans <grknight@gentoo.org>
-rw-r--r-- | GentooPackages/GentooPackages.php | 24 |
1 files 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'); } } |