r102360 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102359‎ | r102360 | r102361 >
Date:01:18, 8 November 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
some fixes
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php
@@ -149,8 +149,7 @@
150150 * @todo FIXME: Some job generations here might create too many jobs at once on a large wiki. Use incremental jobs instead.
151151 */
152152 static public function storeData( $parseroutput, Title $title, $makejobs = true ) {
153 - global $smwgEnableUpdateJobs, $smwgDeclarationProperties,
154 - $smwgContLang, $smwgPageSpecialProperties;
 153+ global $smwgEnableUpdateJobs, $smwgDeclarationProperties, $smwgContLang, $smwgPageSpecialProperties;
155154
156155 $semdata = $parseroutput->mSMWData;
157156 $namespace = $title->getNamespace();
@@ -166,35 +165,42 @@
167166 // Property name in `$smwgPageSpecialProperties' may be localized.
168167 // Get property id to work with.
169168 $propId = $smwgContLang->getPropertyId( $propName );
 169+
170170 if ( is_null( $propId ) ) {
171 - continue; // Issue error?
 171+ continue;
172172 }
173 - if ( isset( $props[$propId] ) ) { // Do not calculate the same property again.
174 - continue; // Issue warning?
 173+
 174+ // Do not calculate the same property again.
 175+ if ( array_key_exists( $propId, $props ) ) {
 176+ continue;
175177 }
176 - $props[ $propId ] = true; // Remember the property is processed.
 178+
 179+ // Remember the property is processed.
 180+ $props[ $propId ] = true;
177181 $prop = new SMWDIProperty( $propId );
 182+
178183 if ( count( $semdata->getPropertyValues( $prop ) ) > 0 ) {
179184 continue;
180185 }
 186+
181187 // Calculate property value.
182188 $datum = null;
 189+
183190 switch ( $propId ) {
184 - case '_MDAT' : {
 191+ case '_MDAT' :
185192 $timestamp = Revision::getTimeStampFromID( $title, $title->getLatestRevID() );
186193 $datum = self::getDataItemFromMWTimestamp( $timestamp );
187 - } break;
188 - case '_CDAT' : {
 194+ break;
 195+ case '_CDAT' :
189196 $timestamp = $title->getFirstRevision()->getTimestamp();
190197 $datum = self::getDataItemFromMWTimestamp( $timestamp );
191 - } break;
 198+ break;
192199 }
193200
194 - if ( is_null( $datum ) ) {
195 - continue; // Issue error or warning?
196 - }
 201+ if ( !is_null( $datum ) ) {
 202+ $semdata->addPropertyObjectValue( $prop, $datum );
 203+ } // Issue error or warning?
197204
198 - $semdata->addPropertyObjectValue( $prop, $datum );
199205 } // foreach
200206 } else { // data found, but do all operations as if it was empty
201207 $semdata = new SMWSemanticData( $semdata->getSubject() );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_URI.php
@@ -190,7 +190,7 @@
191191
192192 public function getShortHTMLText( $linker = null ) {
193193 $url = $this->getURL();
194 - if ( is_null( $linked ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) {
 194+ if ( is_null( $linker ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $url === '' ) || ( $this->m_caption === '' ) ) {
195195 return $this->m_caption;
196196 } else {
197197 return $linker->makeExternalLink( $url, $this->m_caption );
@@ -202,6 +202,7 @@
203203 return $this->getErrorText();
204204 }
205205 $url = $this->getURL();
 206+
206207 if ( is_null( $linked ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) {
207208 return $this->m_wikitext;
208209 } else {
@@ -213,8 +214,10 @@
214215 if ( !$this->isValid() ) {
215216 return $this->getErrorText();
216217 }
 218+
217219 $url = $this->getURL();
218 - if ( is_null( $linked ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) {
 220+
 221+ if ( is_null( $linker ) || ( $this->m_outformat == '-' ) || ( $url === '' ) ) {
219222 return htmlspecialchars( $this->m_wikitext );
220223 } else {
221224 return $linker->makeExternalLink( $url, $this->m_wikitext );
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php
@@ -124,7 +124,7 @@
125125 }
126126
127127 public function getLongHTMLText( $linker = null ) {
128 - if ( is_null( $linked ) || ( $linker === false ) ) {
 128+ if ( is_null( $linker ) || ( $linker === false ) ) {
129129 return htmlspecialchars( $this->m_realLabel );
130130 } else {
131131 $title = Title::makeTitle( NS_SPECIAL, $this->getSpecialPageTitleText() );

Status & tagging log