Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -2350,10 +2350,12 @@ |
2351 | 2351 | 'attribution' => array( |
2352 | 2352 | 'anonymous', |
2353 | 2353 | 'siteuser', |
| 2354 | + 'anonuser', |
2354 | 2355 | 'lastmodifiedatby', |
2355 | 2356 | 'othercontribs', |
2356 | 2357 | 'others', |
2357 | 2358 | 'siteusers', |
| 2359 | + 'anonusers', |
2358 | 2360 | 'creditspage', |
2359 | 2361 | 'nocredits', |
2360 | 2362 | ), |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -692,30 +692,37 @@ |
693 | 693 | public function getContributors($limit = 0, $offset = 0) { |
694 | 694 | # XXX: this is expensive; cache this info somewhere. |
695 | 695 | |
696 | | - $contribs = array(); |
697 | 696 | $dbr = wfGetDB( DB_SLAVE ); |
698 | 697 | $revTable = $dbr->tableName( 'revision' ); |
699 | 698 | $userTable = $dbr->tableName( 'user' ); |
700 | | - $user = $this->getUser(); |
| 699 | + |
701 | 700 | $pageId = $this->getId(); |
702 | 701 | |
703 | | - $deletedBit = $dbr->bitAnd('rev_deleted', Revision::DELETED_USER); // username hidden? |
| 702 | + $user = $this->getUser(); |
| 703 | + if ( $user ) { |
| 704 | + $excludeCond = "AND rev_user != $user"; |
| 705 | + } else { |
| 706 | + $userText = $dbr->addQuotes( $this->getUserText() ); |
| 707 | + $excludeCond = "AND rev_user_text != $userText"; |
| 708 | + } |
704 | 709 | |
705 | | - $sql = "SELECT {$userTable}.*, MAX(rev_timestamp) as timestamp |
| 710 | + $deletedBit = $dbr->bitAnd( 'rev_deleted', Revision::DELETED_USER ); // username hidden? |
| 711 | + |
| 712 | + $sql = "SELECT {$userTable}.*, rev_user_text as user_name, MAX(rev_timestamp) as timestamp |
706 | 713 | FROM $revTable LEFT JOIN $userTable ON rev_user = user_id |
707 | 714 | WHERE rev_page = $pageId |
708 | | - AND rev_user != $user |
| 715 | + $excludeCond |
709 | 716 | AND $deletedBit = 0 |
710 | | - GROUP BY rev_user, rev_user_text, user_real_name |
| 717 | + GROUP BY rev_user, rev_user_text |
711 | 718 | ORDER BY timestamp DESC"; |
712 | 719 | |
713 | | - if($limit > 0) |
714 | | - $sql = $dbr->limitResult($sql, $limit, $offset); |
| 720 | + if ( $limit > 0 ) |
| 721 | + $sql = $dbr->limitResult( $sql, $limit, $offset ); |
715 | 722 | |
716 | | - $sql .= ' '. $this->getSelectOptions(); |
| 723 | + $sql .= ' ' . $this->getSelectOptions(); |
| 724 | + wfVarDump( $sql ); |
| 725 | + $res = $dbr->query( $sql, __METHOD__ ); |
717 | 726 | |
718 | | - $res = $dbr->query($sql, __METHOD__ ); |
719 | | - |
720 | 727 | return new UserArrayFromResult( $res ); |
721 | 728 | } |
722 | 729 | |
Index: trunk/phase3/includes/Credits.php |
— | — | @@ -55,13 +55,13 @@ |
56 | 56 | * @param $showIfMax Bool: whether to contributors if there more than $cnt |
57 | 57 | * @return String: html |
58 | 58 | */ |
59 | | - public static function getCredits($article, $cnt, $showIfMax=true) { |
| 59 | + public static function getCredits( Article $article, $cnt, $showIfMax = true ) { |
60 | 60 | wfProfileIn( __METHOD__ ); |
61 | 61 | $s = ''; |
62 | 62 | |
63 | 63 | if( isset( $cnt ) && $cnt != 0 ){ |
64 | 64 | $s = self::getAuthor( $article ); |
65 | | - if ($cnt > 1 || $cnt < 0) { |
| 65 | + if ( $cnt > 1 || $cnt < 0 ) { |
66 | 66 | $s .= ' ' . self::getContributors( $article, $cnt - 1, $showIfMax ); |
67 | 67 | } |
68 | 68 | } |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | |
104 | 104 | $contributors = $article->getContributors(); |
105 | 105 | |
106 | | - $others_link = ''; |
| 106 | + $others_link = false; |
107 | 107 | |
108 | 108 | # Hmm... too many to fit! |
109 | 109 | if( $cnt > 0 && $contributors->count() > $cnt ){ |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | |
115 | 115 | $real_names = array(); |
116 | 116 | $user_names = array(); |
117 | | - $anon = 0; |
| 117 | + $anon_ips = array(); |
118 | 118 | |
119 | 119 | # Sift for real versus user names |
120 | 120 | foreach( $contributors as $user ) { |
— | — | @@ -125,26 +125,36 @@ |
126 | 126 | else |
127 | 127 | $user_names[] = $link; |
128 | 128 | } else { |
129 | | - $anon++; |
| 129 | + $anon_ips[] = self::link( $user ); |
130 | 130 | } |
131 | 131 | if( $cnt == 0 ) break; |
132 | 132 | } |
133 | 133 | |
134 | | - # Two strings: real names, and user names |
135 | | - $real = $wgLang->listToText( $real_names ); |
136 | | - $user = $wgLang->listToText( $user_names ); |
137 | | - if( $anon ) |
138 | | - $anon = wfMsgExt( 'anonymous', array( 'parseinline' ), $anon ); |
| 134 | + if ( count( $real_names ) ) { |
| 135 | + $real = $wgLang->listToText( $real_names ); |
| 136 | + } else { |
| 137 | + $real = false; |
| 138 | + } |
139 | 139 | |
140 | 140 | # "ThisSite user(s) A, B and C" |
141 | | - if( !empty( $user ) ){ |
142 | | - $user = wfMsgExt( 'siteusers', array( 'parsemag' ), $user, count( $user_names ) ); |
| 141 | + if( count( $user_names ) ){ |
| 142 | + $user = wfMsgExt( 'siteusers', array( 'parsemag' ), |
| 143 | + $wgLang->listToText( $user_names ), count( $user_names ) ); |
| 144 | + } else { |
| 145 | + $user = false; |
143 | 146 | } |
| 147 | + |
| 148 | + if( count( $anon_ips ) ){ |
| 149 | + $anon = wfMsgExt( 'anonusers', array( 'parsemag' ), |
| 150 | + $wgLang->listToText( $anon_ips ), count( $anon_ips ) ); |
| 151 | + } else { |
| 152 | + $anon = false; |
| 153 | + } |
144 | 154 | |
145 | 155 | # This is the big list, all mooshed together. We sift for blank strings |
146 | 156 | $fulllist = array(); |
147 | 157 | foreach( array( $real, $user, $anon, $others_link ) as $s ){ |
148 | | - if( !empty( $s ) ){ |
| 158 | + if( $s ){ |
149 | 159 | array_push( $fulllist, $s ); |
150 | 160 | } |
151 | 161 | } |
— | — | @@ -153,7 +163,7 @@ |
154 | 164 | $creds = $wgLang->listToText( $fulllist ); |
155 | 165 | |
156 | 166 | # "Based on work by ..." |
157 | | - return empty( $creds ) ? '' : wfMsg( 'othercontribs', $creds ); |
| 167 | + return strlen( $creds ) ? wfMsg( 'othercontribs', $creds ) : ''; |
158 | 168 | } |
159 | 169 | |
160 | 170 | /** |
— | — | @@ -163,13 +173,15 @@ |
164 | 174 | */ |
165 | 175 | protected static function link( User $user ) { |
166 | 176 | global $wgUser, $wgHiddenPrefs; |
167 | | - if( !in_array( 'realname', $wgHiddenPrefs ) ) |
| 177 | + if( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() ) |
168 | 178 | $real = $user->getRealName(); |
169 | 179 | else |
170 | 180 | $real = false; |
171 | 181 | |
172 | 182 | $skin = $wgUser->getSkin(); |
173 | | - $page = $user->getUserPage(); |
| 183 | + $page = $user->isAnon() ? |
| 184 | + SpecialPage::getTitleFor( 'Contributions', $user->getName() ) : |
| 185 | + $user->getUserPage(); |
174 | 186 | |
175 | 187 | return $skin->link( $page, htmlspecialchars( $real ? $real : $user->getName() ) ); |
176 | 188 | } |
— | — | @@ -181,11 +193,11 @@ |
182 | 194 | * @return String: html |
183 | 195 | */ |
184 | 196 | protected static function userLink( User $user ) { |
| 197 | + $link = self::link( $user ); |
185 | 198 | if( $user->isAnon() ){ |
186 | | - return wfMsgExt( 'anonymous', array( 'parseinline' ), 1 ); |
| 199 | + return wfMsgExt( 'anonuser', array( 'parseinline', 'replaceafter' ), $link ); |
187 | 200 | } else { |
188 | 201 | global $wgHiddenPrefs; |
189 | | - $link = self::link( $user ); |
190 | 202 | if( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) |
191 | 203 | return $link; |
192 | 204 | else |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3362,10 +3362,12 @@ |
3363 | 3363 | # Attribution |
3364 | 3364 | 'anonymous' => 'Anonymous {{PLURAL:$1|user|users}} of {{SITENAME}}', |
3365 | 3365 | 'siteuser' => '{{SITENAME}} user $1', |
| 3366 | +'anonuser' => '{{SITENAME}} anonymous user $1', |
3366 | 3367 | 'lastmodifiedatby' => 'This page was last modified $2, $1 by $3.', |
3367 | 3368 | 'othercontribs' => 'Based on work by $1.', |
3368 | 3369 | 'others' => 'others', |
3369 | 3370 | 'siteusers' => '{{SITENAME}} {{PLURAL:$2|user|users}} $1', |
| 3371 | +'anonusers' => '{{SITENAME}} anonymous {{PLURAL:$2|user|users}} $1', |
3370 | 3372 | 'creditspage' => 'Page credits', |
3371 | 3373 | 'nocredits' => 'There is no credits info available for this page.', |
3372 | 3374 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -242,6 +242,8 @@ |
243 | 243 | * New configuration variable $wgShowPageOnRedlink that can be set to show the page |
244 | 244 | instead of an edit interface when visiting a red link. The value can be specified |
245 | 245 | for specific usergroups and namespaces. |
| 246 | +* (bug 16310) Credits page now lists IP addresses rather than saying the number |
| 247 | + of anonymous users that edited the page |
246 | 248 | |
247 | 249 | === Bug fixes in 1.16 === |
248 | 250 | |