36 parent::__construct( $name );
38 $this->shownavigation =
false;
39 $this->activeUsers = $this->
getConfig()->get(
'SpecialGadgetUsageActiveUsers' );
46 parent::execute( $par );
82 if ( !$this->activeUsers ) {
84 'tables' => [
'user_properties' ],
86 'title' =>
'up_property',
87 'value' =>
'SUM( up_value )',
88 'namespace' => NS_GADGET
91 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
94 'GROUP BY' => [
'up_property' ]
99 'tables' => [
'user_properties',
'user',
'querycachetwo' ],
101 'title' =>
'up_property',
102 'value' =>
'SUM( up_value )',
104 'namespace' =>
'COUNT( qcc_title )'
107 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
110 'GROUP BY' => [
'up_property' ]
120 'user_name = qcc_title',
121 'qcc_type = "activeusers"',
140 $html = Html::openElement(
'table', [
'class' => [
'sortable',
'wikitable' ] ] );
141 $html .= Html::openElement(
'thead', [] );
142 $html .= Html::openElement(
'tr', [] );
143 $headers = [
'gadgetusage-gadget',
'gadgetusage-usercount' ];
144 if ( $this->activeUsers ) {
145 $headers[] =
'gadgetusage-activeusers';
147 foreach ( $headers as $h ) {
148 if ( $h ==
'gadgetusage-gadget' ) {
149 $html .= Html::element(
'th', [], $this->
msg( $h )->text() );
151 $html .= Html::element(
'th', [
'data-sort-type' =>
'number' ],
152 $this->
msg( $h )->text() );
155 $html .= Html::closeElement(
'tr' );
156 $html .= Html::closeElement(
'thead' );
157 $html .= Html::openElement(
'tbody', [] );
159 $this->
getOutput()->addModuleStyles(
'jquery.tablesorter.styles' );
160 $this->
getOutput()->addModules(
'jquery.tablesorter' );
169 Html::closeElement(
'tbody' ) .
170 Html::closeElement(
'table' )
180 $gadgetTitle = substr( $result->title, 7 );
181 $gadgetUserCount = $this->
getLanguage()->formatNum( $result->value );
182 if ( $gadgetTitle ) {
183 $html = Html::openElement(
'tr', [] );
184 $html .= Html::element(
'td', [], $gadgetTitle );
185 $html .= Html::element(
'td', [], $gadgetUserCount );
186 if ( $this->activeUsers ==
true ) {
187 $activeUserCount = $this->
getLanguage()->formatNum( $result->namespace );
188 $html .= Html::element(
'td', [], $activeUserCount );
190 $html .= Html::closeElement(
'tr' );
204 foreach ( $gadgetIds as $g ) {
205 $gadget = $gadgetRepo->getGadget( $g );
206 if ( $gadget->isOnByDefault() ) {
207 $gadgetsList[] = $gadget->getName();
210 asort( $gadgetsList, SORT_STRING | SORT_FLAG_CASE );
227 $gadgetIds = $gadgetRepo->getGadgetIds();
229 if ( $this->activeUsers ) {
231 $this->
msg(
'gadgetusage-intro' )
232 ->numParams( $this->
getConfig()->
get(
'ActiveUserDays' ) )->parseAsBlock()
236 $this->
msg(
'gadgetusage-intro-noactive' )->parseAsBlock()
242 foreach ( $defaultGadgets as $default ) {
243 $html = Html::openElement(
'tr', [] );
244 $html .= Html::element(
'td', [], $default );
245 $html .= Html::element(
'td', [
'data-sort-value' =>
'Infinity' ],
246 $this->
msg(
'gadgetusage-default' )->text() );
247 if ( $this->activeUsers ) {
248 $html .= Html::element(
'td', [
'data-sort-value' =>
'Infinity' ],
249 $this->
msg(
'gadgetusage-default' )->text() );
251 $html .= Html::closeElement(
'tr' );
252 $out->addHTML( $html );
254 foreach (
$res as $row ) {
257 if ( !in_array( substr( $row->title, 7 ), $defaultGadgets ) ) {
259 if ( in_array( substr( $row->title, 7 ), $gadgetIds ) ) {
262 $out->addHTML(
$line );
271 $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.
execute( $par)
This is the actual workhorse.It does everything needed to make a real, honest-to-gosh query page.
__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.
outputTableEnd()
Output the end of the table
getOutput()
Get the OutputPage being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.