Changeset 19873
- Timestamp:
- 12/18/08 15:48:14 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/thor/midcom/midcom.helper.replicator/config/config.inc
r18844 r19873 6 6 'midcom_core_login_session_db', 7 7 'midcom_core_temporary_object_db', 8 ), 8 ), 9 9 'exporter_staging2live_delete_unapproved' => false, // Upon explicit un-approve, do we wish to delete from live ?? 10 // TODO: http://trac.midgard-project.org/ticket/558 10 11 'exporter_staging2live_check_approvals_for' => array 11 12 ( 12 'midgard_topic', 13 'midgard_article', 14 'midgard_style', 15 'midgard_element', // Style-elements 16 'midgard_snippetdir', 17 'midgard_snippet', 18 'net_nemein_calendar_event', 13 'midgard_parameter' => 'parent', 14 'midgard_attachment' => 'parent', 15 'midgard_topic' => 'object', 16 'midgard_article' => 'object', 17 'midgard_style' => 'object', 18 'midgard_element' => 'object', // Style-elements 19 'midgard_snippetdir' => 'object', 20 'midgard_snippet' => 'object', 21 'net_nemein_calendar_event' => 'object', 22 'org_routamc_positioning_location' => 'parent', 19 23 ), 20 24 'exporter_staging2live_typefilter_pass_types' => array branches/thor/midcom/midcom.helper.replicator/exporter/mirror.php
r17649 r19873 263 263 264 264 // Traverse parent tree as well 265 $parent = $object->get_parent();265 $parent = midcom_helper_reflector_tree::get_parent($object); 266 266 if (is_object($parent)) 267 267 { branches/thor/midcom/midcom.helper.replicator/exporter/staging2live.php
r18462 r19873 245 245 /* Objects to check approvals for */ 246 246 $approvals_check_continue = false; 247 foreach ($this->check_approvals_for as $class) 248 { 247 $approvals_check_type = 'object'; 248 foreach ($this->check_approvals_for as $class => $check_type) 249 { 250 // Safety for old format config 251 if (is_numeric($class)) 252 { 253 debug_push_class(__CLASS__, __FUNCTION__); 254 debug_add('Old format "exporter_staging2live_check_approvals_for" -configuration detected, please reconfigure according to example from config.inc', MIDCOM_LOG_WARN); 255 debug_pop(); 256 unset($this->check_approvals_for[$class]); 257 $class = $check_type; 258 $this->check_approvals_for[$class] = 'object'; 259 $check_type = $this->check_approvals_for[$class]; 260 } 249 261 if (is_a($object, $class)) 250 262 { 251 263 $approvals_check_continue = true; 264 $approvals_check_type = $check_type; 252 265 break; 253 266 } … … 256 269 { 257 270 $object_class = get_class($object); 258 $msg = "Not checking a pprovals for class {$object_class}";271 $msg = "Not checking any approvals for class {$object_class}"; 259 272 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, $msg); 260 273 debug_add($msg); … … 263 276 } 264 277 278 // Workaround a corner case 265 279 if ( is_a($object, 'midgard_article') 266 280 && !empty($object->up)) 267 281 { 268 // Child articles don't currently have anyapproval UI, skip approval for them (but do check parent below)282 // Child articles don't currently have sensible approval UI, skip approval for them (but do check parent below) 269 283 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Reply article, not checking approval status', MIDCOM_LOG_INFO); 284 // PONDER: Is this really neccessary ? 270 285 $this->exportability[$object->guid] = true; 271 286 } 272 elseif ($object->metadata->revised > $object->metadata->approved) 273 { 274 // FIXME: use metadata service (?) 275 // Not approved since last update 276 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Object could not be exported for replication because it\'s not approved', MIDCOM_LOG_INFO); 277 $this->exportability[$object->guid] = false; 287 else 288 { 289 switch ($approvals_check_type) 290 { 291 case 'parent': 292 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Checking only parent approval', MIDCOM_LOG_INFO); 293 // PONDER: Is this really neccessary ? 294 $this->exportability[$object->guid] = true; 295 break; 296 default: 297 case 'object': 298 if ($object->metadata->revised > $object->metadata->approved) 299 { 300 // FIXME: use metadata service (?) 301 // Not approved since last update 302 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Object could not be exported for replication because it\'s not approved', MIDCOM_LOG_INFO); 303 $this->exportability[$object->guid] = false; 304 } 305 break; 306 } 278 307 } 279 308 … … 281 310 { 282 311 // Check the parent also, as that may be unapproved 283 $parent = $object->get_parent();312 $parent = midcom_helper_reflector_tree::get_parent($object); 284 313 if ( is_object($parent) 285 314 && isset($parent->guid) … … 294 323 if (empty($parent_check_stack)) 295 324 { 296 // Empty stack means we're not inside parent recursion, thus we can raise an UIMessage 297 $ref = new midcom_helper_reflector($object); 298 $_MIDCOM->uimessages->add 299 ( 300 $this->_l10n->get('midcom.helper.replicator'), 301 sprintf 325 if ($approvals_check_type !== 'parent') 326 { 327 // Empty stack means we're not inside parent recursion, thus we can raise an UIMessage 328 $ref = new midcom_helper_reflector($object); 329 $_MIDCOM->uimessages->add 302 330 ( 303 $this->_l10n->get('%s %s could not be exported for replication because one of its parents is not approved'), 304 $ref->get_class_label(), 305 $ref->get_object_label($object) 306 ), 307 'warning' 308 ); 309 unset($ref); 331 $this->_l10n->get('midcom.helper.replicator'), 332 sprintf 333 ( 334 $this->_l10n->get('%s %s could not be exported for replication because one of its parents is not approved'), 335 $ref->get_class_label(), 336 $ref->get_object_label($object) 337 ), 338 'warning' 339 ); 340 unset($ref); 341 } 310 342 $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Object could not be exported for replication because one of its parents is not approved', MIDCOM_LOG_WARN); 311 343 }
