Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStubSemanticData.php |
— | — | @@ -39,6 +39,26 @@ |
40 | 40 | protected $mSubject; |
41 | 41 | |
42 | 42 | /** |
| 43 | + * Create a new SMWSqlStubSemanticData object that holds the data of a |
| 44 | + * given SMWSemanticData object. Array assignments create copies in PHP |
| 45 | + * so the arrays are distinct in input and output object. The object |
| 46 | + * references are copied as references in a shallow way. This is |
| 47 | + * sufficient as the data items used there are immutable. |
| 48 | + * |
| 49 | + * @param $semanticData SMWSemanticData |
| 50 | + * @return SMWSqlStubSemanticData |
| 51 | + */ |
| 52 | + public static function newFromSemanticData( SMWSemanticData $semanticData ) { |
| 53 | + $result = new SMWSqlStubSemanticData( $semanticData->getSubject() ); |
| 54 | + $result->mPropVals = $semanticData->mPropVals; |
| 55 | + $result->mProperties = $semanticData->mProperties; |
| 56 | + $result->mHasVisibleProps = $semanticData->mHasVisibleProps; |
| 57 | + $result->mHasVisibleSpecs = $semanticData->mHasVisibleSpecs; |
| 58 | + $result->stubObject = $semanticData->stubObject; |
| 59 | + return $result; |
| 60 | + } |
| 61 | + |
| 62 | + /** |
43 | 63 | * Get the array of all properties that have stored values. |
44 | 64 | * |
45 | 65 | * @return array of SMWDIProperty objects |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -165,7 +165,9 @@ |
166 | 166 | if ( !array_key_exists( $sid, $this->m_semdata ) ) { // new cache entry |
167 | 167 | $this->m_semdata[$sid] = new SMWSqlStubSemanticData( $subject, false ); |
168 | 168 | $this->m_semdata[$sid]->addPropertyStubValue( '_SKEY', array( $sortkey ) ); |
169 | | - $this->m_sdstate[$sid] = array( '__key' ); |
| 169 | + $this->m_sdstate[$sid] = array(); |
| 170 | + // Note: the sortkey is always set but belongs to no property table, |
| 171 | + // hence no entry in $this->m_sdstate[$sid] is made. |
170 | 172 | } |
171 | 173 | |
172 | 174 | if ( ( count( $this->m_semdata ) > 20 ) && ( self::$in_getSemanticData == 1 ) ) { |
— | — | @@ -809,9 +811,12 @@ |
810 | 812 | } |
811 | 813 | |
812 | 814 | // Finally update caches (may be important if jobs are directly following this call) |
813 | | - $this->m_semdata[$sid] = clone $data; |
| 815 | + $this->m_semdata[$sid] = SMWSqlStubSemanticData::newFromSemanticData( $data ); |
814 | 816 | // Everything that one can know. |
815 | | - $this->m_sdstate[$sid] = array_keys( self::getPropertyTables() ); |
| 817 | + $this->m_sdstate[$sid] = array(); |
| 818 | + foreach ( self::getPropertyTables() as $tableId => $tableDeclaration ) { |
| 819 | + $this->m_sdstate[$sid][$tableId] = true; |
| 820 | + } |
816 | 821 | |
817 | 822 | wfRunHooks( 'SMWSQLStore2::updateDataAfter', array( $this, $data ) ); |
818 | 823 | |