Index: trunk/extensions/HelpCommons/HelpCommons.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | * @return bool |
52 | 52 | */ |
53 | 53 | function wfHelpCommonsLoad( $helppage ) { |
54 | | - global $wgOut, $wgContLang, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname; |
| 54 | + global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgOut; |
55 | 55 | |
56 | 56 | $title = $helppage->getTitle(); |
57 | 57 | |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | * @return bool |
107 | 107 | */ |
108 | 108 | function wfHelpCommonsRedirectTalks( &$helppage, &$outputDone, &$pcache ) { |
109 | | - global $wgOut, $wgContLang, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname; |
| 109 | + global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgOut; |
110 | 110 | |
111 | 111 | $title = $helppage->getTitle(); |
112 | 112 | |
— | — | @@ -127,8 +127,8 @@ |
128 | 128 | ); |
129 | 129 | } |
130 | 130 | if ( !empty( $page->page_title ) ) { |
131 | | - if ( $page->page_title == $title && !$title->exists() ) { |
132 | | - $helpCommonsRedirectTalk = Title::newFromText( $url . '/index.php?title=' . str_replace( ' ', '_', $wgOut->getTitle() ) ); |
| 131 | + if ( $page->page_title == $dbkey && !$title->exists() ) { |
| 132 | + $helpCommonsRedirectTalk = Title::newFromText( $url . '/index.php?title=' . str_replace( ' ', '_', $title ) ); |
133 | 133 | $redirectTalkPage = $helpCommonsRedirectTalk->getFullText(); |
134 | 134 | $wgOut->redirect( $redirectTalkPage ); |
135 | 135 | return false; |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | } |
170 | 170 | |
171 | 171 | // only affects non-existent help pages and talks |
172 | | - if ( $target->getNamespace() != NS_HELP && $target->getNamespace() != NS_HELP_TALK || $target->exists() ) { |
| 172 | + if ( ( $target->getNamespace() != NS_HELP && $target->getNamespace() != NS_HELP_TALK ) || $target->exists() ) { |
173 | 173 | return true; |
174 | 174 | } |
175 | 175 | |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | * @return bool |
197 | 197 | */ |
198 | 198 | function efHelpCommonsChangeCategoryLinks( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) { |
199 | | - global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgTitle; |
| 199 | + global $wgTitle, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname; |
200 | 200 | |
201 | 201 | if ( $wgTitle->getNamespace() != NS_HELP || $wgTitle->exists() ) { |
202 | 202 | return true; |
— | — | @@ -272,8 +272,17 @@ |
273 | 273 | * @return bool |
274 | 274 | */ |
275 | 275 | function fnProtectHelpCommons( &$title, &$user, $action, &$result ) { |
276 | | - global $wgHelpCommonsProtect, $wgHelpCommonsProtectAll, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname; |
| 276 | + global $wgHelpCommonsFetchingWikis, $wgDBname, $wgHelpCommonsProtectAll, $wgHelpCommonsProtect, $wgLanguageCode; |
277 | 277 | |
| 278 | + // only affects non-help-page-fetching wikis |
| 279 | + foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) { |
| 280 | + foreach ( $urls as $url => $helpwiki ) { |
| 281 | + if ( $wgDBname == $helpwiki ) { |
| 282 | + return true; |
| 283 | + } |
| 284 | + } |
| 285 | + } |
| 286 | + |
278 | 287 | $ns = $title->getNamespace(); |
279 | 288 | if ( ( $ns !== NS_HELP && $ns !== NS_HELP_TALK ) || $title->exists() ) { |
280 | 289 | return true; |
— | — | @@ -286,7 +295,7 @@ |
287 | 296 | |
288 | 297 | if ( $wgHelpCommonsProtectAll ) { |
289 | 298 | $result = array( 'protectedpagetext' ); |
290 | | - return true; |
| 299 | + return false; |
291 | 300 | } elseif ( !$wgHelpCommonsProtect ) { |
292 | 301 | return true; |
293 | 302 | } |
— | — | @@ -294,7 +303,7 @@ |
295 | 304 | foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) { |
296 | 305 | foreach ( $urls as $url => $helpwiki ) { |
297 | 306 | // only protect non-existent help pages on non-help-page-fetching wikis |
298 | | - if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) { |
| 307 | + if ( $wgLanguageCode == $language ) { |
299 | 308 | $dbr = wfGetDB( DB_SLAVE, array(), $helpwiki ); |
300 | 309 | $res = $dbr->selectField( |
301 | 310 | 'page', |