r91708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91707‎ | r91708 | r91709 >
Date:02:37, 8 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for new SMWDIWikiPage::getSubobjectName() method in SMW 1.6
Modified paths:
  • /trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php
@@ -152,7 +152,12 @@
153153 * internal object into the database.
154154 */
155155 function getStorageSQL( $internalObject ) {
156 - $ioID = $this->makeSMWPageID( $internalObject->getName(), $internalObject->getNamespace(), '' );
 156+ if ( method_exists( 'SMWDIWikiPage', 'getSubobjectName' ) ) {
 157+ // SMW 1.6
 158+ $ioID = $this->makeSMWPageID( $internalObject->getName(), $internalObject->getNamespace(), '', '' );
 159+ } else {
 160+ $ioID = $this->makeSMWPageID( $internalObject->getName(), $internalObject->getNamespace(), '' );
 161+ }
157162 $upRels2 = array();
158163 $upAtts2 = array();
159164 $upText2 = array();
@@ -168,10 +173,16 @@
169174 $isCoords = ( $tableid == 'smw_coords' );
170175
171176 if ( $isRelation ) {
 177+ if ( method_exists( 'SMWDIWikiPage', 'getSubobjectName' ) ) {
 178+ // SMW 1.6
 179+ $mainPageID = $this->makeSMWPageID( $value->getDBkey(), $value->getNamespace(), $value->getInterwiki(), '' );
 180+ } else {
 181+ $mainPageID = $this->makeSMWPageID( $value->getDBkey(), $value->getNamespace(), $value->getInterwiki() );
 182+ }
172183 $upRels2[] = array(
173184 's_id' => $ioID,
174185 'p_id' => $this->makeSMWPropertyID( $property ),
175 - 'o_id' => $this->makeSMWPageID( $value->getDBkey(), $value->getNamespace(), $value->getInterwiki() )
 186+ 'o_id' => $mainPageID
176187 );
177188 } elseif ( $isAttribute ) {
178189 if ( class_exists( 'SMWCompatibilityHelpers' ) ) {