r96946 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96945‎ | r96946 | r96947 >
Date:09:37, 13 September 2011
Author:catrope
Status:ok
Tags:
Comment:
RL2: Set the $info parameter in GadgetRepo::__construct() to an empty array by default, and clean up all the instances of new LocalGadgetRepo( array() );
Modified paths:
  • /branches/RL2/extensions/Gadgets/GadgetHooks.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/SpecialGadgetManager.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/backend/GadgetRepo.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/GadgetHooks.php
@@ -42,7 +42,7 @@
4343 return true;
4444 }
4545
46 - $repo = new LocalGadgetRepo( array() );
 46+ $repo = new LocalGadgetRepo;
4747 $repo->deleteGadget( $id );
4848 // deleteGadget() may return an error if the Gadget didn't exist, but we don't care here
4949 return true;
@@ -73,7 +73,7 @@
7474 $prevTs = $previousRev instanceof Revision ? $previousRev->getTimestamp() : wfTimestampNow();
7575
7676 // Update the database entry for this gadget
77 - $repo = new LocalGadgetRepo( array() );
 77+ $repo = new LocalGadgetRepo;
7878 // TODO: Timestamp in the constructor is ugly
7979 $gadget = new Gadget( $id, $repo, $text, $prevTs );
8080 $repo->modifyGadget( $gadget, $revision->getTimestamp() );
@@ -98,7 +98,7 @@
9999
100100 // Check whether this undeletion changed the latest revision of the page, by comparing
101101 // the timestamp of the latest revision with the timestamp in the DB
102 - $repo = new LocalGadgetRepo( array() );
 102+ $repo = new LocalGadgetRepo;
103103 $gadget = $repo->getGadget( $id );
104104 $gadgetTS = $gadget ? $gadget->getTimestamp() : 0;
105105
@@ -195,7 +195,7 @@
196196 */
197197 public static function getPreferences( $user, &$preferences ) {
198198 // TODO: Part of this is duplicated from registerModules(), factor out into the repo
199 - $repo = new LocalGadgetRepo( array() );
 199+ $repo = new LocalGadgetRepo;
200200
201201 $gadgets = $repo->getGadgetIds();
202202 $categories = array(); // array( category => array( desc => name ) )
Index: branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php
@@ -15,14 +15,10 @@
1616
1717 /**
1818 * Constructor.
19 - * @param info array of options
 19+ * @param info array of options. There are no applicable options for this class
2020 */
21 - public function __construct( array $options ) {
 21+ public function __construct( array $options = array() ) {
2222 parent::__construct( $options );
23 -
24 - // TODO: define options
25 - // FIXME if there are none, drop the mandatory param
26 -
2723 $this->namesKey = $this->getMemcKey( 'gadgets', 'localreponames' );
2824 }
2925
Index: branches/RL2/extensions/Gadgets/backend/GadgetRepo.php
@@ -8,8 +8,7 @@
99 * Constructor.
1010 * @param $info array with configuration data, depends on repo type
1111 */
12 - public function __construct( array $info ) {
13 - // TODO: Common config stuff for all repos?
 12+ public function __construct( array $info = array() ) {
1413 }
1514
1615 /**** Abstract functions ****/
Index: branches/RL2/extensions/Gadgets/api/ApiQueryGadgets.php
@@ -51,7 +51,7 @@
5252 }
5353
5454 private function getList() {
55 - $repo = new LocalGadgetRepo( array() );
 55+ $repo = new LocalGadgetRepo;
5656 $result = array();
5757
5858 if ( $this->neededIds !== false ) {
Index: branches/RL2/extensions/Gadgets/api/ApiQueryGadgetCategories.php
@@ -43,7 +43,7 @@
4444 private function getList() {
4545 $data = array();
4646 $result = $this->getResult();
47 - $repo = new LocalGadgetRepo( array() );
 47+ $repo = new LocalGadgetRepo;
4848
4949 $gadgetsByCategory = $repo->getGadgetsByCategory();
5050 foreach ( $gadgetsByCategory as $category => $gadgets ) {
Index: branches/RL2/extensions/Gadgets/SpecialGadgetManager.php
@@ -43,7 +43,7 @@
4444 private function generateOverview() {
4545 global $wgGadgetEnableSharing;
4646
47 - $repo = new LocalGadgetRepo( array() );
 47+ $repo = new LocalGadgetRepo;
4848 $gadgetsByCategory = $repo->getGadgetsByCategory();
4949
5050 // If there there are no gadgets at all, exit early.

Status & tagging log