Index: trunk/phase3/includes/User.php |
— | — | @@ -1110,11 +1110,11 @@ |
1111 | 1111 | * will not be re-added automatically. The user will also not lose the |
1112 | 1112 | * group if they no longer meet the criteria. |
1113 | 1113 | * |
1114 | | - * @param $event String 'onEdit' or 'onView' (each one has groups/criteria) |
| 1114 | + * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria) |
1115 | 1115 | * |
1116 | 1116 | * @return array Array of groups the user has been promoted to. |
1117 | 1117 | * |
1118 | | - * @see $wgAutopromote |
| 1118 | + * @see $wgAutopromoteOnce |
1119 | 1119 | */ |
1120 | 1120 | public function addAutopromoteOnceGroups( $event ) { |
1121 | 1121 | if ( $this->getId() ) { |
— | — | @@ -2346,7 +2346,7 @@ |
2347 | 2347 | 'ug_user' => $this->getID(), |
2348 | 2348 | 'ug_group' => $group, |
2349 | 2349 | ), __METHOD__ ); |
2350 | | - //remember that the user has had this group |
| 2350 | + // Remember that the user was in this group |
2351 | 2351 | $dbw->insert( 'user_former_groups', |
2352 | 2352 | array( |
2353 | 2353 | 'ufg_user' => $this->getID(), |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | * - special pages |
103 | 103 | * - normal pages |
104 | 104 | * |
105 | | - * @return Article object |
| 105 | + * @return void |
106 | 106 | */ |
107 | 107 | public function performRequest() { |
108 | 108 | global $wgServer, $wgUsePathInfo; |
— | — | @@ -113,22 +113,15 @@ |
114 | 114 | $output = $this->context->getOutput(); |
115 | 115 | $user = $this->context->getUser(); |
116 | 116 | |
117 | | - # Promote user to any groups they meet the criteria for |
118 | | - $user->addAutopromoteOnceGroups( 'onView' ); |
119 | | - |
120 | 117 | if ( $request->getVal( 'printable' ) === 'yes' ) { |
121 | 118 | $output->setPrintable(); |
122 | 119 | } |
123 | 120 | |
124 | | - wfRunHooks( 'BeforeInitialize', array( |
125 | | - &$title, |
126 | | - null, |
127 | | - &$output, |
128 | | - &$user, |
129 | | - $request, |
130 | | - $this |
131 | | - ) ); |
132 | | - |
| 121 | + $pageView = false; // was an article or special page viewed? |
| 122 | + |
| 123 | + wfRunHooks( 'BeforeInitialize', |
| 124 | + array( &$title, null, &$output, &$user, $request, $this ) ); |
| 125 | + |
133 | 126 | // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty. |
134 | 127 | if ( $title instanceof BadTitle ) { |
135 | 128 | throw new ErrorPageError( 'badtitle', 'badtitletext' ); |
— | — | @@ -196,13 +189,15 @@ |
197 | 190 | } |
198 | 191 | // Special pages |
199 | 192 | } elseif ( NS_SPECIAL == $title->getNamespace() ) { |
200 | | - // actions that need to be made when we have a special pages |
| 193 | + $pageView = true; |
| 194 | + // Actions that need to be made when we have a special pages |
201 | 195 | SpecialPageFactory::executePath( $title, $this->context ); |
202 | 196 | } else { |
203 | 197 | // ...otherwise treat it as an article view. The article |
204 | 198 | // may be a redirect to another article or URL. |
205 | 199 | $article = $this->initializeArticle(); |
206 | 200 | if ( is_object( $article ) ) { |
| 201 | + $pageView = true; |
207 | 202 | /** |
208 | 203 | * $wgArticle is deprecated, do not use it. This will possibly be removed |
209 | 204 | * entirely in 1.20 or 1.21 |
— | — | @@ -212,8 +207,6 @@ |
213 | 208 | $wgArticle = $article; |
214 | 209 | |
215 | 210 | $this->performAction( $article ); |
216 | | - wfProfileOut( __METHOD__ ); |
217 | | - return $article; |
218 | 211 | } elseif ( is_string( $article ) ) { |
219 | 212 | $output->redirect( $article ); |
220 | 213 | } else { |
— | — | @@ -221,6 +214,12 @@ |
222 | 215 | throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" ); |
223 | 216 | } |
224 | 217 | } |
| 218 | + |
| 219 | + if ( $pageView ) { |
| 220 | + // Promote user to any groups they meet the criteria for |
| 221 | + $user->addAutopromoteOnceGroups( 'onView' ); |
| 222 | + } |
| 223 | + |
225 | 224 | wfProfileOut( __METHOD__ ); |
226 | 225 | } |
227 | 226 | |
— | — | @@ -406,7 +405,7 @@ |
407 | 406 | * |
408 | 407 | * @param $article Article |
409 | 408 | */ |
410 | | - private function performAction( $article ) { |
| 409 | + private function performAction( Article $article ) { |
411 | 410 | global $wgSquidMaxage, $wgUseExternalEditor; |
412 | 411 | |
413 | 412 | wfProfileIn( __METHOD__ ); |
— | — | @@ -416,9 +415,8 @@ |
417 | 416 | $title = $this->context->getTitle(); |
418 | 417 | $user = $this->context->getUser(); |
419 | 418 | |
420 | | - if ( !wfRunHooks( 'MediaWikiPerformAction', array( |
421 | | - $output, $article, $title, |
422 | | - $user, $request, $this ) ) ) |
| 419 | + if ( !wfRunHooks( 'MediaWikiPerformAction', |
| 420 | + array( $output, $article, $title, $user, $request, $this ) ) ) |
423 | 421 | { |
424 | 422 | wfProfileOut( __METHOD__ ); |
425 | 423 | return; |
— | — | @@ -561,11 +559,11 @@ |
562 | 560 | return; |
563 | 561 | } |
564 | 562 | |
565 | | - if ( $wgUseFileCache && $wgTitle !== null ) { |
| 563 | + if ( $wgUseFileCache && $wgTitle->getNamespace() != NS_SPECIAL ) { |
566 | 564 | wfProfileIn( 'main-try-filecache' ); |
567 | 565 | // Raw pages should handle cache control on their own, |
568 | 566 | // even when using file cache. This reduces hits from clients. |
569 | | - if ( $action != 'raw' && HTMLFileCache::useFileCache() ) { |
| 567 | + if ( HTMLFileCache::useFileCache() ) { |
570 | 568 | /* Try low-level file cache hit */ |
571 | 569 | $cache = new HTMLFileCache( $wgTitle, $action ); |
572 | 570 | if ( $cache->isFileCacheGood( /* Assume up to date */ ) ) { |
Index: trunk/phase3/includes/cache/HTMLFileCache.php |
— | — | @@ -93,16 +93,14 @@ |
94 | 94 | foreach( $queryVals as $query => $val ) { |
95 | 95 | if( $query == 'title' || $query == 'curid' ) { |
96 | 96 | continue; |
97 | | - } |
98 | 97 | // Normal page view in query form can have action=view. |
99 | 98 | // Raw hits for pages also stored, like .css pages for example. |
100 | | - elseif( $query == 'action' && ($val == 'view' || $val == 'raw') ) { |
| 99 | + } elseif( $query == 'action' && $val == 'view' ) { |
101 | 100 | continue; |
102 | 101 | } elseif( $query == 'usemsgcache' && $val == 'yes' ) { |
103 | 102 | continue; |
104 | | - } |
105 | 103 | // Below are header setting params |
106 | | - elseif( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) { |
| 104 | + } elseif( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) { |
107 | 105 | continue; |
108 | 106 | } else { |
109 | 107 | return false; |
Index: trunk/phase3/includes/Autopromote.php |
— | — | @@ -33,9 +33,11 @@ |
34 | 34 | * Does not return groups the user already belongs to or has once belonged. |
35 | 35 | * |
36 | 36 | * @param $user The user to get the groups for |
37 | | - * @param $event String 'onEdit' or 'onView' (each one has groups/criteria) |
38 | | - * |
| 37 | + * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria) |
| 38 | + * |
39 | 39 | * @return array Groups the user should be promoted to. |
| 40 | + * |
| 41 | + * @see $wgAutopromoteOnce |
40 | 42 | */ |
41 | 43 | public static function getAutopromoteOnceGroups( User $user, $event ) { |
42 | 44 | global $wgAutopromoteOnce; |