r22936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22935‎ | r22936 | r22937 >
Date:20:06, 12 June 2007
Author:kim
Status:old
Tags:
Comment:
If no datasets are defined, don't crash, instead, ignore the situation.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php
@@ -1167,6 +1167,8 @@
11681168 $dc=wdGetDataSetContext();
11691169 }
11701170 $collection_id=getCollectionIdForDC($dc);
 1171+ if (is_null($collection_id))
 1172+ return null;
11711173 $dbr = & wfGetDB(DB_SLAVE);
11721174 $dm=$dbr->addQuotes($dm);
11731175 $query = "
@@ -1175,7 +1177,7 @@
11761178 WHERE member_mid=$dm
11771179 AND collection_id=$collection_id;
11781180 ";
1179 - $queryResult = $dbr->query($query);
 1181+ $queryResult = $dbr->query($query,"getConceptId");
11801182 $row=$dbr->fetchObject($queryResult);
11811183 return isset($row->concept_id) ? $row->concept_id : null;
11821184 }
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -261,11 +261,15 @@
262262 * - the URL can have a dataset parameter
263263 * - there is a global default
264264 * - 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
266268 * @return prefix (without underscore)
267269 **/
268 -function wdGetDataSetContext() {
 270+function wdGetDataSetContext($dc=null) {
269271
 272+ if (!is_null($dc))
 273+ return $dc;
270274 global $wgRequest, $wdDefaultViewDataSet, $wdGroupDefaultView, $wgUser;
271275 $datasets=wdGetDataSets();
272276 $groups=$wgUser->getGroups();

Status & tagging log