diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 914fd9c9f8..864e76010b 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -519,6 +519,15 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ), + 'synchro_prevent_delete_all' => array( + 'type' => 'bool', + 'description' => 'Stop the synchro if all the replicas of a data source become obsolete at the same time.', + // examples... not used + 'default' => true, + 'value' => true, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), ); public function IsProperty($sPropCode) diff --git a/synchro/synchrodatasource.class.inc.php b/synchro/synchrodatasource.class.inc.php index 00d7c70279..302b2095f3 100644 --- a/synchro/synchrodatasource.class.inc.php +++ b/synchro/synchrodatasource.class.inc.php @@ -2571,7 +2571,7 @@ class SynchroExecution $sSelectToObsolete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('new', 'synchronized', 'modified', 'orphan') AND status_last_seen < :last_import"; $oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array() /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos)); $iCountScope = $oSetScope->Count(); - if (($this->m_iCountAllReplicas > 10) && ($this->m_iCountAllReplicas == $iCountScope)) + if (($this->m_iCountAllReplicas > 10) && ($this->m_iCountAllReplicas == $iCountScope) && MetaModel::GetConfig()->Get('synchro_prevent_delete_all')) { throw new SynchroExceptionNotStarted(Dict::S('Core:SyncTooManyMissingReplicas')); }