diff options
-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'); } } |