r97354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97353‎ | r97354 | r97355 >
Date:01:32, 17 September 2011
Author:krinkle
Status:ok
Tags:
Comment:
[RL2] More renaming from 'name' to 'id'
(Follows-up r96761)
Modified paths:
  • /branches/RL2/extensions/Gadgets/GadgetHooks.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/GadgetHooks.php
@@ -16,16 +16,16 @@
1717 /**
1818 * Get the gadget ID from a title
1919 * @param $title Title object
20 - * @return string Gadget name or null if not a gadget definition page
 20+ * @return string Gadget id or null if not a gadget definition page
2121 */
2222 public static function getIDFromTitle( Title $title ) {
23 - $name = $title->getText();
 23+ $id = $title->getText();
2424 if ( $title->getNamespace() !== NS_GADGET_DEFINITION || !preg_match( '!\.js$!u', $name ) ) {
2525 // Not a gadget definition page
2626 return null;
2727 }
2828 // Trim .js from the page name to obtain the gadget ID
29 - return substr( $name, 0, -3 );
 29+ return substr( $id, 0, -3 );
3030 }
3131
3232 /**
@@ -196,7 +196,7 @@
197197 public static function getPreferences( $user, &$preferences ) {
198198 $repo = LocalGadgetRepo::singleton();
199199 $gadgets = $repo->getGadgetIds();
200 - $categories = array(); // array( category => array( desc => name ) )
 200+ $categories = array(); // array( category => array( desc => title ) )
201201 $default = array(); // array of Gadget ids
202202 foreach ( $gadgets as $id ) {
203203 $gadget = $repo->getGadget( $id );
Index: branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php
@@ -4,7 +4,7 @@
55 */
66 class LocalGadgetRepo extends GadgetRepo {
77 protected $data = array();
8 - protected $namesLoaded = false;
 8+ protected $idsLoaded = false;
99
1010 /** Memcached key of the gadget names list. Subclasses may override this in their constructor.
1111 * This could've been a static member if we had PHP 5.3's late static binding.
@@ -210,7 +210,7 @@
211211 */
212212 protected function loadIDs() {
213213 global $wgMemc;
214 - if ( $this->namesLoaded ) {
 214+ if ( $this->idsLoaded ) {
215215 // Already loaded
216216 return array_keys( $this->data );
217217 }
@@ -221,7 +221,7 @@
222222 // Yay, data is in cache
223223 // Add to $this->data , but let things already in $this->data take precedence
224224 $this->data += $cached;
225 - $this->namesLoaded = true;
 225+ $this->idsLoaded = true;
226226 return array_keys( $this->data );
227227 }
228228
@@ -238,7 +238,7 @@
239239 }
240240 // Write to memc
241241 $wgMemc->set( $this->namesKey, $toCache );
242 - $this->namesLoaded = true;
 242+ $this->idsLoaded = true;
243243 return array_keys( $this->data );
244244 }
245245

Follow-up revisions

RevisionCommit summaryAuthorDate
r97363[RL2] More renaming from 'name' to 'id'...krinkle02:34, 17 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96761[ResourceLoader2] (BREAKING CHANGE) Rename gd_name to gd_id to avoid confusio...krinkle00:08, 11 September 2011

Status & tagging log