r72999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72998‎ | r72999 | r73000 >
Date:17:53, 14 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Minor improvements
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -31,6 +31,8 @@
3232 * The format string is used to specify the output format if already
3333 * known. Otherwise it will be determined from the parameters when
3434 * needed. This parameter is just for optimisation in a common case.
 35+ *
 36+ * @return SMWQuery
3537 */
3638 static public function createQuery( $querystring, array $params, $context = SMWQueryProcessor::INLINE_QUERY, $format = '', $extraprintouts = array() ) {
3739 global $smwgQDefaultNamespaces, $smwgQFeatures, $smwgQConceptFeatures;
@@ -263,12 +265,13 @@
264266 $format = SMWQueryProcessor::getResultFormat( $params );
265267 $query = SMWQueryProcessor::createQuery( $querystring, $params, $context, $format, $extraprintouts );
266268 $result = SMWQueryProcessor::getResultFromQuery( $query, $params, $extraprintouts, $outputmode, $context, $format );
 269+
267270 wfProfileOut( 'SMWQueryProcessor::getResultFromQueryString (SMW)' );
268271
269272 return $result;
270273 }
271274
272 - static public function getResultFromQuery( $query, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '' ) {
 275+ static public function getResultFromQuery( SMWQuery $query, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '' ) {
273276 wfProfileIn( 'SMWQueryProcessor::getResultFromQuery (SMW)' );
274277
275278 // Query routing allows extensions to provide alternative stores as data sources
@@ -276,8 +279,8 @@
277280 ///TODO: case-insensitive
278281 global $smwgQuerySources;
279282
280 - if ( array_key_exists( "source", $params ) && array_key_exists( $params["source"], $smwgQuerySources ) ) {
281 - $store = new $smwgQuerySources[$params["source"]]();
 283+ if ( array_key_exists( 'source', $params ) && array_key_exists( $params['source'], $smwgQuerySources ) ) {
 284+ $store = new $smwgQuerySources[$params['source']]();
282285 $query->params = $params; // this is a hack
283286 } else {
284287 $store = smwfGetStore(); // default store
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php
@@ -185,7 +185,7 @@
186186 * called during SMW initialisation. Note that parser hooks are something different
187187 * than MW hooks in general, which explains the two-level registration.
188188 */
189 - public static function registerParserFunctions( &$parser ) {
 189+ public static function registerParserFunctions( Parser &$parser ) {
190190 $parser->setFunctionHook( 'ask', array( 'SMWParserExtensions', 'doAsk' ) );
191191 $parser->setFunctionHook( 'show', array( 'SMWParserExtensions', 'doShow' ) );
192192 $parser->setFunctionHook( 'info', array( 'SMWParserExtensions', 'doInfo' ) );

Status & tagging log