| Index: branches/RL2/extensions/Gadgets/GadgetHooks.php |
| — | — | @@ -16,16 +16,16 @@ |
| 17 | 17 | /** |
| 18 | 18 | * Get the gadget ID from a title |
| 19 | 19 | * @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 |
| 21 | 21 | */ |
| 22 | 22 | public static function getIDFromTitle( Title $title ) { |
| 23 | | - $name = $title->getText(); |
| | 23 | + $id = $title->getText(); |
| 24 | 24 | if ( $title->getNamespace() !== NS_GADGET_DEFINITION || !preg_match( '!\.js$!u', $name ) ) { |
| 25 | 25 | // Not a gadget definition page |
| 26 | 26 | return null; |
| 27 | 27 | } |
| 28 | 28 | // Trim .js from the page name to obtain the gadget ID |
| 29 | | - return substr( $name, 0, -3 ); |
| | 29 | + return substr( $id, 0, -3 ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| — | — | @@ -196,7 +196,7 @@ |
| 197 | 197 | public static function getPreferences( $user, &$preferences ) { |
| 198 | 198 | $repo = LocalGadgetRepo::singleton(); |
| 199 | 199 | $gadgets = $repo->getGadgetIds(); |
| 200 | | - $categories = array(); // array( category => array( desc => name ) ) |
| | 200 | + $categories = array(); // array( category => array( desc => title ) ) |
| 201 | 201 | $default = array(); // array of Gadget ids |
| 202 | 202 | foreach ( $gadgets as $id ) { |
| 203 | 203 | $gadget = $repo->getGadget( $id ); |
| Index: branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php |
| — | — | @@ -4,7 +4,7 @@ |
| 5 | 5 | */ |
| 6 | 6 | class LocalGadgetRepo extends GadgetRepo { |
| 7 | 7 | protected $data = array(); |
| 8 | | - protected $namesLoaded = false; |
| | 8 | + protected $idsLoaded = false; |
| 9 | 9 | |
| 10 | 10 | /** Memcached key of the gadget names list. Subclasses may override this in their constructor. |
| 11 | 11 | * This could've been a static member if we had PHP 5.3's late static binding. |
| — | — | @@ -210,7 +210,7 @@ |
| 211 | 211 | */ |
| 212 | 212 | protected function loadIDs() { |
| 213 | 213 | global $wgMemc; |
| 214 | | - if ( $this->namesLoaded ) { |
| | 214 | + if ( $this->idsLoaded ) { |
| 215 | 215 | // Already loaded |
| 216 | 216 | return array_keys( $this->data ); |
| 217 | 217 | } |
| — | — | @@ -221,7 +221,7 @@ |
| 222 | 222 | // Yay, data is in cache |
| 223 | 223 | // Add to $this->data , but let things already in $this->data take precedence |
| 224 | 224 | $this->data += $cached; |
| 225 | | - $this->namesLoaded = true; |
| | 225 | + $this->idsLoaded = true; |
| 226 | 226 | return array_keys( $this->data ); |
| 227 | 227 | } |
| 228 | 228 | |
| — | — | @@ -238,7 +238,7 @@ |
| 239 | 239 | } |
| 240 | 240 | // Write to memc |
| 241 | 241 | $wgMemc->set( $this->namesKey, $toCache ); |
| 242 | | - $this->namesLoaded = true; |
| | 242 | + $this->idsLoaded = true; |
| 243 | 243 | return array_keys( $this->data ); |
| 244 | 244 | } |
| 245 | 245 | |