r106555 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106554‎ | r106555 | r106556 >
Date:09:38, 18 December 2011
Author:cervidae
Status:deferred
Tags:
Comment:
Fixing minor bugs in follow-up to r106527
Modified paths:
  • /trunk/extensions/HelpCommons/HelpCommons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HelpCommons/HelpCommons.php
@@ -50,7 +50,7 @@
5151 * @return bool
5252 */
5353 function wfHelpCommonsLoad( $helppage ) {
54 - global $wgOut, $wgContLang, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname;
 54+ global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgOut;
5555
5656 $title = $helppage->getTitle();
5757
@@ -105,7 +105,7 @@
106106 * @return bool
107107 */
108108 function wfHelpCommonsRedirectTalks( &$helppage, &$outputDone, &$pcache ) {
109 - global $wgOut, $wgContLang, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname;
 109+ global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgOut;
110110
111111 $title = $helppage->getTitle();
112112
@@ -127,8 +127,8 @@
128128 );
129129 }
130130 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 ) );
133133 $redirectTalkPage = $helpCommonsRedirectTalk->getFullText();
134134 $wgOut->redirect( $redirectTalkPage );
135135 return false;
@@ -168,7 +168,7 @@
169169 }
170170
171171 // 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() ) {
173173 return true;
174174 }
175175
@@ -195,7 +195,7 @@
196196 * @return bool
197197 */
198198 function efHelpCommonsChangeCategoryLinks( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) {
199 - global $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname, $wgTitle;
 199+ global $wgTitle, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname;
200200
201201 if ( $wgTitle->getNamespace() != NS_HELP || $wgTitle->exists() ) {
202202 return true;
@@ -272,8 +272,17 @@
273273 * @return bool
274274 */
275275 function fnProtectHelpCommons( &$title, &$user, $action, &$result ) {
276 - global $wgHelpCommonsProtect, $wgHelpCommonsProtectAll, $wgHelpCommonsFetchingWikis, $wgLanguageCode, $wgDBname;
 276+ global $wgHelpCommonsFetchingWikis, $wgDBname, $wgHelpCommonsProtectAll, $wgHelpCommonsProtect, $wgLanguageCode;
277277
 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+
278287 $ns = $title->getNamespace();
279288 if ( ( $ns !== NS_HELP && $ns !== NS_HELP_TALK ) || $title->exists() ) {
280289 return true;
@@ -286,7 +295,7 @@
287296
288297 if ( $wgHelpCommonsProtectAll ) {
289298 $result = array( 'protectedpagetext' );
290 - return true;
 299+ return false;
291300 } elseif ( !$wgHelpCommonsProtect ) {
292301 return true;
293302 }
@@ -294,7 +303,7 @@
295304 foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) {
296305 foreach ( $urls as $url => $helpwiki ) {
297306 // only protect non-existent help pages on non-help-page-fetching wikis
298 - if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) {
 307+ if ( $wgLanguageCode == $language ) {
299308 $dbr = wfGetDB( DB_SLAVE, array(), $helpwiki );
300309 $res = $dbr->selectField(
301310 'page',

Sign-offs

UserFlagDate
SVGtested10:35, 18 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106527* Removed usage of $wgTitle where possible...ialex20:14, 17 December 2011

Status & tagging log