Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php |
— | — | @@ -794,4 +794,4 @@ |
795 | 795 | return ''; // empty unit |
796 | 796 | } |
797 | 797 | |
798 | | -} |
| 798 | +} |
\ No newline at end of file |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -1917,9 +1917,12 @@ |
1918 | 1918 | $id = 0; |
1919 | 1919 | |
1920 | 1920 | if ( $iw != '' ) { // external page; no need to think about redirects |
1921 | | - $res = $db->select( 'smw_ids', array( 'smw_id', 'smw_sortkey' ), |
1922 | | - array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw ), |
1923 | | - 'SMW::getSMWPageID', array( 'LIMIT' => 1 ) ); |
| 1921 | + $res = $db->select( |
| 1922 | + 'smw_ids', |
| 1923 | + array( 'smw_id', 'smw_sortkey' ), |
| 1924 | + array( 'smw_title' => $title, 'smw_namespace' => $namespace, 'smw_iw' => $iw ), |
| 1925 | + 'SMW::getSMWPageID', array( 'LIMIT' => 1 ) |
| 1926 | + ); |
1924 | 1927 | |
1925 | 1928 | if ( $row = $db->fetchObject( $res ) ) { |
1926 | 1929 | $id = $row->smw_id; |
— | — | @@ -1988,15 +1991,21 @@ |
1989 | 1992 | $db = wfGetDB( DB_MASTER ); |
1990 | 1993 | $sortkey = $sortkey ? $sortkey:( str_replace( '_', ' ', $title ) ); |
1991 | 1994 | |
1992 | | - $db->insert( 'smw_ids', |
1993 | | - array( 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ), |
1994 | | - 'smw_title' => $title, |
1995 | | - 'smw_namespace' => $namespace, |
1996 | | - 'smw_iw' => $iw, |
1997 | | - 'smw_sortkey' => $sortkey ), 'SMW::makeSMWPageID' ); |
| 1995 | + $db->insert( |
| 1996 | + 'smw_ids', |
| 1997 | + array( |
| 1998 | + 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ), |
| 1999 | + 'smw_title' => $title, |
| 2000 | + 'smw_namespace' => $namespace, |
| 2001 | + 'smw_iw' => $iw, |
| 2002 | + 'smw_sortkey' => $sortkey |
| 2003 | + ), |
| 2004 | + 'SMW::makeSMWPageID' |
| 2005 | + ); |
1998 | 2006 | |
1999 | 2007 | $id = $db->insertId(); |
2000 | 2008 | $this->m_ids["$iw $namespace $title -"] = $id; // fill that cache, even if canonical was given |
| 2009 | + |
2001 | 2010 | // This ID is also authorative for the canonical version. |
2002 | 2011 | // This is always the case: if $canonical===false and $id===0, then there is no redi-entry in |
2003 | 2012 | // smw_ids either, hence the object just did not exist at all. |
— | — | @@ -2086,8 +2095,17 @@ |
2087 | 2096 | $db = wfGetDB( DB_MASTER ); |
2088 | 2097 | |
2089 | 2098 | // check if there is an unused bnode to take: |
2090 | | - $res = $db->select( 'smw_ids', 'smw_id', array( 'smw_title' => '', 'smw_namespace' => 0, 'smw_iw' => SMW_SQL2_SMWIW ), |
2091 | | - 'SMW::makeSMWBnodeID', array( 'LIMIT' => 1 ) ); |
| 2099 | + $res = $db->select( |
| 2100 | + 'smw_ids', |
| 2101 | + 'smw_id', |
| 2102 | + array( |
| 2103 | + 'smw_title' => '', |
| 2104 | + 'smw_namespace' => 0, |
| 2105 | + 'smw_iw' => SMW_SQL2_SMWIW |
| 2106 | + ), |
| 2107 | + 'SMW::makeSMWBnodeID', |
| 2108 | + array( 'LIMIT' => 1 ) |
| 2109 | + ); |
2092 | 2110 | |
2093 | 2111 | $id = ( $row = $db->fetchObject( $res ) ) ? $row->smw_id:0; |
2094 | 2112 | $db->freeResult( $res ); |
— | — | @@ -2130,26 +2148,39 @@ |
2131 | 2149 | */ |
2132 | 2150 | protected function moveSMWPageID( $curid, $targetid = 0 ) { |
2133 | 2151 | $db = wfGetDB( DB_MASTER ); |
2134 | | - $row = $db->selectRow( 'smw_ids', |
2135 | | - array( 'smw_id', 'smw_namespace', 'smw_title', 'smw_iw', 'smw_sortkey' ), |
2136 | | - array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID' ); |
| 2152 | + |
| 2153 | + $row = $db->selectRow( |
| 2154 | + 'smw_ids', |
| 2155 | + array( 'smw_id', 'smw_namespace', 'smw_title', 'smw_iw', 'smw_sortkey' ), |
| 2156 | + array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID' |
| 2157 | + ); |
2137 | 2158 | |
2138 | 2159 | if ( $row === false ) return; // no id at current position, ignore |
2139 | 2160 | |
2140 | 2161 | if ( $targetid == 0 ) { // append new id |
2141 | | - $db->insert( 'smw_ids', array( 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ), |
2142 | | - 'smw_title' => $row->smw_title, |
2143 | | - 'smw_namespace' => $row->smw_namespace, |
2144 | | - 'smw_iw' => $row->smw_iw, |
2145 | | - 'smw_sortkey' => $row->smw_sortkey ), 'SMW::moveSMWPageID' ); |
| 2162 | + $db->insert( |
| 2163 | + 'smw_ids', |
| 2164 | + array( |
| 2165 | + 'smw_id' => $db->nextSequenceValue( 'smw_ids_smw_id_seq' ), |
| 2166 | + 'smw_title' => $row->smw_title, |
| 2167 | + 'smw_namespace' => $row->smw_namespace, |
| 2168 | + 'smw_iw' => $row->smw_iw, |
| 2169 | + 'smw_sortkey' => $row->smw_sortkey |
| 2170 | + ), |
| 2171 | + 'SMW::moveSMWPageID' |
| 2172 | + ); |
2146 | 2173 | |
2147 | 2174 | $targetid = $db->insertId(); |
2148 | 2175 | } else { // change to given id |
2149 | | - $db->insert( 'smw_ids', array( 'smw_id' => $targetid, |
2150 | | - 'smw_title' => $row->smw_title, |
2151 | | - 'smw_namespace' => $row->smw_namespace, |
2152 | | - 'smw_iw' => $row->smw_iw, |
2153 | | - 'smw_sortkey' => $row->smw_sortkey ), 'SMW::moveSMWPageID' ); |
| 2176 | + $db->insert( 'smw_ids', |
| 2177 | + array( 'smw_id' => $targetid, |
| 2178 | + 'smw_title' => $row->smw_title, |
| 2179 | + 'smw_namespace' => $row->smw_namespace, |
| 2180 | + 'smw_iw' => $row->smw_iw, |
| 2181 | + 'smw_sortkey' => $row->smw_sortkey |
| 2182 | + ), |
| 2183 | + 'SMW::moveSMWPageID' |
| 2184 | + ); |
2154 | 2185 | } |
2155 | 2186 | |
2156 | 2187 | $db->delete( 'smw_ids', array( 'smw_id' => $curid ), 'SMWSQLStore2::moveSMWPageID' ); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php |
— | — | @@ -345,4 +345,4 @@ |
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | | -} |
| 349 | +} |
\ No newline at end of file |