r55884 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55883‎ | r55884 | r55885 >
Date:15:42, 6 September 2009
Author:mkroetzsch
Status:deferred
Tags:
Comment:
removed support for *-style printout directives in <ask> queries (a long obsolete SMW beta version feature)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -611,7 +611,6 @@
612612 * suitable description.
613613 */
614614 protected function getClassDescription(&$setNS, &$label, $category=true) {
615 - global $smwgSMWBetaCompatible; // * printouts only for this old version
616615 // note: no subqueries allowed here, inline disjunction allowed, wildcards allowed
617616 $result = NULL;
618617 $continue = true;
@@ -619,26 +618,6 @@
620619 $chunk = $this->readChunk();
621620 if ($chunk == '+') {
622621 //wildcard, ignore for categories (semantically meaningless, everything is in some class)
623 - } elseif ( ($chunk == '+') && $category && $smwgSMWBetaCompatible) { // print statement
624 - $chunk = $this->readChunk('\]\]|\|');
625 - if ($chunk == '|') {
626 - $printlabel = $this->readChunk('\]\]');
627 - if ($printlabel != ']]') {
628 - $chunk = $this->readChunk('\]\]');
629 - } else {
630 - $printlabel = '';
631 - $chunk = ']]';
632 - }
633 - } else {
634 - global $wgContLang;
635 - $printlabel = $wgContLang->getNSText(NS_CATEGORY);
636 - }
637 - if ($chunk == ']]') {
638 - return new SMWPrintRequest(SMWPrintRequest::PRINT_CATS, $printlabel);
639 - } else {
640 - $this->m_errors[] = wfMsgForContent('smw_badprintout');
641 - return NULL;
642 - }
643622 } else { //assume category/concept title
644623 /// NOTE: use m_c...prefix to prevent problems with, e.g., [[Category:Template:Test]]
645624 $class = Title::newFromText(($category?$this->m_categoryprefix:$this->m_conceptprefix) . $chunk);
@@ -661,7 +640,6 @@
662641 * string.
663642 */
664643 protected function getPropertyDescription($propertyname, &$setNS, &$label) {
665 - global $smwgSMWBetaCompatible; // support for old * printouts of beta
666644 wfLoadExtensionMessages('SemanticMediaWiki');
667645 $this->readChunk(); // consume separator ":=" or "::"
668646 // first process property chain syntax (e.g. "property1.property2::value"):
@@ -772,34 +750,14 @@
773751 $comparator = SMW_CMP_EQ;
774752 $printmodifier = '';
775753 SMWQueryParser::prepareValue($value, $comparator, $printmodifier);
776 - if ( ($value == '*') && $smwgSMWBetaCompatible ) {
777 - if ($chunk == '|') {
778 - $printlabel = $this->readChunk('\]\]');
779 - if ($printlabel != ']]') {
780 - $chunk = $this->readChunk('\]\]');
781 - } else {
782 - $printlabel = '';
783 - $chunk = ']]';
784 - }
785 - } else {
786 - $printlabel = $property->getWikiValue();
787 - }
788 - if ($chunk == ']]') {
789 - return new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $printlabel, $property, $printmodifier);
790 - } else {
791 - $this->m_errors[] = wfMsgForContent('smw_badprintout');
792 - return NULL;
793 - }
 754+ $dv = SMWDataValueFactory::newPropertyObjectValue($property, $value);
 755+ if (!$dv->isValid()) {
 756+ $this->m_errors = $this->m_errors + $dv->getErrors();
 757+ $vd = new SMWThingDescription();
794758 } else {
795 - $dv = SMWDataValueFactory::newPropertyObjectValue($property, $value);
796 - if (!$dv->isValid()) {
797 - $this->m_errors = $this->m_errors + $dv->getErrors();
798 - $vd = new SMWThingDescription();
799 - } else {
800 - $vd = new SMWValueDescription($dv, $comparator);
801 - }
802 - $innerdesc = $this->addDescription($innerdesc, $vd, false);
 759+ $vd = new SMWValueDescription($dv, $comparator);
803760 }
 761+ $innerdesc = $this->addDescription($innerdesc, $vd, false);
804762 }
805763 }
806764 $continue = ($chunk == '||');
@@ -828,20 +786,7 @@
829787 * effective value string, or of "*" for print statements.
830788 */
831789 static public function prepareValue(&$value, &$comparator, &$printmodifier) {
832 - global $smwgQComparators, $smwgSMWBetaCompatible; // support for old * printouts of beta
833 - // get print modifier behind *
834 - if ($smwgSMWBetaCompatible) {
835 - $list = preg_split('/^\*/',$value,2);
836 - if (count($list) == 2) { //hit
837 - $value = '*';
838 - $printmodifier = $list[1];
839 - } else {
840 - $printmodifier = '';
841 - }
842 - if ($value == '*') { // printout statement
843 - return;
844 - }
845 - }
 790+ global $smwgQComparators;
846791 $list = preg_split('/^(' . $smwgQComparators . ')/u',$value, 2, PREG_SPLIT_DELIM_CAPTURE);
847792 $comparator = SMW_CMP_EQ;
848793 if (count($list) == 3) { // initial comparator found ($list[1] should be empty)
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php
@@ -36,26 +36,6 @@
3737 require_once('SMW_GlobalFunctions.php');
3838
3939 ###
40 -# SMW has changed a lot since version 0.1 and some additional settings are
41 -# needed to preserve old functions on sites that have been using beta versions
42 -# of SMW (any version prior to 1.0). Sites still using obsolete SMW beta
43 -# features should set the following to "true". All others can safely keep the
44 -# default here.
45 -#
46 -# Setting this option to true has the following effect:
47 -# * The obsolete namespace "Relation" will still be created (maybe some sites
48 -# have content there).
49 -# * Statements like [[property::*]] in queries will be interpreted as printout
50 -# statements (like ?property in the current #ask query syntax).
51 -# This option must be set before including this file, or otherwise the old
52 -# Relation namespaces will not be available.
53 -##
54 -if (!isset($smwgSMWBetaCompatible)) {
55 - $smwgSMWBetaCompatible = false;
56 -}
57 -##
58 -
59 -###
6040 # If you already have custom namespaces on your site, insert
6141 # $smwgNamespaceIndex = ???;
6242 # into your LocalSettings.php *before* including this file. The number ??? must

Follow-up revisions

RevisionCommit summaryAuthorDate
r56022Follow-up to r55884 - update call in SpecialResetpasshappy-melon10:08, 8 September 2009

Status & tagging log