r75295 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75294‎ | r75295 | r75296 >
Date:22:17, 23 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Rewrote comparator handling and added strictly strict comparators :)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -410,31 +410,7 @@
411411
412412 if ( count( $list ) == 3 ) { // Initial comparator found ($list[0] should be empty).
413413 $value = $list[2];
414 -
415 - switch ( $list[1] ) {
416 - case '<':
417 - $comparator = $smwStrictComparators ? SMW_CMP_LESS : SMW_CMP_LEQ;
418 - break;
419 - case '>':
420 - $comparator = $smwStrictComparators ? SMW_CMP_GRTR : SMW_CMP_GEQ;
421 - break;
422 - case '!':
423 - $comparator = SMW_CMP_NEQ;
424 - break;
425 - case '~':
426 - $comparator = SMW_CMP_LIKE;
427 - break;
428 - case '!~':
429 - $comparator = SMW_CMP_NLKE;
430 - break;
431 - case '≥' :
432 - $comparator = SMW_CMP_GEQ;
433 - break;
434 - case '≤' :
435 - $comparator = SMW_CMP_LEQ;
436 - break;
437 - // default: not possible
438 - }
 414+ $comparator = SMWQueryLanguage::getComparatorFromString( $list[1], SMW_CMP_EQ );
439415 }
440416 }
441417
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php
@@ -70,6 +70,7 @@
7171 // $wgAutoloadClasses['SMWTypePage'] = $smwgIP . 'includes/articlepages/SMW_TypePage.php';
7272 $wgAutoloadClasses['SMWPropertyPage'] = $smwgIP . 'includes/articlepages/SMW_PropertyPage.php';
7373 // $wgAutoloadClasses['SMWConceptPage'] = $smwgIP . 'includes/articlepages/SMW_ConceptPage.php';
 74+ $wgAutoloadClasses['SMWQueryLanguage'] = $smwgIP . 'includes/SMW_QueryLanguage.php';
7475
7576 // Datavalues
7677 $dvDir = $smwgIP . 'includes/datavalues/';
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
@@ -386,20 +386,7 @@
387387
388388 public function getQueryString( $asvalue = false ) {
389389 if ( $this->m_datavalue !== null ) {
390 - global $smwStrictComparators;
391 -
392 - switch ( $this->m_comparator ) {
393 - case SMW_CMP_LEQ: $comparator = $smwStrictComparators ? '<=' : '<'; break;
394 - case SMW_CMP_GEQ: $comparator = $smwStrictComparators ? '>=' : '>'; break;
395 - case SMW_CMP_NEQ: $comparator = '!'; break;
396 - case SMW_CMP_LIKE: $comparator = '~'; break;
397 - case SMW_CMP_NLKE: $comparator = '!~'; break;
398 - case SMW_CMP_LESS: $comparator = '<'; break;
399 - case SMW_CMP_GRTR: $comparator = '>'; break;
400 - default: case SMW_CMP_EQ:
401 - $comparator = '';
402 - break;
403 - }
 390+ $comparator = SMWQueryLanguage::getStringForComparator( $this->m_comparator );
404391
405392 if ( $asvalue ) {
406393 return $comparator . $this->m_datavalue->getWikiValue();
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -78,6 +78,7 @@
7979 $wgAutoloadClasses['SMWResultPrinter'] = $smwgIP . 'includes/SMW_QueryPrinter.php';
8080 $wgAutoloadClasses['SMWDataValueFactory'] = $smwgIP . 'includes/SMW_DataValueFactory.php';
8181 $wgAutoloadClasses['SMWDataValue'] = $smwgIP . 'includes/SMW_DataValue.php';
 82+ $wgAutoloadClasses['SMWQueryLanguage'] = $smwgIP . 'includes/SMW_QueryLanguage.php';
8283
8384 // Article pages
8485 $apDir = $smwgIP . 'includes/articlepages/';

Follow-up revisions

RevisionCommit summaryAuthorDate
r75296Follow up to r75295 - forgot to svn add this classjeroendedauw22:17, 23 October 2010
r75306follow up to r75295jeroendedauw13:27, 24 October 2010

Status & tagging log