コード例 #1
0
 public function GetSynchroReplicaFlags($sAttCode, &$aReason)
 {
     $iFlags = OPT_ATT_NORMAL;
     $oSet = $this->GetMasterReplica();
     while ($aData = $oSet->FetchAssoc()) {
         if ($aData['datasource']->GetKey() == SynchroExecution::GetCurrentTaskId()) {
             // Ignore the current task (check to write => ok)
             continue;
         }
         // Assumption: $aData['datasource'] will not be null because the data source id is always set...
         $oReplica = $aData['replica'];
         $oSource = $aData['datasource'];
         $oAttrSet = $oSource->Get('attribute_list');
         while ($oSyncAttr = $oAttrSet->Fetch()) {
             if ($oSyncAttr->Get('attcode') == $sAttCode && $oSyncAttr->Get('update') == 1 && $oSyncAttr->Get('update_policy') == 'master_locked') {
                 $iFlags |= OPT_ATT_SLAVE;
                 $sUrl = $oSource->GetApplicationUrl($this, $oReplica);
                 $aReason[] = array('name' => $oSource->GetName(), 'description' => $oSource->Get('description'), 'url_application' => $sUrl);
             }
         }
     }
     return $iFlags;
 }
コード例 #2
0
 public function GetSynchroReplicaFlags($sAttCode, &$aReason)
 {
     $iFlags = OPT_ATT_NORMAL;
     foreach ($this->GetSynchroData() as $iSourceId => $aSourceData) {
         if ($iSourceId == SynchroExecution::GetCurrentTaskId()) {
             // Ignore the current task (check to write => ok)
             continue;
         }
         // Assumption: one replica - take the first one!
         $oReplica = reset($aSourceData['replica']);
         $oSource = $aSourceData['source'];
         if (array_key_exists($sAttCode, $aSourceData['attributes'])) {
             $oSyncAttr = $aSourceData['attributes'][$sAttCode];
             if ($oSyncAttr->Get('update') == 1 && $oSyncAttr->Get('update_policy') == 'master_locked') {
                 $iFlags |= OPT_ATT_SLAVE;
                 $sUrl = $oSource->GetApplicationUrl($this, $oReplica);
                 $aReason[] = array('name' => $oSource->GetName(), 'description' => $oSource->Get('description'), 'url_application' => $sUrl);
             }
         }
     }
     return $iFlags;
 }