Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | public static $qnum = 0; |
47 | 47 | |
48 | 48 | public function __construct() { |
49 | | - $this->alias = 't' . SMWSQLStore2Query::$qnum++; |
| 49 | + $this->alias = 't' . self::$qnum++; |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | |
192 | 192 | public function getSemanticData( $subject, $filter = false ) { |
193 | 193 | wfProfileIn( "SMWSQLStore2::getSemanticData (SMW)" ); |
194 | | - SMWSQLStore2::$in_getSemanticData++; // do not clear the cache when called recursively |
| 194 | + self::$in_getSemanticData++; // do not clear the cache when called recursively |
195 | 195 | // *** Find out if this subject exists ***// |
196 | 196 | if ( $subject instanceof Title ) { ///TODO: can this still occur? |
197 | 197 | $sid = $this->getSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki() ); |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | } |
207 | 207 | if ( $sid == 0 ) { // no data, safe our time |
208 | 208 | /// NOTE: we consider redirects for getting $sid, so $sid == 0 also means "no redirects" |
209 | | - SMWSQLStore2::$in_getSemanticData--; |
| 209 | + self::$in_getSemanticData--; |
210 | 210 | wfProfileOut( "SMWSQLStore2::getSemanticData (SMW)" ); |
211 | 211 | return isset( $svalue ) ? ( new SMWSemanticData( $svalue ) ):null; |
212 | 212 | } |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | $this->m_semdata[$sid] = new SMWSemanticData( $svalue, false ); |
216 | 216 | $this->m_sdstate[$sid] = array(); |
217 | 217 | } |
218 | | - if ( ( count( $this->m_semdata ) > 20 ) && ( SMWSQLStore2::$in_getSemanticData == 1 ) ) { |
| 218 | + if ( ( count( $this->m_semdata ) > 20 ) && ( self::$in_getSemanticData == 1 ) ) { |
219 | 219 | // prevent memory leak; |
220 | 220 | // It is not so easy to find the sweet spot between cache size and performance gains (both memory and time), |
221 | 221 | // The value of 20 was chosen by profiling runtimes for large inline queries and heavily annotated pages. |
— | — | @@ -222,12 +222,12 @@ |
223 | 223 | $this->m_sdstate = array( $sid => $this->m_sdstate[$sid] ); |
224 | 224 | } |
225 | 225 | // *** Read the data ***// |
226 | | - foreach ( SMWSQLStore2::getPropertyTables() as $tid => $proptable ) { |
| 226 | + foreach ( self::getPropertyTables() as $tid => $proptable ) { |
227 | 227 | if ( array_key_exists( $tid, $this->m_sdstate[$sid] ) ) continue; |
228 | 228 | if ( $filter !== false ) { |
229 | 229 | $relevant = false; |
230 | 230 | foreach ( $filter as $typeid ) { |
231 | | - $relevant = $relevant || SMWSQLStore2::tableFitsType( $tid, $typeid ); |
| 231 | + $relevant = $relevant || self::tableFitsType( $tid, $typeid ); |
232 | 232 | } |
233 | 233 | if ( !$relevant ) continue; |
234 | 234 | } |
— | — | @@ -238,7 +238,7 @@ |
239 | 239 | $this->m_sdstate[$sid][$tid] = true; |
240 | 240 | } |
241 | 241 | |
242 | | - SMWSQLStore2::$in_getSemanticData--; |
| 242 | + self::$in_getSemanticData--; |
243 | 243 | wfProfileOut( "SMWSQLStore2::getSemanticData (SMW)" ); |
244 | 244 | return $this->m_semdata[$sid]; |
245 | 245 | } |
— | — | @@ -272,12 +272,12 @@ |
273 | 273 | } |
274 | 274 | } else { // no subject given, get all values for the given property |
275 | 275 | $pid = $this->getSMWPropertyID( $property ); |
276 | | - $tableid = SMWSQLStore2::findPropertyTableID( $property ); |
| 276 | + $tableid = self::findPropertyTableID( $property ); |
277 | 277 | if ( ( $pid == 0 ) || ( $tableid == '' ) ) { |
278 | 278 | wfProfileOut( "SMWSQLStore2::getPropertyValues (SMW)" ); |
279 | 279 | return array(); |
280 | 280 | } |
281 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
| 281 | + $proptables = self::getPropertyTables(); |
282 | 282 | $data = $this->fetchSemanticData( $pid, $property, $proptables[$tableid], false, $requestoptions ); |
283 | 283 | $result = array(); |
284 | 284 | |
— | — | @@ -474,17 +474,17 @@ |
475 | 475 | // First build $select, $from, and $where for the DB query |
476 | 476 | $select = $where = $from = ''; |
477 | 477 | $pid = $this->getSMWPropertyID( $property ); |
478 | | - $tableid = SMWSQLStore2::findPropertyTableID( $property ); |
| 478 | + $tableid = self::findPropertyTableID( $property ); |
479 | 479 | |
480 | 480 | if ( ( $tableid == '' ) && ( $value !== null ) ) { // maybe a type-polymorphic property like _1; use value to find type |
481 | | - $tableid = SMWSQLStore2::findTypeTableID( $value->getTypeID() ); |
| 481 | + $tableid = self::findTypeTableID( $value->getTypeID() ); |
482 | 482 | } |
483 | 483 | |
484 | 484 | if ( ( $pid == 0 ) || ( $tableid == '' ) || ( ( $value !== null ) && ( !$value->isValid() ) ) ) { |
485 | 485 | return array(); |
486 | 486 | } |
487 | 487 | |
488 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
| 488 | + $proptables = self::getPropertyTables(); |
489 | 489 | $proptable = $proptables[$tableid]; |
490 | 490 | $db = wfGetDB( DB_SLAVE ); |
491 | 491 | |
— | — | @@ -541,13 +541,13 @@ |
542 | 542 | |
543 | 543 | if ( $value instanceof SMWContainerValue ) { // recursive handling of containers |
544 | 544 | $joinfield = "t$tableindex." . reset( array_keys( $proptable->objectfields ) ); // this must be a type 'p' object |
545 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
| 545 | + $proptables = self::getPropertyTables(); |
546 | 546 | |
547 | 547 | foreach ( $value->getData()->getProperties() as $subproperty ) { |
548 | | - $tableid = SMWSQLStore2::findPropertyTableID( $subproperty ); |
| 548 | + $tableid = self::findPropertyTableID( $subproperty ); |
549 | 549 | |
550 | 550 | if ( ( $tableid == '' ) && ( $value !== null ) ) { // maybe a type-polymorphic property like _1; use value to find type |
551 | | - $tableid = SMWSQLStore2::findTypeTableID( reset( $value->getData()->getPropertyValues( $subproperty ) )->getTypeID() ); |
| 551 | + $tableid = self::findTypeTableID( reset( $value->getData()->getPropertyValues( $subproperty ) )->getTypeID() ); |
552 | 552 | } |
553 | 553 | |
554 | 554 | $subproptable = $proptables[$tableid]; |
— | — | @@ -630,7 +630,7 @@ |
631 | 631 | $suboptions = null; |
632 | 632 | } |
633 | 633 | |
634 | | - foreach ( SMWSQLStore2::getPropertyTables() as $tid => $proptable ) { |
| 634 | + foreach ( self::getPropertyTables() as $tid => $proptable ) { |
635 | 635 | $from = $db->tableName( $proptable->name ); |
636 | 636 | |
637 | 637 | if ( $proptable->idsubject ) { |
— | — | @@ -696,7 +696,7 @@ |
697 | 697 | $suboptions = null; |
698 | 698 | } |
699 | 699 | |
700 | | - foreach ( SMWSQLStore2::getPropertyTables() as $tid => $proptable ) { |
| 700 | + foreach ( self::getPropertyTables() as $tid => $proptable ) { |
701 | 701 | if ( !$this->tableFitsType( $tid, $typeid ) ) continue; |
702 | 702 | $select = $where = $from = ''; |
703 | 703 | |
— | — | @@ -821,7 +821,7 @@ |
822 | 822 | |
823 | 823 | // Finally update caches (may be important if jobs are directly following this call) |
824 | 824 | $this->m_semdata[$sid] = clone $data; |
825 | | - $this->m_sdstate[$sid] = array_keys( SMWSQLStore2::getPropertyTables() ); // everything that one can know |
| 825 | + $this->m_sdstate[$sid] = array_keys( self::getPropertyTables() ); // everything that one can know |
826 | 826 | wfRunHooks( 'SMWSQLStore2::updateDataAfter', array( $this, $data ) ); |
827 | 827 | wfProfileOut( "SMWSQLStore2::updateData (SMW)" ); |
828 | 828 | } |
— | — | @@ -843,14 +843,14 @@ |
844 | 844 | protected function prepareDBUpdates( &$updates, SMWSemanticData $data, $pageid ) { |
845 | 845 | $subject = $data->getSubject(); |
846 | 846 | $sid = ( $subject !== null ) ? $pageid:$this->makeSMWBnodeID( $pageid ); |
847 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
| 847 | + $proptables = self::getPropertyTables(); |
848 | 848 | |
849 | 849 | foreach ( $data->getProperties() as $property ) { |
850 | | - $tableid = SMWSQLStore2::findPropertyTableID( $property ); |
| 850 | + $tableid = self::findPropertyTableID( $property ); |
851 | 851 | |
852 | 852 | if ( !$tableid ) { // happens when table is not determined by property; use values to find type |
853 | 853 | $dv = reset( $data->getPropertyValues( $property ) ); |
854 | | - $tableid = SMWSQLStore2::findTypeTableID( $dv->getTypeID() ); |
| 854 | + $tableid = self::findTypeTableID( $dv->getTypeID() ); |
855 | 855 | } |
856 | 856 | |
857 | 857 | if ( !$tableid ) { // can't store this data, sorry |
— | — | @@ -1007,7 +1007,7 @@ |
1008 | 1008 | // the query needs to do the filtering of internal properties, else LIMIT is wrong |
1009 | 1009 | $queries = array(); |
1010 | 1010 | |
1011 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 1011 | + foreach ( self::getPropertyTables() as $proptable ) { |
1012 | 1012 | if ( $proptable->fixedproperty == false ) { |
1013 | 1013 | $queries[] = 'SELECT smw_id, smw_title, COUNT(*) as count, smw_sortkey FROM ' . |
1014 | 1014 | $db->tableName( $proptable->name ) . ' INNER JOIN ' . $db->tableName( 'smw_ids' ) . ' ON p_id=smw_id WHERE smw_iw=' . |
— | — | @@ -1079,7 +1079,7 @@ |
1080 | 1080 | $db->deleteJoin( $smw_tmp_unusedprops, $smw_ids, 'title', 'smw_title', array( 'smw_iw' => SMW_SQL2_SMWPREDEFIW ), $fname ); |
1081 | 1081 | |
1082 | 1082 | // all tables occurring in some property table are used: |
1083 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 1083 | + foreach ( self::getPropertyTables() as $proptable ) { |
1084 | 1084 | if ( $proptable->fixedproperty == false ) { // MW does not seem to have a suitable wrapper for this |
1085 | 1085 | $db->query( "DELETE $smw_tmp_unusedprops.* FROM $smw_tmp_unusedprops, " . $db->tableName( $proptable->name ) . |
1086 | 1086 | " INNER JOIN $smw_ids ON p_id=smw_id WHERE title=smw_title AND smw_iw=" . $db->addQuotes( '' ), $fname ); |
— | — | @@ -1087,8 +1087,8 @@ |
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | // properties that have subproperties are considered to be used |
1091 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
1092 | | - $subtable = $proptables[SMWSQLStore2::findTypeTableID( '__sup' )]; // find the subproperty table, but consider its signature to be known |
| 1091 | + $proptables = self::getPropertyTables(); |
| 1092 | + $subtable = $proptables[self::findTypeTableID( '__sup' )]; // find the subproperty table, but consider its signature to be known |
1093 | 1093 | |
1094 | 1094 | // (again we have no fitting MW wrapper here:) |
1095 | 1095 | $db->query( "DELETE $smw_tmp_unusedprops.* FROM $smw_tmp_unusedprops," . $db->tableName( $subtable->name ) . |
— | — | @@ -1132,8 +1132,8 @@ |
1133 | 1133 | wfProfileIn( "SMWSQLStore2::getWantedPropertiesSpecial (SMW)" ); |
1134 | 1134 | |
1135 | 1135 | // Note that Wanted Properties must have the default type. |
1136 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
1137 | | - $proptable = $proptables[SMWSQLStore2::findTypeTableID( $smwgPDefaultType )]; |
| 1136 | + $proptables = self::getPropertyTables(); |
| 1137 | + $proptable = $proptables[self::findTypeTableID( $smwgPDefaultType )]; |
1138 | 1138 | |
1139 | 1139 | $result = array(); |
1140 | 1140 | |
— | — | @@ -1161,10 +1161,10 @@ |
1162 | 1162 | wfProfileIn( 'SMWSQLStore2::getStatistics (SMW)' ); |
1163 | 1163 | $db = wfGetDB( DB_SLAVE ); |
1164 | 1164 | $result = array(); |
1165 | | - $proptables = SMWSQLStore2::getPropertyTables(); |
| 1165 | + $proptables = self::getPropertyTables(); |
1166 | 1166 | // count number of declared properties by counting "has type" annotations |
1167 | 1167 | $typeprop = SMWPropertyValue::makeProperty( '_TYPE' ); |
1168 | | - $typetable = $proptables[SMWSQLStore2::findPropertyTableID( $typeprop )]; |
| 1168 | + $typetable = $proptables[self::findPropertyTableID( $typeprop )]; |
1169 | 1169 | $res = $db->select( $typetable->name, 'COUNT(s_id) AS count', array( 'p_id' => $this->getSMWPropertyID( $typeprop ) ), 'SMW::getStatistics' ); |
1170 | 1170 | $row = $db->fetchObject( $res ); |
1171 | 1171 | $result['DECLPROPS'] = $row->count; |
— | — | @@ -1173,7 +1173,7 @@ |
1174 | 1174 | // count used properties by counting distinct properties in each table |
1175 | 1175 | $result['PROPUSES'] = 0; |
1176 | 1176 | $result['USEDPROPS'] = 0; |
1177 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 1177 | + foreach ( self::getPropertyTables() as $proptable ) { |
1178 | 1178 | /// Note: subproperties that are part of container values are counted individually; |
1179 | 1179 | /// It does not seem to be important to filter them by adding more conditions. |
1180 | 1180 | $res = $db->select( $proptable->name, 'COUNT(*) AS count', '', 'SMW::getStatistics' ); |
— | — | @@ -1283,7 +1283,7 @@ |
1284 | 1284 | SMWSQLHelpers::setupIndex( $smw_conc2, array( 's_id' ), $db ); |
1285 | 1285 | |
1286 | 1286 | // Set up all property tables as defined: |
1287 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 1287 | + foreach ( self::getPropertyTables() as $proptable ) { |
1288 | 1288 | if ( $proptable->idsubject ) { |
1289 | 1289 | $fieldarray = array( 's_id' => $dbtypes['p'] . ' NOT NULL' ); |
1290 | 1290 | $indexes = array( 's_id' ); |
— | — | @@ -1339,7 +1339,7 @@ |
1340 | 1340 | } |
1341 | 1341 | // now write actual properties; do that each time, it is cheap enough and we can update sortkeys by current language |
1342 | 1342 | $this->reportProgress( " ... writing entries for internal properties.\n", $verbose ); |
1343 | | - foreach ( SMWSQLStore2::$special_ids as $prop => $id ) { |
| 1343 | + foreach ( self::$special_ids as $prop => $id ) { |
1344 | 1344 | $p = SMWPropertyValue::makeProperty( $prop ); |
1345 | 1345 | $db->replace( 'smw_ids', array( 'smw_id' ), array( |
1346 | 1346 | 'smw_id' => $id, |
— | — | @@ -1364,7 +1364,7 @@ |
1365 | 1365 | $this->reportProgress( "Deleting all database content and tables generated by SMW ...\n\n", $verbose ); |
1366 | 1366 | $db = wfGetDB( DB_MASTER ); |
1367 | 1367 | $tables = array( 'smw_ids', 'smw_conc2', 'smw_conccache' ); |
1368 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 1368 | + foreach ( self::getPropertyTables() as $proptable ) { |
1369 | 1369 | $tables[] = $proptable->name; |
1370 | 1370 | } |
1371 | 1371 | foreach ( $tables as $table ) { |
— | — | @@ -1735,20 +1735,20 @@ |
1736 | 1736 | * An empty string is returned if no matching table could be found. |
1737 | 1737 | */ |
1738 | 1738 | public static function findTypeTableID( $typeid ) { |
1739 | | - if ( !array_key_exists( $typeid, SMWSQLStore2::$property_table_ids ) ) { |
1740 | | - $signature = SMWSQLStore2::getTypeSignature( $typeid ); |
| 1739 | + if ( !array_key_exists( $typeid, self::$property_table_ids ) ) { |
| 1740 | + $signature = self::getTypeSignature( $typeid ); |
1741 | 1741 | |
1742 | | - foreach ( SMWSQLStore2::getPropertyTables() as $tid => $proptable ) { |
1743 | | - if ( SMWSQLStore2::tableFitsSignature( $tid, $signature ) ) { |
1744 | | - SMWSQLStore2::$property_table_ids[$typeid] = $tid; |
| 1742 | + foreach ( self::getPropertyTables() as $tid => $proptable ) { |
| 1743 | + if ( self::tableFitsSignature( $tid, $signature ) ) { |
| 1744 | + self::$property_table_ids[$typeid] = $tid; |
1745 | 1745 | return $tid; |
1746 | 1746 | } |
1747 | 1747 | } |
1748 | 1748 | |
1749 | | - SMWSQLStore2::$property_table_ids[$typeid] = ''; // No matching table found. |
| 1749 | + self::$property_table_ids[$typeid] = ''; // No matching table found. |
1750 | 1750 | } |
1751 | 1751 | |
1752 | | - return SMWSQLStore2::$property_table_ids[$typeid]; |
| 1752 | + return self::$property_table_ids[$typeid]; |
1753 | 1753 | } |
1754 | 1754 | |
1755 | 1755 | /** |
— | — | @@ -1756,27 +1756,27 @@ |
1757 | 1757 | * values for the given property object. |
1758 | 1758 | */ |
1759 | 1759 | public static function findPropertyTableID( $property ) { |
1760 | | - if ( SMWSQLStore2::$fixed_prop_tables === null ) { // Build lookup array once. |
1761 | | - SMWSQLStore2::$fixed_prop_tables = array(); |
| 1760 | + if ( self::$fixed_prop_tables === null ) { // Build lookup array once. |
| 1761 | + self::$fixed_prop_tables = array(); |
1762 | 1762 | |
1763 | | - foreach ( SMWSQLStore2::getPropertyTables() as $tid => $proptable ) { |
| 1763 | + foreach ( self::getPropertyTables() as $tid => $proptable ) { |
1764 | 1764 | if ( $proptable->fixedproperty != false ) { |
1765 | | - SMWSQLStore2::$fixed_prop_tables[$proptable->fixedproperty] = $tid; |
| 1765 | + self::$fixed_prop_tables[$proptable->fixedproperty] = $tid; |
1766 | 1766 | } |
1767 | 1767 | } |
1768 | 1768 | } |
1769 | 1769 | |
1770 | 1770 | $propertykey = ( $property->isUserDefined() ) ? $property->getDBkey():$property->getPropertyId(); |
1771 | 1771 | |
1772 | | - if ( array_key_exists( $propertykey, SMWSQLStore2::$fixed_prop_tables ) ) { |
1773 | | - $signature = SMWSQLStore2::getTypeSignature( $property->getPropertyTypeID() ); |
| 1772 | + if ( array_key_exists( $propertykey, self::$fixed_prop_tables ) ) { |
| 1773 | + $signature = self::getTypeSignature( $property->getPropertyTypeID() ); |
1774 | 1774 | |
1775 | | - if ( SMWSQLStore2::tableFitsSignature( SMWSQLStore2::$fixed_prop_tables[$propertykey], $signature ) ) { |
1776 | | - return SMWSQLStore2::$fixed_prop_tables[$propertykey]; |
| 1775 | + if ( self::tableFitsSignature( SMWSQLStore2::$fixed_prop_tables[$propertykey], $signature ) ) { |
| 1776 | + return self::$fixed_prop_tables[$propertykey]; |
1777 | 1777 | } |
1778 | 1778 | } // else: Don't check for non-fitting entries in $fixed_prop_tables: not really important. |
1779 | 1779 | |
1780 | | - return SMWSQLStore2::findTypeTableID( $property->getPropertyTypeID() ); |
| 1780 | + return self::findTypeTableID( $property->getPropertyTypeID() ); |
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | /** |
— | — | @@ -1912,8 +1912,8 @@ |
1913 | 1913 | * that properties might be predefined. |
1914 | 1914 | */ |
1915 | 1915 | public function getSMWPropertyID( SMWPropertyValue $property ) { |
1916 | | - if ( ( !$property->isUserDefined() ) && ( array_key_exists( $property->getPropertyID(), SMWSQLStore2::$special_ids ) ) ) { |
1917 | | - return SMWSQLStore2::$special_ids[$property->getPropertyID()]; // very important property with fixed id |
| 1916 | + if ( ( !$property->isUserDefined() ) && ( array_key_exists( $property->getPropertyID(), self::$special_ids ) ) ) { |
| 1917 | + return self::$special_ids[$property->getPropertyID()]; // very important property with fixed id |
1918 | 1918 | } else { |
1919 | 1919 | return $this->getSMWPageID( $property->getDBkey(), SMW_NS_PROPERTY, $this->getPropertyInterwiki( $property ), true ); |
1920 | 1920 | } |
— | — | @@ -1924,8 +1924,8 @@ |
1925 | 1925 | * that properties might be predefined. |
1926 | 1926 | */ |
1927 | 1927 | protected function makeSMWPropertyID( SMWPropertyValue $property ) { |
1928 | | - if ( ( !$property->isUserDefined() ) && ( array_key_exists( $property->getPropertyID(), SMWSQLStore2::$special_ids ) ) ) { |
1929 | | - return SMWSQLStore2::$special_ids[$property->getPropertyID()]; // very important property with fixed id |
| 1928 | + if ( ( !$property->isUserDefined() ) && ( array_key_exists( $property->getPropertyID(), self::$special_ids ) ) ) { |
| 1929 | + return self::$special_ids[$property->getPropertyID()]; // very important property with fixed id |
1930 | 1930 | } else { |
1931 | 1931 | return $this->makeSMWPageID( $property->getDBkey(), SMW_NS_PROPERTY, $this->getPropertyInterwiki( $property ), true ); |
1932 | 1932 | } |
— | — | @@ -2051,7 +2051,7 @@ |
2052 | 2052 | array( 'smw_title' => '', 'smw_namespace' => $oldid, 'smw_iw' => SMW_SQL2_SMWIW ), $fname ); |
2053 | 2053 | } |
2054 | 2054 | // change all id entries in property tables: |
2055 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 2055 | + foreach ( self::getPropertyTables() as $proptable ) { |
2056 | 2056 | if ( $sdata && $proptable->idsubject ) { |
2057 | 2057 | $db->update( $proptable->name, array( 's_id' => $newid ), array( 's_id' => $oldid ), $fname ); |
2058 | 2058 | } |
— | — | @@ -2094,7 +2094,7 @@ |
2095 | 2095 | $fname = 'SMW::deleteSemanticData'; |
2096 | 2096 | $id = $this->getSMWPageID( $subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), false ); |
2097 | 2097 | if ( $id == 0 ) return; // not (directly) used anywhere yet, maybe a redirect but we do not care here |
2098 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 2098 | + foreach ( self::getPropertyTables() as $proptable ) { |
2099 | 2099 | if ( $proptable->idsubject ) { |
2100 | 2100 | $db->delete( $proptable->name, array( 's_id' => $id ), $fname ); |
2101 | 2101 | } elseif ( $proptable->name != 'smw_redi' ) { /// NOTE: redirects are handled by updateRedirects(), not here! |
— | — | @@ -2105,7 +2105,7 @@ |
2106 | 2106 | $res = $db->select( 'smw_ids', 'smw_id', array( 'smw_title' => '', 'smw_namespace' => $id, 'smw_iw' => SMW_SQL2_SMWIW ), $fname ); |
2107 | 2107 | // ... and delete them as well |
2108 | 2108 | while ( $row = $db->fetchObject( $res ) ) { |
2109 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 2109 | + foreach ( self::getPropertyTables() as $proptable ) { |
2110 | 2110 | if ( $proptable->idsubject ) { |
2111 | 2111 | $db->delete( $proptable->name, array( 's_id' => $row->smw_id ), $fname ); |
2112 | 2112 | } |
— | — | @@ -2166,7 +2166,7 @@ |
2167 | 2167 | // entries that refer to old target may in fact refer to subject, but we don't know which: schedule affected pages for update |
2168 | 2168 | $jobs = array(); |
2169 | 2169 | |
2170 | | - foreach ( SMWSQLStore2::getPropertyTables() as $proptable ) { |
| 2170 | + foreach ( self::getPropertyTables() as $proptable ) { |
2171 | 2171 | if ( $proptable->name == 'smw_redi2' ) continue; // can safely be skipped |
2172 | 2172 | |
2173 | 2173 | if ( $proptable->idsubject ) { |
— | — | @@ -2259,40 +2259,40 @@ |
2260 | 2260 | * @return array |
2261 | 2261 | */ |
2262 | 2262 | public static function getPropertyTables() { |
2263 | | - if ( count( SMWSQLStore2::$prop_tables ) > 0 ) return SMWSQLStore2::$prop_tables; // don't initialise twice |
2264 | | - SMWSQLStore2::$prop_tables['smw_rels2'] = new SMWSQLStore2Table( 'smw_rels2', |
| 2263 | + if ( count( self::$prop_tables ) > 0 ) return self::$prop_tables; // don't initialise twice |
| 2264 | + self::$prop_tables['smw_rels2'] = new SMWSQLStore2Table( 'smw_rels2', |
2265 | 2265 | array( 'o_id' => 'p' ), |
2266 | 2266 | array( 'o_id' ) ); |
2267 | | - SMWSQLStore2::$prop_tables['smw_atts2'] = new SMWSQLStore2Table( 'smw_atts2', |
| 2267 | + self::$prop_tables['smw_atts2'] = new SMWSQLStore2Table( 'smw_atts2', |
2268 | 2268 | array( 'value_xsd' => 't', 'value_num' => 'f', 'value_unit' => 'u' ), |
2269 | 2269 | array( 'value_num', 'value_xsd' ) ); |
2270 | | - SMWSQLStore2::$prop_tables['smw_text2'] = new SMWSQLStore2Table( 'smw_text2', |
| 2270 | + self::$prop_tables['smw_text2'] = new SMWSQLStore2Table( 'smw_text2', |
2271 | 2271 | array( 'value_blob' => 'l' ) ); |
2272 | | - SMWSQLStore2::$prop_tables['smw_spec2'] = new SMWSQLStore2Table( 'smw_spec2', |
| 2272 | + self::$prop_tables['smw_spec2'] = new SMWSQLStore2Table( 'smw_spec2', |
2273 | 2273 | array( 'value_string' => 't' ), |
2274 | 2274 | array( 's_id,p_id' ) ); |
2275 | | - SMWSQLStore2::$prop_tables['smw_spec2']->specpropsonly = true; |
2276 | | - SMWSQLStore2::$prop_tables['smw_subs2'] = new SMWSQLStore2Table( 'smw_subs2', |
| 2275 | + self::$prop_tables['smw_spec2']->specpropsonly = true; |
| 2276 | + self::$prop_tables['smw_subs2'] = new SMWSQLStore2Table( 'smw_subs2', |
2277 | 2277 | array( 'o_id' => 'p' ), |
2278 | 2278 | array( 'o_id' ), |
2279 | 2279 | '_SUBC' ); |
2280 | | - SMWSQLStore2::$prop_tables['smw_subp2'] = new SMWSQLStore2Table( 'smw_subp2', |
| 2280 | + self::$prop_tables['smw_subp2'] = new SMWSQLStore2Table( 'smw_subp2', |
2281 | 2281 | array( 'o_id' => 'p' ), |
2282 | 2282 | array( 'o_id' ), |
2283 | 2283 | '_SUBP' ); |
2284 | | - SMWSQLStore2::$prop_tables['smw_inst2'] = new SMWSQLStore2Table( 'smw_inst2', |
| 2284 | + self::$prop_tables['smw_inst2'] = new SMWSQLStore2Table( 'smw_inst2', |
2285 | 2285 | array( 'o_id' => 'p' ), |
2286 | 2286 | array( 'o_id' ), |
2287 | 2287 | '_INST' ); |
2288 | | - SMWSQLStore2::$prop_tables['smw_redi2'] = new SMWSQLStore2Table( 'smw_redi2', |
| 2288 | + self::$prop_tables['smw_redi2'] = new SMWSQLStore2Table( 'smw_redi2', |
2289 | 2289 | array( 'o_id' => 'p' ), |
2290 | 2290 | array( 'o_id' ), |
2291 | 2291 | '_REDI' ); |
2292 | | - SMWSQLStore2::$prop_tables['smw_redi2']->idsubject = false; |
| 2292 | + self::$prop_tables['smw_redi2']->idsubject = false; |
2293 | 2293 | |
2294 | | - wfRunHooks( 'SMWPropertyTables', array( &SMWSQLStore2::$prop_tables ) ); |
| 2294 | + wfRunHooks( 'SMWPropertyTables', array( &self::$prop_tables ) ); |
2295 | 2295 | |
2296 | | - return SMWSQLStore2::$prop_tables; |
| 2296 | + return self::$prop_tables; |
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | } |
\ No newline at end of file |