Bug fix: to do not try to access a DataSource while it's being deleted

SVN:1.2.1[1930]
This commit is contained in:
Denis Flaven
2012-03-27 11:32:51 +00:00
parent 42f355a592
commit 198898ada4

View File

@@ -1168,6 +1168,7 @@ class SynchroAttLinkSet extends SynchroAttribute
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("row_separator", array("allowed_values"=>null, "sql"=>"row_separator", "default_value"=>'|', "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("attribute_separator", array("allowed_values"=>null, "sql"=>"attribute_separator", "default_value"=>';', "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("value_separator", array("allowed_values"=>null, "sql"=>"value_separator", "default_value"=>':', "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("attribute_qualifier", array("allowed_values"=>null, "sql"=>"attribute_qualifier", "default_value"=>'\'', "is_null_allowed"=>true, "depends_on"=>array())));
@@ -1460,11 +1461,15 @@ class SynchroReplica extends DBObject implements iDisplay
if (!MetaModel::DBIsReadOnly())
{
$oDataSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'));
$sTable = $oDataSource->GetDataTable();
$oDataSource = MetaModel::GetObject('SynchroDataSource', $this->Get('sync_source_id'), false);
if ($oDataSource)
{
$sTable = $oDataSource->GetDataTable();
$sSQL = "DELETE FROM `$sTable` WHERE id = '{$this->GetKey()}'";
CMDBSource::Query($sSQL);
$sSQL = "DELETE FROM `$sTable` WHERE id = '{$this->GetKey()}'";
CMDBSource::Query($sSQL);
}
// else the whole datasource has probably been already deleted
}
$this->AfterDelete();
@@ -2669,4 +2674,4 @@ class SynchroExecution
new OQLMenuNode('DataSources', 'SELECT SynchroDataSource', $oAdminMenu->GetIndex(), 12 /* fRank */, true, 'SynchroDataSource', UR_ACTION_MODIFY, UR_ALLOWED_YES);
// new OQLMenuNode('Replicas', 'SELECT SynchroReplica', $oAdminMenu->GetIndex(), 12 /* fRank */, true, 'SynchroReplica', UR_ACTION_MODIFY, UR_ALLOWED_YES);
// new WebPageMenuNode('Test:RunSynchro', '../synchro/synchro_exec.php', $oAdminMenu->GetIndex(), 13 /* fRank */, 'SynchroDataSource');
?>
?>