49 parent::__construct( $queryModule, $moduleName,
'ga' );
64 $this->
getMain()->setCacheMode( $this->listAllowed || $this->listEnabled
65 ?
'anon-public-user-private' :
'public' );
81 foreach ( $gadgets as $category => $list ) {
82 if ( $this->categories && !
isset( $this->categories[$category] ) ) {
86 foreach ( $list as $g ) {
105 foreach ( $gadgets as $g ) {
107 if (
isset( $this->props[
'id'] ) ) {
108 $row[
'id'] = $g->getName();
111 if (
isset( $this->props[
'metadata'] ) ) {
116 if (
isset( $this->props[
'desc'] ) ) {
117 $row[
'desc'] = $g->getDescription();
123 $result->setIndexedTagName(
$data,
'gadget' );
135 return ( $this->neededIds ===
false ||
isset( $this->neededIds[$gadget->
getName()] ) )
136 && ( !$this->listAllowed || $gadget->
isAllowed( $user ) )
137 && ( !$this->listEnabled || $gadget->
isEnabled( $user ) );
147 'rights' => $g->getRequiredRights(),
148 'skins' => $g->getRequiredSkins(),
149 'default' => $g->isOnByDefault(),
150 'hidden' => $g->isHidden(),
152 'category' => $g->getCategory(),
153 'legacyscripts' => (
bool)$g->getLegacyScripts(),
156 'scripts' => $g->getScripts(),
157 'styles' => $g->getStyles(),
158 'dependencies' => $g->getDependencies(),
159 'peers' => $g->getPeers(),
160 'messages' => $g->getMessages(),
169 'scripts' =>
'script',
171 'dependencies' =>
'dependency',
173 'messages' =>
'message',
177 foreach ( $metadata as
$data ) {
180 $tag = $tagNames[$key] ?? $key;
181 $result->setIndexedTagName(
$value, $tag );
206 'allowedonly' =>
false,
207 'enabledonly' =>
false,
219 'action=query&list=gadgets&gaprop=id|desc'
220 =>
'apihelp-query+gadgets-example-1',
221 "action=query&list=gadgets&gaprop=$allProps"
222 =>
'apihelp-query+gadgets-example-2',
223 'action=query&list=gadgets&gacategories=foo'
224 =>
'apihelp-query+gadgets-example-3',
225 'action=query&list=gadgets&gaids=foo|bar&gaprop=id|desc|metadata'
226 =>
'apihelp-query+gadgets-example-4',
227 'action=query&list=gadgets&gaenabledonly'
228 =>
'apihelp-query+gadgets-example-5',
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
This is a base class for all Query modules.
Created on 15 April 2011 API for Gadgets extension.
setIndexedTagNameForMetadata(&$metadata)
__construct(ApiQuery $queryModule, $moduleName)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
This is the main query class.
static singleton()
Get the configured default GadgetRepo.
isAllowed(User $user)
Checks whether given user has permissions to use this gadget.
isEnabled( $user)
Checks whether this gadget is enabled for given user.
namespace being checked & $result
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))