Niharika29 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/249887

Change subject: Remove default gadgets from Special:GadgetUsage
......................................................................

Remove default gadgets from Special:GadgetUsage

The numbers for default gadgets are inconsistent and can be misleading.

Change-Id: Ib46084d617a536e4e25da80424ad70cec2a09f5a
---
M SpecialGadgetUsage.php
1 file changed, 23 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets 
refs/changes/87/249887/1

diff --git a/SpecialGadgetUsage.php b/SpecialGadgetUsage.php
index 8356d7e..7f475c7 100644
--- a/SpecialGadgetUsage.php
+++ b/SpecialGadgetUsage.php
@@ -96,6 +96,23 @@
        }
 
        /**
+        * Get a list of default gadgets
+        * @return list
+       */
+       public function getDefaultGadgets() {
+               $gadgets = GadgetRepo::singleton()->getStructuredList();
+               $gadgetsList = array();
+               foreach ( $gadgets as $gadget ) {
+                       foreach ( $gadget as $gId => $gGadget ) {
+                               if ( $gGadget->isOnByDefault() ) {
+                                       $gadgetsList[] = $gId;
+                               }
+                       }
+               }
+               return $gadgetsList;
+       }
+
+       /**
         * Format and output report results using the given information plus
         * OutputPage
         *
@@ -107,13 +124,16 @@
         * @param int $offset Paging offset
         */
        protected function outputResults( $out, $skin, $dbr, $res, $num, 
$offset ) {
+               $defaultGadgets = $this->getDefaultGadgets();
                if ( $num > 0 ) {
                        $this->outputTableStart();
 
                        foreach ( $res as $row ) {
-                               $line = $this->formatResult( $skin, $row );
-                               if ( $line ) {
-                                       $out->addHTML( $line );
+                               if ( !in_array( substr( $row->title, 7 ), 
$defaultGadgets ) ) {
+                                       $line = $this->formatResult( $skin, 
$row );
+                                       if ( $line ) {
+                                               $out->addHTML( $line );
+                                       }
                                }
                        }
                        // Close table element

-- 
To view, visit https://gerrit.wikimedia.org/r/249887
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib46084d617a536e4e25da80424ad70cec2a09f5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to