summaryrefslogtreecommitdiff
path: root/extensions/Gadgets/api/ApiQueryGadgets.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Gadgets/api/ApiQueryGadgets.php')
-rw-r--r--extensions/Gadgets/api/ApiQueryGadgets.php89
1 files changed, 32 insertions, 57 deletions
diff --git a/extensions/Gadgets/api/ApiQueryGadgets.php b/extensions/Gadgets/api/ApiQueryGadgets.php
index 46535964..383faf09 100644
--- a/extensions/Gadgets/api/ApiQueryGadgets.php
+++ b/extensions/Gadgets/api/ApiQueryGadgets.php
@@ -20,14 +20,33 @@
*/
class ApiQueryGadgets extends ApiQueryBase {
- private $props,
- $categories,
- $neededIds,
- $listAllowed,
- $listEnabled;
-
- public function __construct( $query, $moduleName ) {
- parent::__construct( $query, $moduleName, 'ga' );
+ /**
+ * @var array
+ */
+ private $props;
+
+ /**
+ * @var array|bool
+ */
+ private $categories;
+
+ /**
+ * @var array|bool
+ */
+ private $neededIds;
+
+ /**
+ * @var bool
+ */
+ private $listAllowed;
+
+ /**
+ * @var bool
+ */
+ private $listEnabled;
+
+ public function __construct( ApiQuery $queryModule, $moduleName ) {
+ parent::__construct( $queryModule, $moduleName, 'ga' );
}
public function execute() {
@@ -52,7 +71,7 @@ class ApiQueryGadgets extends ApiQueryBase {
* @return array
*/
private function getList() {
- $gadgets = Gadget::loadStructuredList();
+ $gadgets = GadgetRepo::singleton()->getStructuredList();
if ( $gadgets === false ) {
return array();
@@ -128,15 +147,16 @@ class ApiQueryGadgets extends ApiQueryBase {
'rights' => $g->getRequiredRights(),
'skins' => $g->getRequiredSkins(),
'default' => $g->isOnByDefault(),
- 'hidden' => false, // Only exists in RL2 branch
- 'shared' => false, // Only exists in RL2 branch
+ 'hidden' => $g->isHidden(),
+ 'shared' => false,
'category' => $g->getCategory(),
+ 'legacyscripts' => (bool)$g->getLegacyScripts(),
),
'module' => array(
'scripts' => $g->getScripts(),
'styles' => $g->getStyles(),
'dependencies' => $g->getDependencies(),
- 'messages' => array(), // Only exists in RL2 branch
+ 'messages' => $g->getMessages(),
)
);
}
@@ -187,51 +207,6 @@ class ApiQueryGadgets extends ApiQueryBase {
}
/**
- * @deprecated since MediaWiki core 1.25
- */
- public function getDescription() {
- return 'Returns a list of gadgets used on this wiki';
- }
-
- /**
- * @deprecated since MediaWiki core 1.25
- */
- public function getParamDescription() {
- return array(
- 'prop' => array(
- 'What gadget information to get:',
- ' id - Internal gadget ID',
- ' metadata - The gadget metadata',
- ' desc - Gadget description transformed into HTML (can be slow, use only if really needed)',
- ),
- 'categories' => 'Gadgets from what categories to retrieve',
- 'ids' => 'ID(s) of gadgets to retrieve',
- 'allowedonly' => 'List only gadgets allowed to current user',
- 'enabledonly' => 'List only gadgets enabled by current user',
- );
- }
-
- /**
- * @deprecated since MediaWiki core 1.25
- */
- public function getExamples() {
- $params = $this->getAllowedParams();
- $allProps = implode( '|', $params['prop'][ApiBase::PARAM_TYPE] );
- return array(
- 'Get a list of gadgets along with their descriptions:',
- ' api.php?action=query&list=gadgets&gaprop=id|desc',
- 'Get a list of gadgets with all possible properties:',
- " api.php?action=query&list=gadgets&gaprop=$allProps",
- 'Get a list of gadgets belonging to category "foo":',
- ' api.php?action=query&list=gadgets&gacategories=foo',
- 'Get information about gadgets "foo" and "bar":',
- ' api.php?action=query&list=gadgets&gaids=foo|bar&gaprop=id|desc|metadata',
- 'Get a list of gadgets enabled by current user:',
- ' api.php?action=query&list=gadgets&gaenabledonly',
- );
- }
-
- /**
* @see ApiBase::getExamplesMessages()
*/
protected function getExamplesMessages() {