Index: trunk/extensions/Wikidata/OmegaWiki/Copy.php |
— | — | @@ -240,13 +240,16 @@ |
241 | 241 | |
242 | 242 | $object2=$this->identical(); |
243 | 243 | 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); |
244 | 247 | $this->already_there=true; |
245 | 248 | $newid=$object2["object_id"]; |
246 | 249 | } else { |
247 | 250 | $this->already_there=false; |
248 | 251 | $newid=$this->write(); |
249 | 252 | } |
250 | | - AttributeCopier::copy($object["object_id"], $object2["object_id"]); |
| 253 | + AttributeCopier::copy($this->dc1, $this->dc2, $this->object["object_id"], $newid); |
251 | 254 | return $newid; |
252 | 255 | } |
253 | 256 | } |
— | — | @@ -1058,6 +1061,7 @@ |
1059 | 1062 | |
1060 | 1063 | #refactor_candidate |
1061 | 1064 | public function write($attributes) { |
| 1065 | + $latest=null; |
1062 | 1066 | foreach ($attributes as $attribute) { |
1063 | 1067 | $latest=$this->write_single($attribute); |
1064 | 1068 | } |
— | — | @@ -1209,27 +1213,28 @@ |
1210 | 1214 | } |
1211 | 1215 | |
1212 | 1216 | |
1213 | | - public static function copy($src_object_id, $dst_object_id) { |
| 1217 | + public static function copy($dc1, $dc2, $src_object_id, $dst_object_id) { |
1214 | 1218 | echo "<h3> crumb: would copy attribs </h3>"; |
1215 | 1219 | if (is_null($src_object_id)) |
1216 | 1220 | throw new Exception("AttributeCopier: cannot copy: source object_id=null"); |
1217 | 1221 | |
1218 | 1222 | if (is_null($dst_object_id)) |
1219 | 1223 | 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(); |
1222 | 1226 | |
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(); |
1225 | 1229 | |
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(); |
1228 | 1232 | |
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(); |
1231 | 1235 | } |
1232 | 1236 | |
1233 | 1237 | protected function write($values) { |
| 1238 | + $latest=null; |
1234 | 1239 | foreach ($values as $value) { |
1235 | 1240 | $latest=write_single($value); |
1236 | 1241 | } |
— | — | @@ -1247,7 +1252,7 @@ |
1248 | 1253 | if (is_null($tableName)) |
1249 | 1254 | throw new Exception("*AttributeCopier: cannot read: table name is null"); |
1250 | 1255 | |
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"); |
1252 | 1257 | } |
1253 | 1258 | |
1254 | 1259 | /** slightly different dup interface yet again. |
— | — | @@ -1325,6 +1330,7 @@ |
1326 | 1331 | * TODO This is a refactor-candidate. |
1327 | 1332 | */ |
1328 | 1333 | public function write($oaos) { |
| 1334 | + $latest=null; |
1329 | 1335 | foreach ($oaos as $oao) { |
1330 | 1336 | $latest=$this->write_single($oao); |
1331 | 1337 | } |