public function reconcileUnknownModules() { $knownModules = array(); if (array_key_exists(0, $this->moduleIndex) && is_array($this->moduleIndex[0])) { $knownModules = array_merge($knownModules, array_keys($this->moduleIndex[0])); } if (array_key_exists(1, $this->moduleIndex) && is_array($this->moduleIndex[1])) { $knownModules = array_merge($knownModules, array_keys($this->moduleIndex[1])); } $dao = new CRM_Core_DAO_Managed(); if (!empty($knownModules)) { $in = CRM_Core_DAO::escapeStrings($knownModules); $dao->whereAdd("module NOT IN ({$in})"); } $dao->find(); while ($dao->fetch()) { $params = array('version' => 3, 'id' => $dao->entity_id); $result = civicrm_api($dao->entity_type, 'delete', $params); if ($result['is_error']) { $this->onApiError($params, $result); } CRM_Core_DAO::executeQuery('DELETE FROM civicrm_managed WHERE id = %1', array(1 => array($dao->id, 'Integer'))); } }
public function reconcileUnknownModules() { $knownModules = array(); if (array_key_exists(0, $this->moduleIndex) && is_array($this->moduleIndex[0])) { $knownModules = array_merge($knownModules, array_keys($this->moduleIndex[0])); } if (array_key_exists(1, $this->moduleIndex) && is_array($this->moduleIndex[1])) { $knownModules = array_merge($knownModules, array_keys($this->moduleIndex[1])); } $dao = new CRM_Core_DAO_Managed(); if (!empty($knownModules)) { $in = CRM_Core_DAO::escapeStrings($knownModules); $dao->whereAdd("module NOT IN ({$in})"); } $dao->find(); while ($dao->fetch()) { $this->removeStaleEntity($dao); } }