http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97354

Revision: 97354
Author:   krinkle
Date:     2011-09-17 01:32:29 +0000 (Sat, 17 Sep 2011)
Log Message:
-----------
[RL2] More renaming from 'name' to 'id'
(Follows-up r96761)

Modified Paths:
--------------
    branches/RL2/extensions/Gadgets/GadgetHooks.php
    branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php

Modified: branches/RL2/extensions/Gadgets/GadgetHooks.php
===================================================================
--- branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-17 00:53:48 UTC 
(rev 97353)
+++ branches/RL2/extensions/Gadgets/GadgetHooks.php     2011-09-17 01:32:29 UTC 
(rev 97354)
@@ -16,16 +16,16 @@
        /**
         * Get the gadget ID from a title
         * @param $title Title object
-        * @return string Gadget name or null if not a gadget definition page
+        * @return string Gadget id or null if not a gadget definition page
         */
        public static function getIDFromTitle( Title $title ) {
-               $name = $title->getText();
+               $id = $title->getText();
                if ( $title->getNamespace() !== NS_GADGET_DEFINITION || 
!preg_match( '!\.js$!u', $name ) ) {
                        // Not a gadget definition page
                        return null;
                }
                // Trim .js from the page name to obtain the gadget ID
-               return substr( $name, 0, -3 );
+               return substr( $id, 0, -3 );
        }
 
        /**
@@ -196,7 +196,7 @@
        public static function getPreferences( $user, &$preferences ) {
                $repo = LocalGadgetRepo::singleton();
                $gadgets = $repo->getGadgetIds();
-               $categories = array(); // array( category => array( desc => 
name ) )
+               $categories = array(); // array( category => array( desc => 
title ) )
                $default = array(); // array of Gadget ids
                foreach ( $gadgets as $id ) {
                        $gadget = $repo->getGadget( $id );

Modified: branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php
===================================================================
--- branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php 2011-09-17 
00:53:48 UTC (rev 97353)
+++ branches/RL2/extensions/Gadgets/backend/LocalGadgetRepo.php 2011-09-17 
01:32:29 UTC (rev 97354)
@@ -4,7 +4,7 @@
  */
 class LocalGadgetRepo extends GadgetRepo {
        protected $data = array();
-       protected $namesLoaded = false;
+       protected $idsLoaded = false;
        
        /** Memcached key of the gadget names list. Subclasses may override 
this in their constructor.
          * This could've been a static member if we had PHP 5.3's late static 
binding.
@@ -210,7 +210,7 @@
         */
        protected function loadIDs() {
                global $wgMemc;
-               if ( $this->namesLoaded ) {
+               if ( $this->idsLoaded ) {
                        // Already loaded
                        return array_keys( $this->data );
                }
@@ -221,7 +221,7 @@
                        // Yay, data is in cache
                        // Add to $this->data , but let things already in 
$this->data take precedence
                        $this->data += $cached;
-                       $this->namesLoaded = true;
+                       $this->idsLoaded = true;
                        return array_keys( $this->data );
                }
                
@@ -238,7 +238,7 @@
                }
                // Write to memc
                $wgMemc->set( $this->namesKey, $toCache );
-               $this->namesLoaded = true;
+               $this->idsLoaded = true;
                return array_keys( $this->data );
        }
        


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to