r82636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82635‎ | r82636 | r82637 >
Date:22:30, 22 February 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php
@@ -32,8 +32,18 @@
3333 $rep = new TypesPage();
3434
3535 list( $limit, $offset ) = wfCheckLimits();
36 - $rep->doQuery( $offset, $limit );
3736
 37+ // When the QueryPage class was changed in r78786, the order of these
 38+ // parameters was conveniently swapped around. Brilliant for introducing
 39+ // subtle bugs; we ought to do it more!
 40+ if ( method_exists( 'QueryPage', 'getQueryInfo' ) ) {
 41+ $rep->doQuery( $limit, $offset );
 42+ $rep->execute( array() );
 43+ }
 44+ else {
 45+ $rep->doQuery( $offset, $limit );
 46+ }
 47+
3848 // Ensure locally collected output data is pushed to the output!
3949 SMWOutputs::commitToOutputPage( $wgOut );
4050
@@ -44,8 +54,12 @@
4555
4656 class TypesPage extends QueryPage {
4757
 58+ public function __construct( $name = 'Types' ) {
 59+ parent::__construct( $name );
 60+ }
 61+
4862 function getName() {
49 - return "Types";
 63+ return 'Types';
5064 }
5165
5266 function isExpensive() {
@@ -57,7 +71,7 @@
5872 }
5973
6074 function getPageHeader() {
61 - return '<p>' . wfMsg( 'smw_types_docu' ) . "</p><br />\n";
 75+ return '<p>' . htmlspecialchars( wfMsg( 'smw_types_docu' ) ) . "</p><br />\n";
6276 }
6377
6478 /* Failed attempt to fix https://bugzilla.wikimedia.org/show_bug.cgi?id=27440

Follow-up revisions

RevisionCommit summaryAuthorDate
r82641Followup r78786, per complaints on r82636, revert parameter ordering...reedy23:22, 22 February 2011
r82642Partial revert r82636 after fixing swapped parameters in r82641reedy23:26, 22 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82277Failed attempt to fix bug 27440jeroendedauw19:09, 16 February 2011

Comments

#Comment by 😂 (talk | contribs)   22:38, 22 February 2011

You can just use wfMsgHtml() and skip the htmlspecialchars() :)

#Comment by Reedy (talk | contribs)   23:17, 22 February 2011

Interestingly, SemanticForms et al do

		// execute() method added in MW 1.18
		if ( method_exists( $rep, 'execute' ) ) {
			$rep->execute( $query );
		} else {
			return $rep->doQuery( $offset, $limit );
		}

So you're calling the wrong method anyway

Also, Semantic* and ApprovedRevs are the only extensions to make any sort of call (conditional or otherwise) outside of core. Heck, even in core, there is only one call

Status & tagging log