r96948 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96947‎ | r96948 | r96949 >
Date:09:58, 13 September 2011
Author:catrope
Status:ok
Tags:
Comment:
RL2: Tweak some comments and move some code around. No functional changes
Modified paths:
  • /branches/RL2/extensions/Gadgets/backend/ForeignDBGadgetRepo.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/backend/LocalGadgetRepo.php
@@ -150,17 +150,7 @@
151151 return Status::newGood();
152152 }
153153
154 - /*** Protected methods ***/
155 -
156154 /**
157 - * Get the master DB connection. Subclasses can override this to use a different DB
158 - * @return Database
159 - */
160 - protected function getMasterDB() {
161 - return wfGetDB( DB_MASTER );
162 - }
163 -
164 - /**
165155 * Get the slave DB connection. Subclasses can override this to use a different DB
166156 * @return Database
167157 */
@@ -172,6 +162,14 @@
173163 /*** Protected methods ***/
174164
175165 /**
 166+ * Get the master DB connection. Subclasses can override this to use a different DB
 167+ * @return Database
 168+ */
 169+ protected function getMasterDB() {
 170+ return wfGetDB( DB_MASTER );
 171+ }
 172+
 173+ /**
176174 * Get a memcached key. Subclasses can override this to use a foreign memc
177175 * @return string|bool Cache key, or false if this repo has no shared memc
178176 */
Index: branches/RL2/extensions/Gadgets/backend/ForeignDBGadgetRepo.php
@@ -46,7 +46,7 @@
4747 return $this->getMasterDB();
4848 }
4949
50 - /*** Overridden protected functions from LocalGadgetRepo ***/
 50+ /*** Overridden protected methods from LocalGadgetRepo ***/
5151 protected function getMasterDB() {
5252 if ( $this->db === null ) {
5353 $this->db = DatabaseBase::factory( $this->dbType,
Index: branches/RL2/extensions/Gadgets/backend/GadgetRepo.php
@@ -11,7 +11,7 @@
1212 public function __construct( array $info = array() ) {
1313 }
1414
15 - /**** Abstract functions ****/
 15+ /**** Abstract methods ****/
1616
1717 /**
1818 * Get the name of the ResourceLoader source of the modules
@@ -75,8 +75,20 @@
7676 */
7777 abstract public function deleteGadget( $id );
7878
79 - /**** Public functions ****/
 79+ /**** Public methods ****/
8080
 81+ public function getGadgetsByCategory() {
 82+ $retval = array();
 83+ $gadgetIDs = $this->getGadgetIds();
 84+ foreach ( $gadgetIDs as $id ) {
 85+ $gadget = $this->getGadget( $id );
 86+ $retval[$gadget->getCategory()][] = $gadget;
 87+ }
 88+ return $retval;
 89+ }
 90+
 91+ /*** Public static methods ***/
 92+
8193 /**
8294 * Get the localized title for a given category in a given language.
8395 *
@@ -99,15 +111,4 @@
100112 }
101113 return $msg->plain();
102114 }
103 -
104 - public function getGadgetsByCategory() {
105 - $retval = array();
106 - $gadgetIDs = $this->getGadgetIds();
107 - foreach ( $gadgetIDs as $id ) {
108 - $gadget = $this->getGadget( $id );
109 - $retval[$gadget->getCategory()][] = $gadget;
110 - }
111 - return $retval;
112 - }
113 -
114115 }

Status & tagging log