Enhancement: added a new (hidden) configuration setting 'synchro_prevent_delete_all' (default to true) to deactivate the "safety belt" and allow the deletion of all replicas of a synchro task in one go.

SVN:trunk[2186]
This commit is contained in:
Denis Flaven
2012-09-17 17:12:43 +00:00
parent 645b2f5ad8
commit 308f40c11b
2 changed files with 10 additions and 1 deletions

View File

@@ -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)

View File

@@ -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'));
}