瀏覽代碼

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1928 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 年之前
父節點
當前提交
4ddb1ae304
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      synchro/synchrodatasource.class.inc.php

+ 8 - 4
synchro/synchrodatasource.class.inc.php

@@ -1506,11 +1506,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();