mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-12-04 03:38:11 +00:00
Merge "Remove default gadgets from Special:GadgetUsage"
This commit is contained in:
commit
100a7ce5d3
|
@ -95,6 +95,23 @@ class SpecialGadgetUsage extends QueryPage {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of default gadgets
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
protected function getDefaultGadgets() {
|
||||||
|
$gadgetRepo = GadgetRepo::singleton();
|
||||||
|
$gadgetIds = $gadgetRepo->getGadgetIds();
|
||||||
|
$gadgetsList = array();
|
||||||
|
foreach ( $gadgetIds as $g ) {
|
||||||
|
$gadget = $gadgetRepo->getGadget( $g );
|
||||||
|
if ( $gadget->isOnByDefault() ) {
|
||||||
|
$gadgetsList[] = $gadget->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $gadgetsList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format and output report results using the given information plus
|
* Format and output report results using the given information plus
|
||||||
* OutputPage
|
* OutputPage
|
||||||
|
@ -107,13 +124,17 @@ class SpecialGadgetUsage extends QueryPage {
|
||||||
* @param int $offset Paging offset
|
* @param int $offset Paging offset
|
||||||
*/
|
*/
|
||||||
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
|
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
|
||||||
|
$defaultGadgets = $this->getDefaultGadgets();
|
||||||
if ( $num > 0 ) {
|
if ( $num > 0 ) {
|
||||||
$this->outputTableStart();
|
$this->outputTableStart();
|
||||||
|
|
||||||
foreach ( $res as $row ) {
|
foreach ( $res as $row ) {
|
||||||
$line = $this->formatResult( $skin, $row );
|
// Remove the 'gadget-' part of the result string and compare if it's present
|
||||||
if ( $line ) {
|
// in $defaultGadgets, if not we format it and add it to the output
|
||||||
$out->addHTML( $line );
|
if ( !in_array( substr( $row->title, 7 ), $defaultGadgets ) ) {
|
||||||
|
$line = $this->formatResult( $skin, $row );
|
||||||
|
if ( $line ) {
|
||||||
|
$out->addHTML( $line );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Close table element
|
// Close table element
|
||||||
|
|
Loading…
Reference in a new issue