Index: trunk/extensions/Contributors/Contributors.page.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | if( is_object( $this->target ) ) { |
46 | 46 | if( $this->target->exists() ) { |
47 | 47 | $names = array(); |
48 | | - list( $contributors, $others ) = $this->getMainContributors(); |
| 48 | + list( $contributors, $others ) = self::getMainContributors($this->target); |
49 | 49 | foreach( $contributors as $username => $info ) |
50 | 50 | $names[] = $username; |
51 | 51 | $output = $wgContentLang->listToText( $names ); |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | $skin =& $wgUser->getSkin(); |
90 | 90 | $link = $skin->makeKnownLinkObj( $this->target ); |
91 | 91 | $wgOut->addHTML( '<h2>' . wfMsgHtml( 'contributors-subtitle', $link ) . '</h2>' ); |
92 | | - list( $contributors, $others ) = $this->getMainContributors(); |
| 92 | + list( $contributors, $others ) = self::getMainContributors($this->target); |
93 | 93 | $wgOut->addHTML( '<ul>' ); |
94 | 94 | foreach( $contributors as $username => $info ) { |
95 | 95 | list( $id, $count ) = $info; |
— | — | @@ -116,12 +116,12 @@ |
117 | 117 | * |
118 | 118 | * @return array |
119 | 119 | */ |
120 | | - public function getMainContributors() { |
| 120 | + public static function getMainContributors($title) { |
121 | 121 | wfProfileIn( __METHOD__ ); |
122 | 122 | global $wgContributorsLimit, $wgContributorsThreshold; |
123 | 123 | $total = 0; |
124 | 124 | $ret = array(); |
125 | | - $all = $this->getContributors(); |
| 125 | + $all = self::getContributors($title); |
126 | 126 | foreach( $all as $username => $info ) { |
127 | 127 | list( $id, $count ) = $info; |
128 | 128 | if( $total >= $wgContributorsLimit && $count < $wgContributorsThreshold ) |
— | — | @@ -139,10 +139,10 @@ |
140 | 140 | * |
141 | 141 | * @return array |
142 | 142 | */ |
143 | | - public function getContributors() { |
| 143 | + public static function getContributors($title) { |
144 | 144 | wfProfileIn( __METHOD__ ); |
145 | 145 | global $wgMemc; |
146 | | - $k = wfMemcKey( 'contributors', $this->target->getArticleId() ); |
| 146 | + $k = wfMemcKey( 'contributors', $title->getArticleId() ); |
147 | 147 | $contributors = $wgMemc->get( $k ); |
148 | 148 | if( !$contributors ) { |
149 | 149 | $contributors = array(); |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | 'rev_user', |
156 | 156 | 'rev_user_text', |
157 | 157 | ), |
158 | | - $this->getConditions(), |
| 158 | + self::getConditions($title), |
159 | 159 | __METHOD__, |
160 | 160 | array( |
161 | 161 | 'GROUP BY' => 'rev_user_text', |
— | — | @@ -176,9 +176,9 @@ |
177 | 177 | * |
178 | 178 | * @return array |
179 | 179 | */ |
180 | | - protected function getConditions() { |
| 180 | + protected static function getConditions($title) { |
181 | 181 | global $wgVersion; |
182 | | - $conds['rev_page'] = $this->target->getArticleId(); |
| 182 | + $conds['rev_page'] = $title->getArticleId(); |
183 | 183 | if( version_compare( $wgVersion, '1.11alpha', '>=' ) ) |
184 | 184 | $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . ' = 0'; |
185 | 185 | return $conds; |