r104965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104964‎ | r104965 | r104966 >
Date:13:20, 2 December 2011
Author:cervidae
Status:resolved (Comments)
Tags:
Comment:
get namespace ids from NS_ constants
Modified paths:
  • /trunk/extensions/HelpCommons/HelpCommons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HelpCommons/HelpCommons.php
@@ -60,7 +60,7 @@
6161 $page = $dbr->select(
6262 'page',
6363 array( 'page_title', 'page_namespace', 'page_latest' ),
64 - array( 'page_namespace' => 12, 'page_title' => $title ),
 64+ array( 'page_namespace' => constant( 'NS_HELP' ), 'page_title' => $title ),
6565 __METHOD__
6666 );
6767 $page = $dbr->fetchObject( $page );
@@ -114,7 +114,7 @@
115115 $page = $dbr->select(
116116 'page',
117117 array( 'page_title', 'page_namespace', 'page_latest' ),
118 - array( 'page_namespace' => 12, 'page_title' => $title ),
 118+ array( 'page_namespace' => constant( 'NS_HELP' ), 'page_title' => $title ),
119119 __METHOD__
120120 );
121121 $page = $dbr->fetchObject( $page );
@@ -218,7 +218,7 @@
219219 $res = $dbr->select(
220220 'page',
221221 array( 'page_title', 'page_namespace', 'page_latest' ),
222 - array( 'page_namespace' => 12, 'page_title' => str_replace( ' ', '_', $title->getText() ) ),
 222+ array( 'page_namespace' => constant( '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 == 12 || $ns == 13 ) {
 233+ if( $ns == constant( 'NS_HELP' ) || $ns == constant( 'NS_HELP_TALK' ) ) {
234234 // error message if action is blocked
235235 $result = array( 'protectedpagetext' );
236236

Follow-up revisions

RevisionCommit summaryAuthorDate
r105126using constant without function, per Nikerabbit, r104965cervidae20:19, 4 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104683select instead of querycervidae14:48, 30 November 2011

Comments

#Comment by Nikerabbit (talk | contribs)   18:42, 3 December 2011

You don't need a function to use a constant, just type NS_HELP without quotes.

#Comment by SVG (talk | contribs)   20:20, 4 December 2011

Changed in r105126. Thanks!

#Comment by Hashar (talk | contribs)   13:54, 6 December 2011

Since this revision was changed in followup, I am marking it as 'resolved'. Well done !

Status & tagging log