Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -990,16 +990,26 @@ |
991 | 991 | } |
992 | 992 | |
993 | 993 | function isClass($objectId) { |
994 | | - $dc=wdGetDataSetContext(); |
995 | | - $dbr = & wfGetDB(DB_SLAVE); |
996 | | - $query = "SELECT {$dc}_collection_ns.collection_id " . |
997 | | - "FROM ({$dc}_collection_contents INNER JOIN {$dc}_collection_ns ON {$dc}_collection_ns.collection_id = {$dc}_collection_contents.collection_id) " . |
998 | | - "WHERE {$dc}_collection_contents.member_mid = $objectId AND {$dc}_collection_ns.collection_type = 'CLAS' " . |
999 | | - "AND " . getLatestTransactionRestriction("{$dc}_collection_contents") . " ". |
1000 | | - "AND " .getLatestTransactionRestriction("{$dc}_collection_ns"); |
1001 | | - $queryResult = $dbr->query($query); |
1002 | | - |
1003 | | - return $dbr->numRows($queryResult) > 0; |
| 994 | + global |
| 995 | + $wgDefaultClassMids; |
| 996 | + |
| 997 | + $result = in_array($objectId, $wgDefaultClassMids); |
| 998 | + |
| 999 | + if (!$result) { |
| 1000 | + $dc=wdGetDataSetContext(); |
| 1001 | + $dbr = & wfGetDB(DB_SLAVE); |
| 1002 | + $query = |
| 1003 | + "SELECT {$dc}_collection_ns.collection_id " . |
| 1004 | + " FROM ({$dc}_collection_contents INNER JOIN {$dc}_collection_ns ON {$dc}_collection_ns.collection_id = {$dc}_collection_contents.collection_id) " . |
| 1005 | + " WHERE {$dc}_collection_contents.member_mid = $objectId AND {$dc}_collection_ns.collection_type = 'CLAS' " . |
| 1006 | + " AND " . getLatestTransactionRestriction("{$dc}_collection_contents") . " ". |
| 1007 | + " AND " .getLatestTransactionRestriction("{$dc}_collection_ns"); |
| 1008 | + $queryResult = $dbr->query($query); |
| 1009 | + |
| 1010 | + $result = $dbr->numRows($queryResult) > 0; |
| 1011 | + } |
| 1012 | + |
| 1013 | + return $result; |
1004 | 1014 | } |
1005 | 1015 | |
1006 | 1016 | function findCollection($name) { |