Преглед на файлове

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.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2186 a333f486-631f-4898-b8df-5754b55c2be0
dflaven преди 12 години
родител
ревизия
0d36b281fb
променени са 2 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 9 0
      core/config.class.inc.php
  2. 1 1
      synchro/synchrodatasource.class.inc.php

+ 9 - 0
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)

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