當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_DAO::dropTriggers方法代碼示例

本文整理匯總了PHP中CRM_Core_DAO::dropTriggers方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO::dropTriggers方法的具體用法?PHP CRM_Core_DAO::dropTriggers怎麽用?PHP CRM_Core_DAO::dropTriggers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_DAO的用法示例。


在下文中一共展示了CRM_Core_DAO::dropTriggers方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Perform an upgrade without using the web-frontend
  *
  * @param bool $enablePrint
  *
  * @throws Exception
  * @return array, with keys:
  *   - message: string, HTML-ish blob
  */
 public function run($enablePrint = TRUE)
 {
     // lets get around the time limit issue if possible for upgrades
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     $upgrade = new CRM_Upgrade_Form();
     list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
     if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
         throw new Exception($error);
     }
     // Disable our SQL triggers
     CRM_Core_DAO::dropTriggers();
     // CRM-11156
     $preUpgradeMessage = NULL;
     $upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
     $postUpgradeMessageFile = CRM_Utils_File::tempnam('civicrm-post-upgrade');
     $queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile)));
     $queueResult = $queueRunner->runAll();
     if ($queueResult !== TRUE) {
         $errorMessage = CRM_Core_Error::formatTextException($queueResult['exception']);
         CRM_Core_Error::debug_log_message($errorMessage);
         if ($enablePrint) {
             print $errorMessage;
         }
         throw $queueResult['exception'];
         // FIXME test
     }
     CRM_Upgrade_Form::doFinish();
     $message = file_get_contents($postUpgradeMessageFile);
     return array('latestVer' => $latestVer, 'message' => $message, 'text' => CRM_Utils_String::htmlToText($message));
 }
開發者ID:kcristiano,項目名稱:civicrm-core,代碼行數:41,代碼來源:Headless.php

示例2: DataModelImprovements_Change_Entity

function DataModelImprovements_Change_Entity($custom_group_id, $contact_type)
{
    $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $custom_group_id, 'table_name');
    CRM_Core_DAO::dropTriggers($tableName);
    echo "- Delete custom data set with id {$custom_group_id} for organistions that are not of type '{$contact_type}'\n";
    $query = "DELETE cd\n        FROM {$tableName} AS cd\n        JOIN civicrm_contact AS c ON c.id=cd.entity_id\n        WHERE c.contact_type!='{$contact_type}'";
    CRM_Core_DAO::singleValueQuery($query);
    echo "- Set the custom data group to only extend individuals\n";
    $query = "\n        UPDATE civicrm_custom_group\n        SET extends = '{$contact_type}'\n        WHERE id = {$custom_group_id}";
    CRM_Core_DAO::singleValueQuery($query);
    CRM_Core_DAO::triggerRebuild($tableName);
}
開發者ID:JSProffitt,項目名稱:civicrm-website-org,代碼行數:12,代碼來源:Run.php

示例3: runBegin

 /**
  * Begin the upgrade by building a queue of tasks and redirecting to the queue-runner
  */
 public function runBegin()
 {
     $upgrade = new CRM_Upgrade_Form();
     list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
     if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
         CRM_Core_Error::fatal($error);
     }
     $config = CRM_Core_Config::singleton();
     $postUpgradeMessage = '<span class="bold">' . ts('Congratulations! Your upgrade was successful!') . '</span>';
     // lets drop all the triggers here
     CRM_Core_DAO::dropTriggers();
     $this->set('isUpgradePending', TRUE);
     // Persistent message storage across upgrade steps. TODO: Use structured message store
     // Note: In clustered deployments, this file must be accessible by all web-workers.
     $this->set('postUpgradeMessageFile', CRM_Utils_File::tempnam('civicrm-post-upgrade'));
     file_put_contents($this->get('postUpgradeMessageFile'), $postUpgradeMessage);
     $queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $this->get('postUpgradeMessageFile')), 'isMinimal' => TRUE, 'pathPrefix' => 'civicrm/upgrade/queue', 'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE), 'buttons' => array('retry' => $config->debug, 'skip' => $config->debug)));
     $queueRunner->runAllViaWeb();
     CRM_Core_Error::fatal(ts('Upgrade failed to redirect'));
 }
開發者ID:rameshrr99,項目名稱:civicrm-core,代碼行數:23,代碼來源:Upgrade.php

示例4: deleteCustomRowsOfSubtype

 /**
  * Delete content / rows of a custom table specific to a subtype for a given custom-group.
  * This function currently works for contact subtypes only and could be later improved / genralized
  * to work for other subtypes as well.
  *
  * @param int $gID
  *   Custom group id.
  * @param array $subtypes
  *   List of subtypes related to which entry is to be removed.
  *
  * @return void
  */
 public static function deleteCustomRowsOfSubtype($gID, $subtypes = array())
 {
     if (!$gID or empty($subtypes)) {
         return FALSE;
     }
     $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $gID, 'table_name');
     // drop triggers CRM-13587
     CRM_Core_DAO::dropTriggers($tableName);
     $subtypeClause = array();
     foreach ($subtypes as $subtype) {
         $subtype = CRM_Utils_Type::escape($subtype, 'String');
         $subtypeClause[] = "civicrm_contact.contact_sub_type LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR . "%'";
     }
     $subtypeClause = implode(' OR ', $subtypeClause);
     $query = "DELETE custom.*\nFROM {$tableName} custom\nINNER JOIN civicrm_contact ON civicrm_contact.id = custom.entity_id\nWHERE ({$subtypeClause})";
     CRM_Core_DAO::singleValueQuery($query);
     // rebuild triggers CRM-13587
     CRM_Core_DAO::triggerRebuild($tableName);
 }
開發者ID:BorislavZlatanov,項目名稱:civicrm-core,代碼行數:31,代碼來源:ContactType.php


注:本文中的CRM_Core_DAO::dropTriggers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。