33 parent::__construct( $name );
35 $this->shownavigation =
false;
36 $this->activeUsers = $this->
getConfig()->get(
'SpecialGadgetUsageActiveUsers' );
71 if ( !$this->activeUsers ) {
73 'tables' => [
'user_properties' ],
75 'title' =>
'up_property',
76 'value' =>
'SUM( up_value )',
77 'namespace' => NS_GADGET
80 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
83 'GROUP BY' => [
'up_property' ]
88 'tables' => [
'user_properties',
'user',
'querycachetwo' ],
90 'title' =>
'up_property',
91 'value' =>
'SUM( up_value )',
93 'namespace' =>
'COUNT( qcc_title )'
96 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
99 'GROUP BY' => [
'up_property' ]
109 'user_name = qcc_title',
110 'qcc_type = "activeusers"',
128 $html = Html::openElement(
'table', [
'class' => [
'sortable',
'wikitable' ] ] );
129 $html .= Html::openElement(
'tr', [] );
130 $headers = [
'gadgetusage-gadget',
'gadgetusage-usercount' ];
131 if ( $this->activeUsers ) {
132 $headers[] =
'gadgetusage-activeusers';
134 foreach ( $headers as $h ) {
135 if ( $h ==
'gadgetusage-gadget' ) {
136 $html .= Html::element(
'th', [], $this->
msg( $h )->
text() );
138 $html .= Html::element(
'th', [
'data-sort-type' =>
'number' ],
142 $html .= Html::closeElement(
'tr' );
152 $gadgetTitle = substr( $result->title, 7 );
153 $gadgetUserCount = $this->
getLanguage()->formatNum( $result->value );
154 if ( $gadgetTitle ) {
155 $html = Html::openElement(
'tr', [] );
156 $html .= Html::element(
'td', [], $gadgetTitle );
157 $html .= Html::element(
'td', [], $gadgetUserCount );
158 if ( $this->activeUsers ==
true ) {
159 $activeUserCount = $this->
getLanguage()->formatNum( $result->namespace );
160 $html .= Html::element(
'td', [], $activeUserCount );
162 $html .= Html::closeElement(
'tr' );
176 foreach ( $gadgetIds as $g ) {
177 $gadget = $gadgetRepo->getGadget( $g );
178 if ( $gadget->isOnByDefault() ) {
179 $gadgetsList[] = $gadget->getName();
182 asort( $gadgetsList, SORT_STRING | SORT_FLAG_CASE );
199 $gadgetIds = $gadgetRepo->getGadgetIds();
201 if ( $this->activeUsers ) {
203 $this->
msg(
'gadgetusage-intro' )
204 ->numParams( $this->
getConfig()->
get(
'ActiveUserDays' ) )->parseAsBlock()
208 $this->
msg(
'gadgetusage-intro-noactive' )->parseAsBlock()
214 foreach ( $defaultGadgets as $default ) {
215 $html = Html::openElement(
'tr', [] );
216 $html .= Html::element(
'td', [], $default );
217 $html .= Html::element(
'td', [], $this->
msg(
'gadgetusage-default' )->
text() );
218 if ( $this->activeUsers ) {
219 $html .= Html::element(
'td', [], $this->
msg(
'gadgetusage-default' )->
text() );
221 $html .= Html::closeElement(
'tr' );
224 foreach (
$res as $row ) {
227 if ( !in_array( substr( $row->title, 7 ), $defaultGadgets ) ) {
229 if ( in_array( substr( $row->title, 7 ), $gadgetIds ) ) {
238 $out->addHtml( Html::closeElement(
'table' ) );
241 $this->
msg(
'gadgetusage-noresults' )->parseAsBlock()
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static singleton()
Get the configured default GadgetRepo.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
int $offset
The offset and limit in use, as passed to the query() function.
Special:GadgetUsage - Lists all the gadgets on the wiki along with number of users.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
$activeUsers
Flag for holding the value of config variable SpecialGadgetUsageActiveUsers.
getQueryInfo()
Define the database query that is used to generate the stats table.
formatResult( $skin, $result)
getDefaultGadgets( $gadgetRepo, $gadgetIds)
Get a list of default gadgets.
outputTableStart()
Output the start of the table Including opening.
__construct( $name='GadgetUsage')
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
getOrderFields()
Subclasses return an array of fields to order by here.
outputResults( $out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
getOutput()
Get the OutputPage being used for this instance.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html