summaryrefslogtreecommitdiff
path: root/extensions/Gadgets/api
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /extensions/Gadgets/api
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'extensions/Gadgets/api')
-rw-r--r--extensions/Gadgets/api/ApiQueryGadgetCategories.php54
-rw-r--r--extensions/Gadgets/api/ApiQueryGadgets.php89
2 files changed, 44 insertions, 99 deletions
diff --git a/extensions/Gadgets/api/ApiQueryGadgetCategories.php b/extensions/Gadgets/api/ApiQueryGadgetCategories.php
index 23257f12..82c7bff8 100644
--- a/extensions/Gadgets/api/ApiQueryGadgetCategories.php
+++ b/extensions/Gadgets/api/ApiQueryGadgetCategories.php
@@ -20,11 +20,18 @@
*/
class ApiQueryGadgetCategories extends ApiQueryBase {
- private $props,
- $neededNames;
+ /**
+ * @var array
+ */
+ private $props;
+
+ /**
+ * @var array|bool
+ */
+ private $neededNames;
- public function __construct( $query, $moduleName ) {
- parent::__construct( $query, $moduleName, 'gc' );
+ public function __construct( ApiQuery $queryModule, $moduleName ) {
+ parent::__construct( $queryModule, $moduleName, 'gc' );
}
public function execute() {
@@ -42,7 +49,7 @@ class ApiQueryGadgetCategories extends ApiQueryBase {
private function getList() {
$data = array();
$result = $this->getResult();
- $gadgets = Gadget::loadStructuredList();
+ $gadgets = GadgetRepo::singleton()->getStructuredList();
if ( $gadgets ) {
foreach ( $gadgets as $category => $list ) {
@@ -89,43 +96,6 @@ class ApiQueryGadgetCategories extends ApiQueryBase {
}
/**
- * @deprecated since MediaWiki core 1.25
- */
- public function getDescription() {
- return 'Returns a list of gadget categories';
- }
-
- /**
- * @deprecated since MediaWiki core 1.25
- */
- public function getParamDescription() {
- return array(
- 'prop' => array(
- 'What gadget category information to get:',
- ' name - Internal category name',
- ' title - Category title',
- ' members - Number of gadgets in category',
- ),
- 'names' => 'Name(s) of categories to retrieve',
- );
- }
-
- /**
- * @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 existing gadget categories:',
- ' api.php?action=query&list=gadgetcategories',
- 'Get all information about categories named "foo" and "bar":',
- " api.php?action=query&list=gadgetcategories&gcnames=foo|bar&gcprop=$allProps",
- );
- }
-
- /**
* @see ApiBase::getExamplesMessages()
*/
protected function getExamplesMessages() {
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() {