r25139 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25138‎ | r25139 | r25140 >
Date:19:50, 25 August 2007
Author:kim
Status:old
Tags:
Comment:
Committing some paranoid settings and small changes,
now replacing wfMsg with new sitecontext version.
(paranoid settings might not be kept)
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Alert.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Utilities.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/small/autoreplace.sh (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/small/check.sh (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Utilities.php
@@ -1,4 +1,5 @@
22 <?php
 3+require_once("Wikidata.php");
34
45 function implodeFixed($values, $separator = ", ", $prefix = '"', $suffix = '"') {
56 $result = $prefix . $values[0] . $suffix;
@@ -9,4 +10,14 @@
1011 return $result;
1112 }
1213
 14+
 15+function wfMsg_sc($message) {
 16+ $args=func_get_args();
 17+ array_shift($args);
 18+ global
 19+ $SiteContext;
 20+ return wfMsgReal("${SiteContext}_${message}", $args, true);
 21+}
 22+
 23+
1324 ?>
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php
@@ -18,17 +18,13 @@
1919 * merging here.
2020 *
2121 * TODO:
22 - * - The current model of a ton of hardcoded globals is highly inadequate
23 - * and should be replaced with a more abstract schema description.
24 - * -replacing with a single associative array.
25 - * - Attribute names are in WikidataGlobals.php, but should really be
26 - * localizable through MediaWiki's wfMsg() function.
27 - * -this is step 2
2822 * - Records and RecordSets are currently capable of storing most (not all)
2923 * data, but can't actually commit them to the database again. To achieve
3024 * proper separation of architectural layers, the Records should learn
3125 * to talk directly with the DB layer.
32 - * -this is what RecordHelpers are for.
 26+ # - This is not a pure singleton, because it relies on the existence of
 27+ # of viewInformation, and a message cache. We now defer lookups in these
 28+ # to as late as possible, to make sure these items are actually initialized.
3329 */
3430 function initializeOmegaWikiAttributes(ViewInformation $viewInformation){
3531 $init_and_discard_this= OmegaWikiAttributes::getInstance($viewInformation);
@@ -52,21 +48,52 @@
5349 return $instance["last"];
5450 }
5551
 52+
5653 protected $attributes = array();
 54+ protected $setup_completed=False;
 55+ protected $in_setup=False; # for use by functions doing the setup itself (currently hardValues)
 56+ protected $viewInformation=null;
5757
5858 function __construct(ViewInformation $viewInformation) {
59 - $this->hardValues($viewInformation);
 59+ $this->setup($viewInformation);
6060 }
6161
 62+ protected function setup(ViewInformation $viewInformation=null) {
 63+ if ($this->in_setup or $this->setup_completed)
 64+ return True;
 65+
 66+ if (!is_null($viewInformation)) {
 67+ $this->viewInformation=$viewInformation;
 68+ }
 69+ $viewInformation=$this->viewInformation;
 70+
 71+ if (!is_null($viewInformation)) {
 72+ global $messageCacheOK;
 73+ var_dump($messageCacheOK);
 74+ if (!$messageCacheOK) {
 75+ #We're not ready to do this yet!
 76+ return False; #so we get out, but with viewinfo cached
 77+ }
 78+ if (!$this->setup_completed) {
 79+ $this->hardValues($viewInformation);
 80+ }
 81+ $this->setup_completed=True;
 82+ return True;
 83+ }
 84+ return False;
 85+ }
 86+
6287 /** Hardcoded schema for now. Later refactor to load from file or DB
6388 *
6489 * Naming: keys are previous name minus -"Attribute"
6590 * (-"Structure" is retained, -"Attributes" is retained)
6691 */
67 - private function hardValues($viewInformation) {
 92+ private function hardValues(viewInformation $viewInformation) {
6893
 94+ assert (!is_null($viewInformation));
6995 $t=$this; #<-keep things short to declutter
7096
 97+ $t->in_setup=True;
7198 $t->language = new Attribute("language", wfMsg("Language"), "language");
7299 $t->spelling = new Attribute("spelling", wfMsg("Spelling"), "spelling");
73100 $t->text = new Attribute("text", wfMsg("Text"), "text");
@@ -261,14 +288,19 @@
262289 foreach ($t->annotatedAttributes as $annotatedAttribute)
263290 $annotatedAttribute->type->addAttribute($attribute);
264291 }
 292+ $t->in_setup=False;
265293 }
266294
267295 protected function __set($key,$value) {
 296+ if (!$this->setup())
 297+ throw new Exception("OmegaWikiAttributes accessed, but was not properly initialized");
268298 $attributes=&$this->attributes;
269299 $attributes[$key]=$value;
270300 }
271301
272302 public function __get($key) {
 303+ if (!$this->setup())
 304+ throw new Exception("OmegaWikiAttributes accessed, but was not properly initialized");
273305 $attributes=&$this->attributes;
274306 if (!array_key_exists($key, $attributes)) {
275307 throw new Exception("Key does not exist: " . $key);
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -82,7 +82,7 @@
8383
8484 $this->viewInformation = $viewInformation;
8585
86 - initializeOmegaWikiAttributes($viewInformation);
 86+ initializeOmegaWikiAttributes($viewInformation);
8787 initializeObjectAttributeEditors($viewInformation);
8888 }
8989
@@ -297,9 +297,9 @@
298298
299299 # overrides
300300 if (!is_null($dc))
301 - return $dc;
 301+ return $dc; #local override
302302 if (!is_null($wdCurrentContext))
303 - return $wdCurrentContext;
 303+ return $wdCurrentContext; #global override
304304
305305 $datasets=wdGetDataSets();
306306 $groups=$wgUser->getGroups();
@@ -425,4 +425,4 @@
426426 return $this->getPrefix();
427427 }
428428
429 -}
\ No newline at end of file
 429+}
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -180,7 +180,7 @@
181181
182182 function initializeObjectAttributeEditors(ViewInformation $viewInformation) {
183183
184 - $o=OmegaWikiAttributes::getInstance();
 184+ $o=OmegaWikiAttributes::getInstance($viewInformation);
185185 global
186186
187187 $textValueObjectAttributesEditors,
Index: trunk/extensions/Wikidata/OmegaWiki/Alert.php
@@ -1,194 +1,194 @@
2 -<?php
3 -
4 -require_once( "extensions/Wikidata/OmegaWiki/WikiDataAPI.php" );
5 -
6 -function ConvertIsoToEpoch( $iso ){
7 - // 01234567890123456789
8 - // 2007-05-01-T00:00:00
9 - return substr( $iso, 0, 4 ) . substr( $iso, 5, 2 ) . substr( $iso, 8, 2 ) . substr( $iso, 12, 2 ) . substr( $iso, 15, 2 ) . substr( $iso, 18, 2 );
10 -}
11 -
12 -function ConvertEpochToIso( $epoch ){
13 - // 01234567890123456789
14 - // 20070501000000
15 - return substr( $epoch, 0, 4 ) . "-" . substr( $epoch, 4, 2 ) . "-" . substr( $epoch, 6, 2 ) . "-T" . substr( $epoch, 8, 2 ) . ":" . substr( $epoch, 10, 2 ) . ":" . substr( $epoch, 12, 2 );
16 -}
17 -
18 -function getDefinedMeaning( $dc, $textId ){
19 - // translate the text id to a translated text id
20 - $dbr = &wfGetDB(DB_SLAVE);
21 - $queryResult = $dbr->query( "select translated_content_id from {$dc}_translated_content where text_id = $textId and remove_transaction_id is NULL" );
22 - if ( $row = $dbr->fetchObject( $queryResult ) ){
23 - $tcid = $row->translated_content_id;
24 - }
25 - else{
26 - return -1;
27 - }
28 -
29 - // try the definition first
30 - $queryResult = $dbr->query( "select defined_meaning_id from uw_defined_meaning where meaning_text_tcid = $tcid" );
31 - if ( $row = $dbr->fetchObject( $queryResult ) ){
32 - $definedMeaningId = $row->defined_meaning_id;
33 - return $definedMeaningId;
34 - }
35 -
36 - // try the translated text attributes
37 - $queryResult = $dbr->query( "select object_id from uw_translated_content_attribute_values where value_tcid = $tcid" );
38 - if ( $row = $dbr->fetchObject( $queryResult ) ){
39 - $definedMeaningId = $row->object_id;
40 - return $definedMeaningId;
41 - }
42 -
43 - // try the text attributes
44 - $queryResult = $dbr->query( "select object_id from uw_text_attribute_values where value_id = $tcid" );
45 - if ( $row = $dbr->fetchObject( $queryResult ) ){
46 - $definedMeaningId = $row->object_id;
47 - return $definedMeaningId;
48 - }
49 -
50 - return -1;
51 -}
52 -
53 -function getInternalIdentifier( $dc, $definedMeaningId, $languageId ){
54 - $collectionName = "uw";
55 -
56 - $dbr = &wfGetDB(DB_SLAVE);
57 - $query = "SELECT collection_id, internal_member_id FROM {$dc}_collection_contents where member_mid = $definedMeaningId";
58 - $queryResult = $dbr->query( "SELECT collection_id, internal_member_id FROM {$dc}_collection_contents where member_mid = $definedMeaningId" );
59 - if ( $row = $dbr->fetchObject( $queryResult ) ){
60 - $internalMemberId = $row->internal_member_id;
61 -
62 - $collectionDefinedMeaningId = getCollectionMeaningId( $row->collection_id );
63 - $queryResult = $dbr->query( "SELECT meaning_text_tcid FROM {$dc}_defined_meaning where defined_meaning_id = $collectionDefinedMeaningId" );
64 - if ( $row = $dbr->fetchObject( $queryResult ) ){
65 - $queryResult = $dbr->query( "SELECT text_id FROM {$dc}_translated_content where translated_content_id = $row->meaning_text_tcid" );
66 - if ( $row = $dbr->fetchObject( $queryResult ) ){
67 - $queryResult = $dbr->query( "SELECT text_text FROM {$dc}_text where text_id = $row->text_id" );
68 - if ( $row = $dbr->fetchObject( $queryResult ) ){
69 - if ( $row->text_text == "Swiss-Prot" ){
70 - $collectionName = "uniprot";
71 - }
72 - }
73 - }
74 - }
75 -
76 - return $collectionName . '/' . $internalMemberId;
77 - }
78 - else{
79 - return "";
80 - }
81 -
82 -}
83 -
84 -function getTextForId( $dc, $text_id ){
85 - $dbr = &wfGetDB(DB_SLAVE);
86 - $textResult = $dbr->query( "select text_text from {$dc}_text where text_id = $text_id" );
87 - if ( $textRecord = $dbr->fetchObject($textResult) ){
88 - return $textRecord->text_text;
89 - }
90 - else {
91 - return( "" );
92 - }
93 -}
94 -
95 -function getDefinedMeaningTitle( $dc, $definedMeaningId ){
96 - $dbr = &wfGetDB(DB_SLAVE);
97 - $result = $dbr->query( "SELECT meaning_text_tcid FROM {$dc}_defined_meaning where defined_meaning_id = $definedMeaningId" );
98 - if ( $record = $dbr->fetchObject($result) ){
99 - $result = $dbr->query( "SELECT text_id FROM {$dc}_translated_content where translated_content_id = $record->meaning_text_tcid and remove_transaction_id IS NULL" );
100 - if ( $record = $dbr->fetchObject($result) ){
101 - return getTextForId( $dc, $record->text_id ) . "_(" . $definedMeaningId . ")";
102 - }
103 - }
104 - return( "" );
105 -}
106 -
107 -function getUser( $user_id ){
108 - $dbr = &wfGetDB(DB_SLAVE);
109 - $queryResult = $dbr->query( "SELECT user_name FROM `user` u where user_id = $user_id" );
110 - if ( $row = $dbr->fetchObject( $queryResult ) ){
111 - return $row->user_name;
112 - }
113 - return "unknown";
114 -}
115 -
116 -// XML Entity Mandatory Escape Characters
117 -function xmlentities($string) {
118 - return str_replace ( array ( '&', '"', "'", '<', '>', '�' ), array ( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;', '&apos;' ), $string );
119 -}
120 -
121 -require (dirname(__FILE__) . '/includes/WebStart.php');
122 -global $wgSitename;
123 -
124 -// Verify that the API has not been disabled
125 -if (!$wgEnableAPI) {
126 - echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
127 - echo '<pre><b>$wgEnableAPI=true;</b></pre>';
128 - die(-1);
129 -}
130 -
131 -// indicate here the dataset that contains the community version
132 -$dc = "uw";
133 -
134 -// read the parameters passed as arguments to the alert program
135 -$responseType = $_GET["output"];
136 -$epochStartDate = $_GET["startDate"];
137 -$startDate = ConvertIsoToEpoch( $epochStartDate );
138 -$epochEndDate = $_GET["endDate"];
139 -
140 -if ( $epochStartDate == "" ){
141 - echo 'This alert utility requires a start date in ISO format to be specified as parameter<BR>';
142 - echo 'Usage: alert.php?startDate=2007-05-01-T00:00:00[&endDate=2007-06-31-T00:00:00][&output=(xml|raw)]<BR>';
143 - die(-1);
144 -}
145 -
146 -if ( $epochEndDate != "" ){
147 - $endDate = ConvertIsoToEpoch( $epochEndDate );
148 - $endClause = " AND timestamp <= $endDate ";
149 -}
150 -else {
151 - $endClause = "";
152 -}
153 -
154 -$dbr = &wfGetDB(DB_SLAVE);
155 -
156 -$queryResult = $dbr->query( "select language_id from language where wikimedia_key='en'" );
157 -$languageId = $dbr->fetchObject($queryResult)->language_id;
158 -
159 -$transactionResult = $dbr->query( "select transaction_id, user_id, timestamp from {$dc}_transactions where timestamp >= $startDate $endClause" );
160 -if ( $responseType == "xml" ){
161 - echo "<edits startdate='$epochStartDate'";
162 - if ( $epochEndDate != "" ){
163 - echo " enddate='$epochEndDate'";
164 - }
165 - echo ">";
166 -}
167 -
168 -while ($transactionRecord = $dbr->fetchObject($transactionResult)) {
169 - $transaction_id = $transactionRecord->transaction_id;
170 - $timestamp = $transactionRecord->timestamp;
171 - $user = getUser( $transactionRecord->user_id );
172 -
173 - $translatedContentResult = $dbr->query( "SELECT text_id FROM {$dc}_translated_content WHERE add_transaction_id = $transaction_id AND language_id=$languageId and remove_transaction_id IS NULL" );
174 - while ($tranlatedContentRecord = $dbr->fetchObject($translatedContentResult)) {
175 - $definedMeaningId = getDefinedMeaning( $dc, $tranlatedContentRecord->text_id );
176 - $text = xmlentities( getTextForId( $dc, $tranlatedContentRecord->text_id ) );
177 - $internalIdentifier = getInternalIdentifier( $dc, $definedMeaningId, $languageId );
178 - if ( $internalIdentifier != "" ){
179 - $definedMeaningTitle = getDefinedMeaningTitle( $dc, $definedMeaningId );
180 - $epochDate = ConvertEpochToIso($timestamp);
181 - if ( $responseType == "xml" ){
182 - echo "<record><knowletid>$internalIdentifier</knowletid><text>$text</text><user>$user</user><timestamp>$epochDate</timestamp><definedmeaning>$definedMeaningTitle</definedmeaning><site>$wgSitename</site></record>";
183 - }
184 - else {
185 - echo "$internalIdentifier|$text|$user|$epochDate|$definedMeaningTitle|$wgSitename\n";
186 - }
187 - }
188 - }
189 -}
190 -if ( $responseType == "xml" ){
191 - echo "</edits>";
192 -}
193 -
 2+<?php
1943
 4+require_once( "extensions/Wikidata/OmegaWiki/WikiDataAPI.php" );
 5+
 6+function ConvertIsoToEpoch( $iso ){
 7+ // 01234567890123456789
 8+ // 2007-05-01-T00:00:00
 9+ return substr( $iso, 0, 4 ) . substr( $iso, 5, 2 ) . substr( $iso, 8, 2 ) . substr( $iso, 12, 2 ) . substr( $iso, 15, 2 ) . substr( $iso, 18, 2 );
 10+}
 11+
 12+function ConvertEpochToIso( $epoch ){
 13+ // 01234567890123456789
 14+ // 20070501000000
 15+ return substr( $epoch, 0, 4 ) . "-" . substr( $epoch, 4, 2 ) . "-" . substr( $epoch, 6, 2 ) . "-T" . substr( $epoch, 8, 2 ) . ":" . substr( $epoch, 10, 2 ) . ":" . substr( $epoch, 12, 2 );
 16+}
 17+
 18+function getDefinedMeaning( $dc, $textId ){
 19+ // translate the text id to a translated text id
 20+ $dbr = &wfGetDB(DB_SLAVE);
 21+ $queryResult = $dbr->query( "select translated_content_id from {$dc}_translated_content where text_id = $textId and remove_transaction_id is NULL" );
 22+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 23+ $tcid = $row->translated_content_id;
 24+ }
 25+ else{
 26+ return -1;
 27+ }
 28+
 29+ // try the definition first
 30+ $queryResult = $dbr->query( "select defined_meaning_id from uw_defined_meaning where meaning_text_tcid = $tcid" );
 31+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 32+ $definedMeaningId = $row->defined_meaning_id;
 33+ return $definedMeaningId;
 34+ }
 35+
 36+ // try the translated text attributes
 37+ $queryResult = $dbr->query( "select object_id from uw_translated_content_attribute_values where value_tcid = $tcid" );
 38+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 39+ $definedMeaningId = $row->object_id;
 40+ return $definedMeaningId;
 41+ }
 42+
 43+ // try the text attributes
 44+ $queryResult = $dbr->query( "select object_id from uw_text_attribute_values where value_id = $tcid" );
 45+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 46+ $definedMeaningId = $row->object_id;
 47+ return $definedMeaningId;
 48+ }
 49+
 50+ return -1;
 51+}
 52+
 53+function getInternalIdentifier( $dc, $definedMeaningId, $languageId ){
 54+ $collectionName = "uw";
 55+
 56+ $dbr = &wfGetDB(DB_SLAVE);
 57+ $query = "SELECT collection_id, internal_member_id FROM {$dc}_collection_contents where member_mid = $definedMeaningId";
 58+ $queryResult = $dbr->query( "SELECT collection_id, internal_member_id FROM {$dc}_collection_contents where member_mid = $definedMeaningId" );
 59+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 60+ $internalMemberId = $row->internal_member_id;
 61+
 62+ $collectionDefinedMeaningId = getCollectionMeaningId( $row->collection_id );
 63+ $queryResult = $dbr->query( "SELECT meaning_text_tcid FROM {$dc}_defined_meaning where defined_meaning_id = $collectionDefinedMeaningId" );
 64+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 65+ $queryResult = $dbr->query( "SELECT text_id FROM {$dc}_translated_content where translated_content_id = $row->meaning_text_tcid" );
 66+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 67+ $queryResult = $dbr->query( "SELECT text_text FROM {$dc}_text where text_id = $row->text_id" );
 68+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 69+ if ( $row->text_text == "Swiss-Prot" ){
 70+ $collectionName = "uniprot";
 71+ }
 72+ }
 73+ }
 74+ }
 75+
 76+ return $collectionName . '/' . $internalMemberId;
 77+ }
 78+ else{
 79+ return "";
 80+ }
 81+
 82+}
 83+
 84+function getTextForId( $dc, $text_id ){
 85+ $dbr = &wfGetDB(DB_SLAVE);
 86+ $textResult = $dbr->query( "select text_text from {$dc}_text where text_id = $text_id" );
 87+ if ( $textRecord = $dbr->fetchObject($textResult) ){
 88+ return $textRecord->text_text;
 89+ }
 90+ else {
 91+ return( "" );
 92+ }
 93+}
 94+
 95+function getDefinedMeaningTitle( $dc, $definedMeaningId ){
 96+ $dbr = &wfGetDB(DB_SLAVE);
 97+ $result = $dbr->query( "SELECT meaning_text_tcid FROM {$dc}_defined_meaning where defined_meaning_id = $definedMeaningId" );
 98+ if ( $record = $dbr->fetchObject($result) ){
 99+ $result = $dbr->query( "SELECT text_id FROM {$dc}_translated_content where translated_content_id = $record->meaning_text_tcid and remove_transaction_id IS NULL" );
 100+ if ( $record = $dbr->fetchObject($result) ){
 101+ return getTextForId( $dc, $record->text_id ) . "_(" . $definedMeaningId . ")";
 102+ }
 103+ }
 104+ return( "" );
 105+}
 106+
 107+function getUser( $user_id ){
 108+ $dbr = &wfGetDB(DB_SLAVE);
 109+ $queryResult = $dbr->query( "SELECT user_name FROM `user` u where user_id = $user_id" );
 110+ if ( $row = $dbr->fetchObject( $queryResult ) ){
 111+ return $row->user_name;
 112+ }
 113+ return "unknown";
 114+}
 115+
 116+// XML Entity Mandatory Escape Characters
 117+function xmlentities($string) {
 118+ return str_replace ( array ( '&', '"', "'", '<', '>', '�' ), array ( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;', '&apos;' ), $string );
 119+}
 120+
 121+require (dirname(__FILE__) . '/includes/WebStart.php');
 122+global $wgSitename;
 123+
 124+// Verify that the API has not been disabled
 125+if (!$wgEnableAPI) {
 126+ echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
 127+ echo '<pre><b>$wgEnableAPI=true;</b></pre>';
 128+ die(-1);
 129+}
 130+
 131+// indicate here the dataset that contains the community version
 132+$dc = "uw";
 133+
 134+// read the parameters passed as arguments to the alert program
 135+$responseType = $_GET["output"];
 136+$epochStartDate = $_GET["startDate"];
 137+$startDate = ConvertIsoToEpoch( $epochStartDate );
 138+$epochEndDate = $_GET["endDate"];
 139+
 140+if ( $epochStartDate == "" ){
 141+ echo 'This alert utility requires a start date in ISO format to be specified as parameter<BR>';
 142+ echo 'Usage: alert.php?startDate=2007-05-01-T00:00:00[&endDate=2007-06-31-T00:00:00][&output=(xml|raw)]<BR>';
 143+ die(-1);
 144+}
 145+
 146+if ( $epochEndDate != "" ){
 147+ $endDate = ConvertIsoToEpoch( $epochEndDate );
 148+ $endClause = " AND timestamp <= $endDate ";
 149+}
 150+else {
 151+ $endClause = "";
 152+}
 153+
 154+$dbr = &wfGetDB(DB_SLAVE);
 155+
 156+$queryResult = $dbr->query( "select language_id from language where wikimedia_key='en'" );
 157+$languageId = $dbr->fetchObject($queryResult)->language_id;
 158+
 159+$transactionResult = $dbr->query( "select transaction_id, user_id, timestamp from {$dc}_transactions where timestamp >= $startDate $endClause" );
 160+if ( $responseType == "xml" ){
 161+ echo "<edits startdate='$epochStartDate'";
 162+ if ( $epochEndDate != "" ){
 163+ echo " enddate='$epochEndDate'";
 164+ }
 165+ echo ">";
 166+}
 167+
 168+while ($transactionRecord = $dbr->fetchObject($transactionResult)) {
 169+ $transaction_id = $transactionRecord->transaction_id;
 170+ $timestamp = $transactionRecord->timestamp;
 171+ $user = getUser( $transactionRecord->user_id );
 172+
 173+ $translatedContentResult = $dbr->query( "SELECT text_id FROM {$dc}_translated_content WHERE add_transaction_id = $transaction_id AND language_id=$languageId and remove_transaction_id IS NULL" );
 174+ while ($tranlatedContentRecord = $dbr->fetchObject($translatedContentResult)) {
 175+ $definedMeaningId = getDefinedMeaning( $dc, $tranlatedContentRecord->text_id );
 176+ $text = xmlentities( getTextForId( $dc, $tranlatedContentRecord->text_id ) );
 177+ $internalIdentifier = getInternalIdentifier( $dc, $definedMeaningId, $languageId );
 178+ if ( $internalIdentifier != "" ){
 179+ $definedMeaningTitle = getDefinedMeaningTitle( $dc, $definedMeaningId );
 180+ $epochDate = ConvertEpochToIso($timestamp);
 181+ if ( $responseType == "xml" ){
 182+ echo "<record><knowletid>$internalIdentifier</knowletid><text>$text</text><user>$user</user><timestamp>$epochDate</timestamp><definedmeaning>$definedMeaningTitle</definedmeaning><site>$wgSitename</site></record>";
 183+ }
 184+ else {
 185+ echo "$internalIdentifier|$text|$user|$epochDate|$definedMeaningTitle|$wgSitename\n";
 186+ }
 187+ }
 188+ }
 189+}
 190+if ( $responseType == "xml" ){
 191+ echo "</edits>";
 192+}
 193+
 194+
195195 ?>
\ No newline at end of file
Index: trunk/extensions/Wikidata/OmegaWiki/small/autoreplace.sh
@@ -1,5 +1,5 @@
22 #!/bin/bash
33 export myfile=$1;
44
5 -small/ra3.pl $myfile > $myfile.new &&
 5+small/wfMsg.pl $myfile > $myfile.new &&
66 mv $myfile.new $myfile
Index: trunk/extensions/Wikidata/OmegaWiki/small/check.sh
@@ -1,6 +1,6 @@
22 #!/bin/bash
33 export myfile=$1;
44
5 -small/ra3.pl $myfile |
 5+small/wfMsg.pl $myfile |
66 diff -dy $myfile - |
77 less

Status & tagging log