From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- extensions/Gadgets/includes/GadgetRepo.php | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 extensions/Gadgets/includes/GadgetRepo.php (limited to 'extensions/Gadgets/includes/GadgetRepo.php') diff --git a/extensions/Gadgets/includes/GadgetRepo.php b/extensions/Gadgets/includes/GadgetRepo.php new file mode 100644 index 00000000..18bf5b51 --- /dev/null +++ b/extensions/Gadgets/includes/GadgetRepo.php @@ -0,0 +1,63 @@ + array( 'name' => $gadget ) ) + */ + public function getStructuredList() { + $list = array(); + foreach ( $this->getGadgetIds() as $id ) { + $gadget = $this->getGadget( $id ); + $list[$gadget->getCategory()][$gadget->getName()] = $gadget; + } + + return $list; + } + + /** + * Get the configured default GadgetRepo. Currently + * this hardcodes MediaWikiGadgetsDefinitionRepo since + * that is the only implementation + * + * @return GadgetRepo + */ + public static function singleton() { + if ( self::$instance === null ) { + self::$instance = new MediaWikiGadgetsDefinitionRepo(); + } + return self::$instance; + } + + /** + * Should only be used by unit tests + * + * @param GadgetRepo|null $repo + */ + public static function setSingleton( $repo = null ) { + self::$instance = $repo; + } +} -- cgit v1.2.2