r26425 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26424‎ | r26425 | r26426 >
Date:05:40, 5 October 2007
Author:kim
Status:old
Tags:
Comment:
This copy works slightly
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Copy.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Copy.php
@@ -240,13 +240,16 @@
241241
242242 $object2=$this->identical();
243243 if (CopyTools::sane_key_exists("object_id",$object2)) {
 244+ echo "ALREADY THERE? o1, o2<br>\n";
 245+ var_dump($this->object);
 246+ var_dump($object2);
244247 $this->already_there=true;
245248 $newid=$object2["object_id"];
246249 } else {
247250 $this->already_there=false;
248251 $newid=$this->write();
249252 }
250 - AttributeCopier::copy($object["object_id"], $object2["object_id"]);
 253+ AttributeCopier::copy($this->dc1, $this->dc2, $this->object["object_id"], $newid);
251254 return $newid;
252255 }
253256 }
@@ -1058,6 +1061,7 @@
10591062
10601063 #refactor_candidate
10611064 public function write($attributes) {
 1065+ $latest=null;
10621066 foreach ($attributes as $attribute) {
10631067 $latest=$this->write_single($attribute);
10641068 }
@@ -1209,27 +1213,28 @@
12101214 }
12111215
12121216
1213 - public static function copy($src_object_id, $dst_object_id) {
 1217+ public static function copy($dc1, $dc2, $src_object_id, $dst_object_id) {
12141218 echo "<h3> crumb: would copy attribs </h3>";
12151219 if (is_null($src_object_id))
12161220 throw new Exception("AttributeCopier: cannot copy: source object_id=null");
12171221
12181222 if (is_null($dst_object_id))
12191223 throw new Exception("AttributeCopier: cannot copy: destination object_id=null");
1220 - #$optionAttribueCopier=new OptionAttributeCopier($src_object_id, $dst_object_id);
1221 - #$optionAttributeCopier.dup();
 1224+ $optionAttributeCopier=new OptionAttributeCopier($dc1, $dc2, $src_object_id, $dst_object_id);
 1225+ $optionAttributeCopier->dup();
12221226
1223 - #$textAttributeCopier=new textAttributeCopier($src_object_id, $dst_object_id);
1224 - #$textAttributeCopier.dup();
 1227+ #$textAttributeCopier=new textAttributeCopier($this->dc1, $this->dc2, $src_object_id, $dst_object_id);
 1228+ #$textAttributeCopier->dup();
12251229
1226 - #$translatedContentCopier=new translatedContentCopier($src_object_id, $dst_object_id);
1227 - #$translatedContentCopier.dup();
 1230+ #$translatedContentCopier=new translatedContentCopier($this->dc1, $this->dc2, $src_object_id, $dst_object_id);
 1231+ #$translatedContentCopier->dup();
12281232
1229 - #$urlAttributeCopier=new URLAttributeCpier($src_object_id, $dst_object_id);
1230 - #$urlAttributeCopier.dup();
 1233+ #$urlAttributeCopier=new URLAttributeCpier($this->dc1, $this->dc2, $src_object_id, $dst_object_id);
 1234+ #$urlAttributeCopier->dup();
12311235 }
12321236
12331237 protected function write($values) {
 1238+ $latest=null;
12341239 foreach ($values as $value) {
12351240 $latest=write_single($value);
12361241 }
@@ -1247,7 +1252,7 @@
12481253 if (is_null($tableName))
12491254 throw new Exception("*AttributeCopier: cannot read: table name is null");
12501255
1251 - return CopyTools::getRows($dc1, $tableName, "WHERE object_id=$src_object_id");
 1256+ return CopyTools::getRows($this->dc1, $tableName, "WHERE object_id=$src_object_id");
12521257 }
12531258
12541259 /** slightly different dup interface yet again.
@@ -1325,6 +1330,7 @@
13261331 * TODO This is a refactor-candidate.
13271332 */
13281333 public function write($oaos) {
 1334+ $latest=null;
13291335 foreach ($oaos as $oao) {
13301336 $latest=$this->write_single($oao);
13311337 }

Status & tagging log