Index: branches/REL1_18/phase3/includes/Title.php |
— | — | @@ -639,9 +639,17 @@ |
640 | 640 | } |
641 | 641 | } |
642 | 642 | |
| 643 | + // Strip off subpages |
| 644 | + $pagename = $this->getText(); |
| 645 | + if ( strpos( $pagename, '/' ) !== false ) { |
| 646 | + list( $username , ) = explode( '/', $pagename, 2 ); |
| 647 | + } else { |
| 648 | + $username = $pagename; |
| 649 | + } |
| 650 | + |
643 | 651 | if ( $wgContLang->needsGenderDistinction() && |
644 | 652 | MWNamespace::hasGenderDistinction( $this->mNamespace ) ) { |
645 | | - $gender = GenderCache::singleton()->getGenderOf( $this->getText(), __METHOD__ ); |
| 653 | + $gender = GenderCache::singleton()->getGenderOf( $username, __METHOD__ ); |
646 | 654 | return $wgContLang->getGenderNsText( $this->mNamespace, $gender ); |
647 | 655 | } |
648 | 656 | |
Property changes on: branches/REL1_18/phase3/includes/Title.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
649 | 657 | Merged /trunk/phase3/includes/Title.php:r97460-97461,97469-97470,97475 |
Index: branches/REL1_18/phase3/includes/GenderCache.php |
— | — | @@ -96,14 +96,24 @@ |
97 | 97 | * @param $caller String: the calling method |
98 | 98 | */ |
99 | 99 | public function doQuery( $users, $caller = '' ) { |
| 100 | + $default = $this->getDefault(); |
| 101 | + |
| 102 | + foreach ( (array) $users as $index => $value ) { |
| 103 | + $name = strtr( $value, '_', ' ' ); |
| 104 | + if ( isset( $this->cache[$name] ) ) { |
| 105 | + // Skip users whose gender setting we already know |
| 106 | + unset( $users[$index] ); |
| 107 | + } else { |
| 108 | + $users[$index] = $name; |
| 109 | + // For existing users, this value will be overwritten by the correct value |
| 110 | + $this->cache[$name] = $default; |
| 111 | + } |
| 112 | + } |
| 113 | + |
100 | 114 | if ( count( $users ) === 0 ) { |
101 | 115 | return false; |
102 | 116 | } |
103 | 117 | |
104 | | - foreach ( (array) $users as $index => $value ) { |
105 | | - $users[$index] = strtr( $value, '_', ' ' ); |
106 | | - } |
107 | | - |
108 | 118 | $dbr = wfGetDB( DB_SLAVE ); |
109 | 119 | $table = array( 'user', 'user_properties' ); |
110 | 120 | $fields = array( 'user_name', 'up_value' ); |
— | — | @@ -117,7 +127,6 @@ |
118 | 128 | } |
119 | 129 | $res = $dbr->select( $table, $fields, $conds, $comment, $joins, $joins ); |
120 | 130 | |
121 | | - $default = $this->getDefault(); |
122 | 131 | foreach ( $res as $row ) { |
123 | 132 | $this->cache[$row->user_name] = $row->up_value ? $row->up_value : $default; |
124 | 133 | } |
Index: branches/REL1_18/phase3/languages/Language.php |
— | — | @@ -385,9 +385,19 @@ |
386 | 386 | * @since 1.18 |
387 | 387 | */ |
388 | 388 | function needsGenderDistinction() { |
389 | | - global $wgExtraGenderNamespaces; |
390 | | - $aliases = $wgExtraGenderNamespaces + self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' ); |
391 | | - return count( $aliases ) > 0; |
| 389 | + global $wgExtraGenderNamespaces, $wgExtraNamespaces; |
| 390 | + if ( count( $wgExtraGenderNamespaces ) > 0 ) { |
| 391 | + // $wgExtraGenderNamespaces overrides everything |
| 392 | + return true; |
| 393 | + } elseif( isset( $wgExtraNamespaces[NS_USER] ) && isset( $wgExtraNamespaces[NS_USER_TALK] ) ) { |
| 394 | + /// @todo There may be other gender namespace than NS_USER & NS_USER_TALK in the future |
| 395 | + // $wgExtraNamespaces overrides any gender aliases specified in i18n files |
| 396 | + return false; |
| 397 | + } else { |
| 398 | + // Check what is in i18n files |
| 399 | + $aliases = self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' ); |
| 400 | + return count( $aliases ) > 0; |
| 401 | + } |
392 | 402 | } |
393 | 403 | |
394 | 404 | /** |