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

Revision: 97481
Author:   reedy
Date:     2011-09-19 12:58:54 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
REL1_18 MFT r97460, r97461, r97469, r97470, r97475

Modified Paths:
--------------
    branches/REL1_18/phase3/includes/GenderCache.php
    branches/REL1_18/phase3/includes/Title.php
    branches/REL1_18/phase3/languages/Language.php

Property Changed:
----------------
    branches/REL1_18/phase3/includes/Title.php

Modified: branches/REL1_18/phase3/includes/GenderCache.php
===================================================================
--- branches/REL1_18/phase3/includes/GenderCache.php    2011-09-19 12:48:38 UTC 
(rev 97480)
+++ branches/REL1_18/phase3/includes/GenderCache.php    2011-09-19 12:58:54 UTC 
(rev 97481)
@@ -96,14 +96,24 @@
         * @param $caller String: the calling method
         */
        public function doQuery( $users, $caller = '' ) {
+               $default = $this->getDefault();
+
+               foreach ( (array) $users as $index => $value ) {
+                       $name = strtr( $value, '_', ' ' );
+                       if ( isset( $this->cache[$name] ) ) {
+                               // Skip users whose gender setting we already 
know
+                               unset( $users[$index] );
+                       } else {
+                               $users[$index] = $name;
+                               // For existing users, this value will be 
overwritten by the correct value
+                               $this->cache[$name] = $default;
+                       }
+               }
+
                if ( count( $users ) === 0 ) {
                        return false;
                }
 
-               foreach ( (array) $users as $index => $value ) {
-                       $users[$index] = strtr( $value, '_', ' ' );
-               }
-
                $dbr = wfGetDB( DB_SLAVE );
                $table = array( 'user', 'user_properties' );
                $fields = array( 'user_name', 'up_value' );
@@ -117,7 +127,6 @@
                }
                $res = $dbr->select( $table, $fields, $conds, $comment, $joins, 
$joins );
 
-               $default = $this->getDefault();
                foreach ( $res as $row ) {
                        $this->cache[$row->user_name] = $row->up_value ? 
$row->up_value : $default;
                }

Modified: branches/REL1_18/phase3/includes/Title.php
===================================================================
--- branches/REL1_18/phase3/includes/Title.php  2011-09-19 12:48:38 UTC (rev 
97480)
+++ branches/REL1_18/phase3/includes/Title.php  2011-09-19 12:58:54 UTC (rev 
97481)
@@ -639,9 +639,17 @@
                        }
                }
 
+               // Strip off subpages
+               $pagename = $this->getText();
+               if ( strpos( $pagename, '/' ) !== false ) {
+                       list( $username , ) = explode( '/', $pagename, 2 );
+               } else {
+                       $username = $pagename;
+               }
+
                if ( $wgContLang->needsGenderDistinction() &&
                                MWNamespace::hasGenderDistinction( 
$this->mNamespace ) ) {
-                       $gender = GenderCache::singleton()->getGenderOf( 
$this->getText(), __METHOD__ );
+                       $gender = GenderCache::singleton()->getGenderOf( 
$username, __METHOD__ );
                        return $wgContLang->getGenderNsText( $this->mNamespace, 
$gender );
                }
 


Property changes on: branches/REL1_18/phase3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/Title.php:51646
/branches/iwtransclusion/phase3/includes/Title.php:68448,69480
/branches/new-installer/phase3/includes/Title.php:43664-66004
/branches/sqlite/includes/Title.php:58211-58321
/branches/wmf-deployment/includes/Title.php:53381
/trunk/phase3/includes/Title.php:92551-92552,92560,92563-92564,92568,92570,92573-92574,92576,92580-92581,92713,92765,92884,92886-92887,92894,92898,92907,92932,92962,93062,93093,93149,93151,93233-93234,93258,93266,93382-93383,93385,93468,93473,93516-93518,93818-93822,93847,93858,93891,93935-93936,93986,94068,94155,94235-94236,94346,94350,94372,94422,94425,94444,94448,94456,94498,94502,94504,94511,94548,94601,94728,94737,94825,94862,94990,94995-94997,95000-95002,95006-95007,95010-95011,95014,95016-95017,95171,95409,95436,95458,95467,95470,95475,95493,95521,95525,95540,95627,95651-95653,95656,95659,95663,95855,95894,95899,96163,96174,96180,96212,96217-96218,96228,96271,96273,96286,96297,96306,96342,96358
   + /branches/REL1_15/phase3/includes/Title.php:51646
/branches/iwtransclusion/phase3/includes/Title.php:68448,69480
/branches/new-installer/phase3/includes/Title.php:43664-66004
/branches/sqlite/includes/Title.php:58211-58321
/branches/wmf-deployment/includes/Title.php:53381
/trunk/phase3/includes/Title.php:92551-92552,92560,92563-92564,92568,92570,92573-92574,92576,92580-92581,92713,92765,92884,92886-92887,92894,92898,92907,92932,92962,93062,93093,93149,93151,93233-93234,93258,93266,93382-93383,93385,93468,93473,93516-93518,93818-93822,93847,93858,93891,93935-93936,93986,94068,94155,94235-94236,94346,94350,94372,94422,94425,94444,94448,94456,94498,94502,94504,94511,94548,94601,94728,94737,94825,94862,94990,94995-94997,95000-95002,95006-95007,95010-95011,95014,95016-95017,95171,95409,95436,95458,95467,95470,95475,95493,95521,95525,95540,95627,95651-95653,95656,95659,95663,95855,95894,95899,96163,96174,96180,96212,96217-96218,96228,96271,96273,96286,96297,96306,96342,96358,97460-97461,97469-97470,97475

Modified: branches/REL1_18/phase3/languages/Language.php
===================================================================
--- branches/REL1_18/phase3/languages/Language.php      2011-09-19 12:48:38 UTC 
(rev 97480)
+++ branches/REL1_18/phase3/languages/Language.php      2011-09-19 12:58:54 UTC 
(rev 97481)
@@ -385,9 +385,19 @@
         * @since 1.18
         */
        function needsGenderDistinction() {
-               global $wgExtraGenderNamespaces;
-               $aliases = $wgExtraGenderNamespaces + 
self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
-               return count( $aliases ) > 0;
+               global $wgExtraGenderNamespaces, $wgExtraNamespaces;
+               if ( count( $wgExtraGenderNamespaces ) > 0 ) {
+                       // $wgExtraGenderNamespaces overrides everything
+                       return true;
+               } elseif( isset( $wgExtraNamespaces[NS_USER] ) && isset( 
$wgExtraNamespaces[NS_USER_TALK] ) ) {
+                       /// @todo There may be other gender namespace than 
NS_USER & NS_USER_TALK in the future
+                       // $wgExtraNamespaces overrides any gender aliases 
specified in i18n files
+                       return false;
+               } else {
+                       // Check what is in i18n files
+                       $aliases = self::$dataCache->getItem( $this->mCode, 
'namespaceGenderAliases' );
+                       return count( $aliases ) > 0;
+               }
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to