r24646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24645‎ | r24646 | r24647 >
Date:08:50, 7 August 2007
Author:proes
Status:old
Tags:
Comment:
Also check $wgDefaultClassMids in isClass()
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php
@@ -990,16 +990,26 @@
991991 }
992992
993993 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;
10041014 }
10051015
10061016 function findCollection($name) {

Status & tagging log