Changeset 22751
- Timestamp:
- 06/30/09 18:05:47 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ragnaroek/midcom/midcom.core/midcom/baseclasses/core/dbobject.php
r22723 r22751 106 106 debug_push_class($object, __FUNCTION__); 107 107 108 if ($object->_use_rcs) 108 if ( $GLOBALS['midcom_config']['midcom_services_rcs_enable'] 109 && $object->_use_rcs) 109 110 { 110 111 $rcs =& $_MIDCOM->get_service('rcs'); … … 423 424 { 424 425 $tmp = new $object->__mgdschema_class_name__(); 425 if (! $tmp->get_by_id($object->id)) 426 if ( !$object->id 427 || !$tmp->get_by_id($object->id)) 426 428 { 427 429 debug_push_class($object, __FUNCTION__); 428 debug_add('Workaround for #72/#118 , failed to get_by_id to load the GUID, this is bad. We abort.',430 debug_add('Workaround for #72/#118/#1251, failed to get_by_id to load the GUID, this is bad. We abort.', 429 431 MIDCOM_LOG_CRIT); 430 432 debug_add("We tried to load object {$object->id} and got: " . midgard_connection::get_error_string()); 431 433 $object->delete(); 432 434 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 433 'Workaround for #72/#118: Failed to load GUID for ID {$object->id} ('435 "Workaround for #72/#118/#1251: Failed to load GUID for ID {$object->id} (" 434 436 . midgard_connection::get_error_string() 435 437 . '). Object could not be created.'); … … 447 449 $object->_on_created(); 448 450 $_MIDCOM->componentloader->trigger_watches(MIDCOM_OPERATION_DBA_CREATE, $object); 449 if ($object->_use_rcs) 451 if ( $GLOBALS['midcom_config']['midcom_services_rcs_enable'] 452 && $object->_use_rcs) 450 453 { 451 454 $rcs =& $_MIDCOM->get_service('rcs'); … … 478 481 function delete_pre_checks(&$object) 479 482 { 483 if (!$object->id) 484 { 485 debug_push_class($object, __FUNCTION__); 486 debug_add("Failed to delete object, object " . get_class($object) . " is non-persistent (empty ID).", MIDCOM_LOG_ERROR); 487 debug_pop(); 488 return false; 489 } 490 480 491 // Current language is not zero, selective delete to prevent deleting too much of objects. 481 492 // Object will not be deleted if it doesn't have a language property at all or if its … … 682 693 $object->_on_deleted(); 683 694 $_MIDCOM->componentloader->trigger_watches(MIDCOM_OPERATION_DBA_DELETE, $object); 684 if ($object->_use_rcs) 695 if ( $GLOBALS['midcom_config']['midcom_services_rcs_enable'] 696 && $object->_use_rcs) 685 697 { 686 698 $rcs =& $_MIDCOM->get_service('rcs'); … … 1282 1294 function get_by_id(&$object, $id) 1283 1295 { 1296 if (!$id) 1297 { 1298 debug_push_class($object, __FUNCTION__); 1299 debug_add("Failed to load " . get_class($object) . " object, incorrect ID provided.", MIDCOM_LOG_ERROR); 1300 self::_clear_object($object); 1301 debug_pop(); 1302 return false; 1303 } 1304 1284 1305 if ( !isset($object->__object) 1285 1306 || !$object->__object)
