r25276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25275‎ | r25276 | r25277 >
Date:11:22, 29 August 2007
Author:kim
Status:old
Tags:
Comment:
Lets add a syntrans :-)
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php (modified) (history)
  • /trunk/extensions/Wikidata/util/copy.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php
@@ -263,7 +263,7 @@
264264 foreach($datasets as $datasetid=>$dataset) {
265265 $name=$dataset->fetchName();
266266 $dc2=$datasetid;
267 - $html.="<a href='extended/Wikidata/util/copy.php?dmid=$dmid&dc1=$dc1&dc2=$dc2'>$name</a><br>\n";
 267+ $html.="<a href='extensions/Wikidata/util/copy.php?dmid=$dmid&dc1=$dc1&dc2=$dc2'>$name</a><br>\n";
268268 }
269269
270270 return $html;
Index: trunk/extensions/Wikidata/util/copy.php
@@ -120,8 +120,31 @@
121121 }
122122 }
123123
 124+function getOldSyntrans($dc1, $dmid, $expid) {
 125+ $syntrans_table=mysql_real_escape_string("${dc1}_syntrans");
 126+ $query="SELECT * from $syntrans_table where defined_meaning_id=$dmid and expression_id=$expid";
 127+ $result = mysql_query($query)or die ("error ".mysql_error());
 128+ $data= mysql_fetch_assoc($result);
 129+ var_dump($data);
 130+ return $data;
 131+}
124132
 133+function writeSyntrans($syntrans, $newdmid, $newexpid, $dc2) {
 134+ $syntrans["defined_meaning_id"]=$newdmid;
 135+ $syntrans["expression_id"]=$newexpid;
 136+ $syntrans_table=mysql_real_escape_string("${dc2}_syntrans");
 137+ mysql_insert_assoc($syntrans_table,$syntrans);
 138+}
125139
 140+function dupSyntrans($dc1, $dc2, $olddmid, $oldexpid, $newdmid, $newexpid) {
 141+ $syntrans=getOldSyntrans($dc1, $olddmid, $oldexpid);
 142+ $table=mysql_real_escape_string("${dc2}_syntrans");
 143+ $newid=dupObject($syntrans["syntrans_sid"], $table, $dc1, $dc2);
 144+ $syntrans["syntrans_sid"]=$newid;
 145+ writeSyntrans($syntrans, $newdmid, $newexpid, $dc2);
 146+}
 147+
 148+
126149 $start=stopwatch();
127150
128151 $dmid=$_REQUEST['dmid'];
@@ -161,6 +184,15 @@
162185 $save_meaning["expression_id"]=$target_expid1;
163186 mysql_insert_assoc($dm_target_table, $save_meaning);
164187
 188+dupsyntrans(
 189+ $dc1,
 190+ $dc2,
 191+ $defined_meaning["defined_meaning_id"],
 192+ $defining_expression["expression_id"],
 193+ $save_meaning["defined_meaning_id"],
 194+ $save_expression["expression_id"]
 195+);
 196+
165197 $title_name=$defining_expression["spelling"];
166198 $title_number=$target_dmid;
167199 $title=str_replace(" ","_",$title_name)."_(".$title_number.")";
@@ -168,6 +200,7 @@
169201 mysql_insert_assoc("page",$pagedata);
170202
171203
 204+
172205 echo"
173206 <hr>
174207 <div align=\"right\">

Status & tagging log