r105126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105125‎ | r105126 | r105127 >
Date:20:19, 4 December 2011
Author:cervidae
Status:deferred
Tags:
Comment:
using constant without function, per Nikerabbit, r104965
Modified paths:
  • /trunk/extensions/HelpCommons/HelpCommons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HelpCommons/HelpCommons.php
@@ -55,12 +55,12 @@
5656
5757 foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) {
5858 foreach ( $urls as $helpwiki ) {
59 - if ( $wgLanguageCode == "$language" && $wgDBname != $helpwiki ) {
 59+ if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) {
6060 $dbr = wfGetDB( DB_SLAVE, array(), $helpwiki );
6161 $page = $dbr->select(
6262 'page',
6363 array( 'page_title', 'page_namespace', 'page_latest' ),
64 - array( 'page_namespace' => constant( 'NS_HELP' ), 'page_title' => $title ),
 64+ array( 'page_namespace' => NS_HELP, 'page_title' => $title ),
6565 __METHOD__
6666 );
6767 $page = $dbr->fetchObject( $page );
@@ -109,12 +109,12 @@
110110
111111 foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) {
112112 foreach ( $urls as $url => $helpwiki ) {
113 - if ( $wgLanguageCode == "$language" && $wgDBname != $helpwiki ) {
 113+ if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) {
114114 $dbr = wfGetDB( DB_SLAVE, array(), $helpwiki );
115115 $page = $dbr->select(
116116 'page',
117117 array( 'page_title', 'page_namespace', 'page_latest' ),
118 - array( 'page_namespace' => constant( 'NS_HELP' ), 'page_title' => $title ),
 118+ array( 'page_namespace' => NS_HELP, 'page_title' => $title ),
119119 __METHOD__
120120 );
121121 $page = $dbr->fetchObject( $page );
@@ -184,7 +184,7 @@
185185 }
186186 foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) {
187187 foreach ( $urls as $url => $helpwiki ) {
188 - if ( $wgLanguageCode == "$language" && $wgDBname != $helpwiki ) {
 188+ if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) {
189189 // FIXME: $result is unused
190190 $result = '<span class="editsection">[<a href="' . $url . '/index.php?title=' .
191191 str_replace( ' ', '_', $title ) . '&amp;action=edit&amp;section=' . $section .
@@ -208,7 +208,7 @@
209209 foreach ( $wgHelpCommonsFetchingWikis as $language => $urls ) {
210210 foreach ( $urls as $url => $helpwiki ) {
211211 // only protect Help pages on non-help-pages-fetching wikis
212 - if ( $wgLanguageCode == "$language" && $wgDBname != $helpwiki ) {
 212+ if ( $wgLanguageCode == $language && $wgDBname != $helpwiki ) {
213213 // block actions 'edit' and 'create'
214214 if ( $action != 'edit' && $action != 'create' ) {
215215 return true;
@@ -218,7 +218,7 @@
219219 $res = $dbr->select(
220220 'page',
221221 array( 'page_title', 'page_namespace', 'page_latest' ),
222 - array( 'page_namespace' => constant( 'NS_HELP' ), 'page_title' => str_replace( ' ', '_', $title->getText() ) ),
 222+ array( 'page_namespace' => NS_HELP, 'page_title' => str_replace( ' ', '_', $title->getText() ) ),
223223 __METHOD__
224224 );
225225
@@ -229,7 +229,7 @@
230230 $ns = $title->getNamespace();
231231
232232 // check namespaces
233 - if( $ns == constant( 'NS_HELP' ) || $ns == constant( 'NS_HELP_TALK' ) ) {
 233+ if( $ns == NS_HELP || $ns == NS_HELP_TALK ) {
234234 // error message if action is blocked
235235 $result = array( 'protectedpagetext' );
236236

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104965get namespace ids from NS_ constantscervidae13:20, 2 December 2011
r104983protect help pages by language codecervidae18:04, 2 December 2011

Status & tagging log