/** * Upgrade 1001 - add civicrm_segment_tree * * @return TRUE on success * @throws Exception */ public function upgrade_1001() { $this->ctx->log->info('Applying update 1001'); CRM_Core_DAO::executeQuery("CREATE TABLE IF NOT EXISTS civicrm_segment_tree (id INT UNSIGNED NOT NULL)"); CRM_Contactsegment_BAO_Segment::buildSegmentTree(); return TRUE; }
/** * Implementation of hook civicrm_pre * to rebuild segment tree when segment is deleted * * @param string $op * @param string $objectName * @param int $objectId * @param array $params * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pre */ function contactsegment_civicrm_pre($op, $objectName, $objectId, &$params) { if ($objectName == "Segment" && $op == "delete") { CRM_Contactsegment_BAO_Segment::buildSegmentTree(); } }