r23736 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23735‎ | r23736 | r23737 >
Date:13:37, 5 July 2007
Author:kim
Status:old
Tags:
Comment:
New version of GetDM (no influence on other files)
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/GetDM.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/GetDM.php
@@ -1,5 +1,11 @@
22 <?php
33
 4+# let's see...
 5+# start out with a test skeleton, get a record from one dataset
 6+# and print it out
 7+# This is just saveDM with the actual save call removed :-P
 8+# (it's simply too handy not to do ;-))
 9+
410 define('MEDIAWIKI', true );
511
612 # do we seriously need ALL of these?
@@ -11,7 +17,27 @@
1218 require_once("DefinedMeaningModel.php");
1319 require_once("Transaction.php");
1420
 21+/** Just get a defined meaning */
 22+function getDM($definedMeaningId,$dc="uw") {
 23+ global
 24+ $wdCurrentContext;
 25+ $wdCurrentContext=$dc;
 26+ #$viewInformation = new ViewInformation();
 27+ #$viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
 28+ $model=new DefinedMeaningModel($definedMeaningId);
 29+ $record=$model->getRecord();
 30+ #$record->finish("DefinedMeaning");
 31+ return $model;
 32+}
1533
 34+function saveDM($model,$dc="uw") {
 35+ global
 36+ $wdCurrentContext;
 37+ $wdCurrentContext=$dc;
 38+ #echo $model->getRecord();
 39+ $model->saveWithinTransaction();
 40+}
 41+
1642 global
1743 $beginTime, $wgCommandLineMode, $dc;
1844
@@ -20,17 +46,22 @@
2147 # $dc = "uw"; < can't modify from here
2248
2349 /* insert code here */
24 -$definedMeaningId=663665; # UnitTest
2550
26 -$viewInformation = new ViewInformation();
27 -$viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation();
 51+$model=getDM(663674,"tt");
2852
29 -$model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
3053 $record=$model->getRecord();
31 -$record->finish("DefinedMeaning");
3254 echo $record;
 55+$defexp=$record->getValue("defined-meaning-full-defining-expression");
 56+echo $defexp."\n";
 57+#$expid=$record->getAttributeValue(new Attribute("expression-id"));
 58+$id=$defexp->getValue("expression-id");
 59+$spelling=$defexp->getValue("defined-meaning-defining-expression");
 60+$language=$defexp->getValue("language");
3361
 62+echo "id: $id, spelling:$spelling, language:$language";
3463
 64+#saveDM($model,"uw");
 65+
3566 $endTime = time();
3667 echo("\n\nTime elapsed: " . durationToString($endTime - $beginTime));
3768

Status & tagging log