https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102360

Revision: 102360
Author:   jeroendedauw
Date:     2011-11-08 01:18:59 +0000 (Tue, 08 Nov 2011)
Log Message:
-----------
some fixes

Modified Paths:
--------------
    trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php
    trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php
    trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php

Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php       
2011-11-08 01:09:27 UTC (rev 102359)
+++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php       
2011-11-08 01:18:59 UTC (rev 102360)
@@ -149,8 +149,7 @@
         * @todo FIXME: Some job generations here might create too many jobs at 
once on a large wiki. Use incremental jobs instead.
         */
        static public function storeData( $parseroutput, Title $title, 
$makejobs = true ) {
-               global $smwgEnableUpdateJobs, $smwgDeclarationProperties,
-                       $smwgContLang, $smwgPageSpecialProperties;
+               global $smwgEnableUpdateJobs, $smwgDeclarationProperties, 
$smwgContLang, $smwgPageSpecialProperties;
 
                $semdata = $parseroutput->mSMWData;
                $namespace = $title->getNamespace();
@@ -166,35 +165,42 @@
                                // Property name in 
`$smwgPageSpecialProperties' may be localized.
                                // Get property id to work with.
                                $propId = $smwgContLang->getPropertyId( 
$propName );
+                               
                                if ( is_null( $propId ) ) {
-                                       continue;    // Issue error?
+                                       continue;
                                }
-                               if ( isset( $props[$propId] ) ) {    // Do not 
calculate the same property again.
-                                       continue;    // Issue warning?
+                               
+                               // Do not calculate the same property again.
+                               if ( array_key_exists( $propId, $props ) ) {
+                                       continue;
                                }
-                               $props[ $propId ] = true;              // 
Remember the property is processed.
+                               
+                               // Remember the property is processed.
+                               $props[ $propId ] = true;              
                                $prop = new SMWDIProperty( $propId );
+                               
                                if ( count( $semdata->getPropertyValues( $prop 
) ) > 0  ) {
                                        continue;
                                }
+                               
                                // Calculate property value.
                                $datum = null;
+                               
                                switch ( $propId ) {
-                                       case '_MDAT' : {
+                                       case '_MDAT' :
                                                $timestamp =  
Revision::getTimeStampFromID( $title, $title->getLatestRevID() );
                                                $datum = 
self::getDataItemFromMWTimestamp( $timestamp );
-                                       } break;
-                                       case '_CDAT' : {
+                                               break;
+                                       case '_CDAT' :
                                                $timestamp = 
$title->getFirstRevision()->getTimestamp();
                                                $datum = 
self::getDataItemFromMWTimestamp( $timestamp );
-                                       } break;
+                                               break;
                                }
                                
-                               if ( is_null( $datum ) ) {
-                                       continue;    // Issue error or warning?
-                               }
+                               if ( !is_null( $datum ) ) {
+                                       $semdata->addPropertyObjectValue( 
$prop, $datum );    
+                               } // Issue error or warning?
                                
-                               $semdata->addPropertyObjectValue( $prop, $datum 
);
                        } // foreach
                } else { // data found, but do all operations as if it was empty
                        $semdata = new SMWSemanticData( $semdata->getSubject() 
);

Modified: 
trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php     
2011-11-08 01:09:27 UTC (rev 102359)
+++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php     
2011-11-08 01:18:59 UTC (rev 102360)
@@ -124,7 +124,7 @@
        }
 
        public function getLongHTMLText( $linker = null ) {
-               if ( is_null( $linked ) || ( $linker === false ) ) {
+               if ( is_null( $linker ) || ( $linker === false ) ) {
                        return htmlspecialchars( $this->m_realLabel );
                } else {
                        $title = Title::makeTitle( NS_SPECIAL, 
$this->getSpecialPageTitleText() );

Modified: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php       
2011-11-08 01:09:27 UTC (rev 102359)
+++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php       
2011-11-08 01:18:59 UTC (rev 102360)
@@ -190,7 +190,7 @@
 
        public function getShortHTMLText( $linker = null ) {
                $url = $this->getURL();
-               if ( is_null( $linked ) || ( !$this->isValid() ) || ( 
$this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) 
{
+               if ( is_null( $linker ) || ( !$this->isValid() ) || ( 
$this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) 
{
                        return $this->m_caption;
                } else {
                        return $linker->makeExternalLink( $url, 
$this->m_caption );
@@ -202,6 +202,7 @@
                        return $this->getErrorText();
                }
                $url = $this->getURL();
+               
                if ( is_null( $linked ) || ( $linked === false ) || ( 
$this->m_outformat == '-' ) || ( $url === '' ) ) {
                        return $this->m_wikitext;
                } else {
@@ -213,8 +214,10 @@
                if ( !$this->isValid() ) {
                        return $this->getErrorText();
                }
+               
                $url = $this->getURL();
-               if ( is_null( $linked ) || ( $this->m_outformat == '-' ) || ( 
$url === '' ) ) {
+               
+               if ( is_null( $linker ) || ( $this->m_outformat == '-' ) || ( 
$url === '' ) ) {
                        return htmlspecialchars( $this->m_wikitext );
                } else {
                        return $linker->makeExternalLink( $url, 
$this->m_wikitext );


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to