r93880 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93879‎ | r93880 | r93881 >
Date:12:31, 4 August 2011
Author:yaron
Status:deferred
Tags:
Comment:
Added support for SMW 1.6 if $sfgRedLinksCheckOnlyLocalProps = true
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormLinker.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormLinker.php
@@ -64,13 +64,24 @@
6565 return;
6666 }
6767 $store = smwfGetStore();
68 - $data = $store->getSemanticData( $title );
 68+ if ( class_exists( 'SMWDataItem' ) ) {
 69+ $value = SMWDIWikiPage::newFromTitle( $title );
 70+ } else {
 71+ $value = $title;
 72+ }
 73+ $data = $store->getSemanticData( $value );
6974 foreach ( $data->getProperties() as $property ) {
7075 $propertyValues = $data->getPropertyValues( $property );
7176 foreach ( $propertyValues as $propertyValue ) {
72 - if ( $propertyValue instanceof SMWWikiPageValue ) {
 77+ $linkedPageName = null;
 78+ if ( $propertyValue instanceof SMWDIWikiPage ) {
 79+ $propertyName = $property->getKey();
 80+ $linkedPageName = $propertyValue->getDBkey();
 81+ } elseif ( $propertyValue instanceof SMWWikiPageValue ) {
7382 $propertyName = $property->getWikiValue();
7483 $linkedPageName = $propertyValue->getWikiValue();
 84+ }
 85+ if ( !is_null( $linkedPageName ) ) {
7586 if ( array_key_exists( $linkedPageName, self::$mLinkedPages ) ) {
7687 self::$mLinkedPages[$linkedPageName][] = $propertyName;
7788 } else {
@@ -256,7 +267,13 @@
257268 if ( in_array( 'broken', $options ) ) {
258269 global $sfgRedLinksCheckOnlyLocalProps;
259270 if ( $sfgRedLinksCheckOnlyLocalProps ) {
260 - self::getPagePropertiesOfPage( $linker->getTitle() );
 271+ if ( $linker instanceof DummyLinker ) {
 272+ global $wgTitle;
 273+ $curTitle = $wgTitle;
 274+ } else {
 275+ $curTitle = $linker->getTitle();
 276+ }
 277+ self::getPagePropertiesOfPage( $curTitle );
261278 $targetName = $target->getText();
262279 if ( array_key_exists( $targetName, self::$mLinkedPages ) ) {
263280 $incoming_properties = self::$mLinkedPages[$targetName];

Follow-up revisions

RevisionCommit summaryAuthorDate
r99388Fix for r93880 - added fix for the case where $wgTitle has not been setyaron03:53, 10 October 2011
r114499Fix for r93880 - added initialization of $propertyNameyaron21:48, 26 March 2012