Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -1167,6 +1167,8 @@ |
1168 | 1168 | $dc=wdGetDataSetContext(); |
1169 | 1169 | } |
1170 | 1170 | $collection_id=getCollectionIdForDC($dc); |
| 1171 | + if (is_null($collection_id)) |
| 1172 | + return null; |
1171 | 1173 | $dbr = & wfGetDB(DB_SLAVE); |
1172 | 1174 | $dm=$dbr->addQuotes($dm); |
1173 | 1175 | $query = " |
— | — | @@ -1175,7 +1177,7 @@ |
1176 | 1178 | WHERE member_mid=$dm |
1177 | 1179 | AND collection_id=$collection_id; |
1178 | 1180 | "; |
1179 | | - $queryResult = $dbr->query($query); |
| 1181 | + $queryResult = $dbr->query($query,"getConceptId"); |
1180 | 1182 | $row=$dbr->fetchObject($queryResult); |
1181 | 1183 | return isset($row->concept_id) ? $row->concept_id : null; |
1182 | 1184 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php |
— | — | @@ -261,11 +261,15 @@ |
262 | 262 | * - the URL can have a dataset parameter |
263 | 263 | * - there is a global default |
264 | 264 | * - there can be defaults for different user groups |
265 | | - * |
| 265 | + * @param $dc optional, for convenience. |
| 266 | + * if the dataset context is already set, will |
| 267 | + return that value, else will find the relevant value |
266 | 268 | * @return prefix (without underscore) |
267 | 269 | **/ |
268 | | -function wdGetDataSetContext() { |
| 270 | +function wdGetDataSetContext($dc=null) { |
269 | 271 | |
| 272 | + if (!is_null($dc)) |
| 273 | + return $dc; |
270 | 274 | global $wgRequest, $wdDefaultViewDataSet, $wdGroupDefaultView, $wgUser; |
271 | 275 | $datasets=wdGetDataSets(); |
272 | 276 | $groups=$wgUser->getGroups(); |