Changeset 17649
- Timestamp:
- 09/22/08 13:43:15 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midcom.helper.replicator/exporter/mirror.php
r16786 r17649 23 23 function midcom_helper_replicator_exporter_mirror($subscription) 24 24 { 25 $_MIDCOM->load_library('midcom.helper.reflector'); 25 26 parent::midcom_helper_replicator_exporter($subscription); 26 27 } … … 177 178 { 178 179 $serializations = array(); 179 180 181 if ( $object->metadata->deleted 182 || ( isset($this->_serialize_rewrite_to_delete[$object->guid]) 183 && $this->_serialize_rewrite_to_delete[$object->guid])) 184 { 185 // Object is deleted (either for real or just simulated), return early 186 debug_push_class(__CLASS__, __FUNCTION__); 187 $object_class = get_class($object); 188 debug_add("Object {$object_class} {$object->guid} is deleted, skipping child export", MIDCOM_LOG_INFO); 189 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, "object is deleted, do not try to find child objects, setting exportability explicitly to true", MIDCOM_LOG_INFO); 190 $this->exportability[$object->guid] = true; 191 debug_pop(); 192 return $serializations; 193 } 194 180 195 // In case of a topic we have to check for possible extra dependencies 181 196 if (is_a($object, 'midgard_topic')) … … 185 200 unset($dependency_serializations); 186 201 } 187 202 203 // Then use reflector to check for normally linked children 204 $children = midcom_helper_reflector_tree::get_child_objects($object); 205 if (is_array($children)) 206 { 207 foreach ($children as $child_class => $child_objects) 208 { 209 debug_push_class(__CLASS__, __FUNCTION__); 210 debug_add('Serializing ' . count($child_objects) . " {$child_class} objects"); 211 debug_pop(); 212 foreach ($child_objects as $k => $child_object) 213 { 214 $child_serializations = $this->serialize(&$child_object); 215 if ($child_serializations == false) 216 { 217 debug_push_class(__CLASS__, __FUNCTION__); 218 debug_add("Failed to serialize child {$child_object->guid}", MIDCOM_LOG_WARN); 219 debug_pop(); 220 } 221 else 222 { 223 $serializations = array_merge($serializations, $child_serializations); 224 } 225 unset($child_serializations, $child_objects[$k], $child_object); 226 } 227 unset($child_objects, $children[$child_class]); 228 } 229 } 230 unset($children); 231 188 232 return $serializations; 189 233 } branches/MidCOM_2_8/midcom.helper.replicator/exporter/staging2live.php
r16788 r17649 326 326 } 327 327 328 329 /**330 * Export some children of the object331 *332 * @param midgard_object $object The Object to export parameters of333 * @return array Array of exported objects as XML indexed by GUID334 * @todo rethink child/parent handling335 */336 function serialize_children(&$object)337 {338 //$GLOBALS['midcom_helper_replicator_logger']->log_object($object, "serialize_children called");339 $serializations = array();340 if ( $object->metadata->deleted341 || ( isset($this->_serialize_rewrite_to_delete[$object->guid])342 && $this->_serialize_rewrite_to_delete[$object->guid]))343 {344 // Object is deleted (either for real or just simulated), return early345 debug_push_class(__CLASS__, __FUNCTION__);346 $object_class = get_class($object);347 debug_add("Object {$object_class} {$object->guid} is deleted, skipping child export", MIDCOM_LOG_INFO);348 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, "object is deleted, do not try to find child objects, setting exportability explicitly to true", MIDCOM_LOG_INFO);349 $this->exportability[$object->guid] = true;350 debug_pop();351 return $serializations;352 }353 354 // In case of a topic we have to check for possible extra dependencies355 if (is_a($object, 'midgard_topic'))356 {357 $dependency_serializations = $this->serialize_component_dependencies(&$object);358 $serializations = array_merge($serializations, $dependency_serializations);359 unset($dependency_serializations);360 }361 362 return $serializations;363 }364 328 } 365 329 ?>
