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


PHP CRM_Core_BAO_ConfigSetting::setEnabledComponents方法代碼示例

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


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

示例1: populate

 /**
  * @return bool
  */
 public function populate()
 {
     \Civi\Test::schema()->truncateAll();
     \Civi\Test::schema()->setStrict(FALSE);
     $sqlDir = dirname(dirname(__DIR__)) . "/sql";
     $query2 = file_get_contents("{$sqlDir}/civicrm_data.mysql");
     $query3 = file_get_contents("{$sqlDir}/test_data.mysql");
     $query4 = file_get_contents("{$sqlDir}/test_data_second_domain.mysql");
     if (\Civi\Test::execute($query2) === FALSE) {
         throw new RuntimeException("Cannot load civicrm_data.mysql. Aborting.");
     }
     if (\Civi\Test::execute($query3) === FALSE) {
         throw new RuntimeException("Cannot load test_data.mysql. Aborting.");
     }
     if (\Civi\Test::execute($query4) === FALSE) {
         throw new RuntimeException("Cannot load test_data.mysql. Aborting.");
     }
     unset($query, $query2, $query3);
     \Civi\Test::schema()->setStrict(TRUE);
     // Rebuild triggers
     civicrm_api('system', 'flush', array('version' => 3, 'triggers' => 1));
     \CRM_Core_BAO_ConfigSetting::setEnabledComponents(array('CiviEvent', 'CiviContribute', 'CiviMember', 'CiviMail', 'CiviReport', 'CiviPledge'));
     return TRUE;
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:27,代碼來源:Data.php

示例2: _populateDB

 /**
  * @param bool $perClass
  * @param null $object
  * @return bool
  *   TRUE if the populate logic runs; FALSE if it is skipped
  */
 protected static function _populateDB($perClass = FALSE, &$object = NULL)
 {
     if ($perClass || $object == NULL) {
         $dbreset = TRUE;
     } else {
         $dbreset = $object->requireDBReset();
     }
     if (self::$populateOnce || !$dbreset) {
         return FALSE;
     }
     self::$populateOnce = NULL;
     $dbName = self::getDBName();
     $pdo = self::$utils->pdo;
     // only consider real tables and not views
     $tables = $pdo->query("SELECT table_name FROM INFORMATION_SCHEMA.TABLES\n    WHERE TABLE_SCHEMA = '{$dbName}' AND TABLE_TYPE = 'BASE TABLE'");
     $truncates = array();
     $drops = array();
     foreach ($tables as $table) {
         // skip log tables
         if (substr($table['table_name'], 0, 4) == 'log_') {
             continue;
         }
         // don't change list of installed extensions
         if ($table['table_name'] == 'civicrm_extension') {
             continue;
         }
         if (substr($table['table_name'], 0, 14) == 'civicrm_value_') {
             $drops[] = 'DROP TABLE ' . $table['table_name'] . ';';
         } else {
             $truncates[] = 'TRUNCATE ' . $table['table_name'] . ';';
         }
     }
     $queries = array("USE {$dbName};", "SET foreign_key_checks = 0", "SET SQL_MODE='STRICT_ALL_TABLES';", "SET global innodb_flush_log_at_trx_commit = 2;");
     $queries = array_merge($queries, $truncates);
     $queries = array_merge($queries, $drops);
     foreach ($queries as $query) {
         if (self::$utils->do_query($query) === FALSE) {
             //  failed to create test database
             echo "failed to create test db.";
             exit;
         }
     }
     //  initialize test database
     $sql_file2 = dirname(dirname(dirname(dirname(__FILE__)))) . "/sql/civicrm_data.mysql";
     $sql_file3 = dirname(dirname(dirname(dirname(__FILE__)))) . "/sql/test_data.mysql";
     $sql_file4 = dirname(dirname(dirname(dirname(__FILE__)))) . "/sql/test_data_second_domain.mysql";
     $query2 = file_get_contents($sql_file2);
     $query3 = file_get_contents($sql_file3);
     $query4 = file_get_contents($sql_file4);
     if (self::$utils->do_query($query2) === FALSE) {
         echo "Cannot load civicrm_data.mysql. Aborting.";
         exit;
     }
     if (self::$utils->do_query($query3) === FALSE) {
         echo "Cannot load test_data.mysql. Aborting.";
         exit;
     }
     if (self::$utils->do_query($query4) === FALSE) {
         echo "Cannot load test_data.mysql. Aborting.";
         exit;
     }
     // done with all the loading, get transactions back
     if (self::$utils->do_query("set global innodb_flush_log_at_trx_commit = 1;") === FALSE) {
         echo "Cannot set global? Huh?";
         exit;
     }
     if (self::$utils->do_query("SET foreign_key_checks = 1") === FALSE) {
         echo "Cannot get foreign keys back? Huh?";
         exit;
     }
     unset($query, $query2, $query3);
     // Rebuild triggers
     civicrm_api('system', 'flush', array('version' => 3, 'triggers' => 1));
     CRM_Core_BAO_ConfigSetting::setEnabledComponents(array('CiviEvent', 'CiviContribute', 'CiviMember', 'CiviMail', 'CiviReport', 'CiviPledge'));
     return TRUE;
 }
開發者ID:BorislavZlatanov,項目名稱:civicrm-core,代碼行數:82,代碼來源:CiviUnitTestCase.php


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