本文整理汇总了PHP中CRM_Core_BAO_ConfigSetting类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_ConfigSetting类的具体用法?PHP CRM_Core_BAO_ConfigSetting怎么用?PHP CRM_Core_BAO_ConfigSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_BAO_ConfigSetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$this->loadAllFixtures();
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
}
示例2: verifyPreDBState
/**
* @param $errorMessage
*
* @return bool
*/
function verifyPreDBState(&$errorMessage)
{
$errorMessage = ts('Pre-condition failed for upgrade step %1.', array(1 => '4'));
if (CRM_Core_DAO::checkTableExists('civicrm_event_page')) {
return FALSE;
}
// check fields which MUST be present if a proper 2.2 db
if (!CRM_Core_DAO::checkFieldExists('civicrm_event', 'intro_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'footer_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_title') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_footer_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_email_confirm') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_email_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_from_name') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_from_email') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'cc_confirm') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'bcc_confirm') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'default_fee_id') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'default_discount_id') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_title') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_footer_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_pay_later') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'pay_later_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'pay_later_receipt') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_multiple_registrations')) {
// db looks to have stuck somewhere between 2.1 & 2.2
$errorMessage .= ' Few important fields were found missing in some of the tables.';
return FALSE;
}
if ($this->checkVersion('2.1.103')) {
$this->setVersion('2.2');
} else {
return FALSE;
}
// update config defaults
$domain = new CRM_Core_DAO_Domain();
$domain->selectAdd();
$domain->selectAdd('config_backend');
$domain->find(TRUE);
if ($domain->config_backend) {
$defaults = unserialize($domain->config_backend);
// reset components
$defaults['enableComponents'] = array('CiviContribute', 'CiviPledge', 'CiviMember', 'CiviEvent', 'CiviMail');
$defaults['enableComponentIDs'] = array(1, 6, 2, 3, 4);
$defaults['moneyvalueformat'] = '%!i';
$defaults['fieldSeparator'] = ',';
$defaults['fatalErrorTemplate'] = 'CRM/common/fatal.tpl';
// serialise settings
CRM_Core_BAO_ConfigSetting::add($defaults);
}
return $this->checkVersion('2.2');
}
示例3: upgrade_4_1_alpha1
function upgrade_4_1_alpha1($rev)
{
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
if (!CRM_Case_BAO_Case::createCaseViews()) {
$template = CRM_Core_Smarty::singleton();
$afterUpgradeMessage = '';
if ($afterUpgradeMessage = $template->get_template_vars('afterUpgradeMessage')) {
$afterUpgradeMessage .= "<br/><br/>";
}
$afterUpgradeMessage .= '<div class="crm-upgrade-case-views-error" style="background-color: #E43D2B; padding: 10px;">' . ts("There was a problem creating CiviCase database views. Please create the following views manually before using CiviCase:");
$afterUpgradeMessage .= '<div class="crm-upgrade-case-views-query"><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('upcoming') . '</div><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('recent') . '</div>' . '</div></div>';
$template->assign('afterUpgradeMessage', $afterUpgradeMessage);
}
}
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
$this->transferPreferencesToSettings();
$this->createNewSettings();
// now modify the config so that the directories are now stored in the settings table
// CRM-8780
$params = array();
CRM_Core_BAO_ConfigSetting::add($params);
// also reset navigation
CRM_Core_BAO_Navigation::resetNavigation();
}
示例4: hrprofile_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrprofile_civicrm_install()
{
$groups = CRM_Core_PseudoConstant::get('CRM_Core_BAO_UFField', 'uf_group_id', array('labelColumn' => 'name'));
$profileId = array_search('hrstaffdir_listing', $groups);
$path = array('url' => "civicrm/profile?reset=1&gid={$profileId}&force=1");
$navigationPath = CRM_Core_BAO_Navigation::retrieve($path, $defaultpath);
if ($profileId && $navigationPath) {
$originalUrl = "civicrm/profile?reset=1&gid={$profileId}&force=1";
$updatedUrl = "civicrm/profile/table?reset=1&gid={$profileId}&force=1";
hrprofile_updateNavigation($originalUrl, $updatedUrl);
} elseif ($profileId && !$navigationPath) {
// add to navigation
$navigationParams = array('label' => 'Directory', 'url' => "civicrm/profile/table?reset=1&gid={$profileId}&force=1", 'is_active' => 1);
$navigation = CRM_Core_BAO_Navigation::add($navigationParams);
CRM_Core_BAO_Navigation::resetNavigation();
// set the profile as search view
$params = array();
CRM_Core_BAO_ConfigSetting::retrieve($params);
if (!empty($params)) {
$params['defaultSearchProfileID'] = $profileId;
CRM_Core_BAO_ConfigSetting::create($params);
}
}
return _hrprofile_civix_civicrm_install();
}
示例5: setUp
public function setUp()
{
parent::setUp();
$this->tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_case_type', 'civicrm_activity_contact', 'civicrm_managed', 'civicrm_relationship', 'civicrm_relationship_type');
$this->quickCleanup($this->tablesToTruncate);
$this->loadAllFixtures();
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
}
示例6: setDefaultValues
function setDefaultValues()
{
if (!$this->_defaults) {
parent::setDefaultValues();
$config = CRM_Core_Config::singleton();
list($this->_defaults['newBaseURL'], $this->_defaults['newBaseDir'], $this->_defaults['newSiteName']) = CRM_Core_BAO_ConfigSetting::getBestGuessSettings();
}
return $this->_defaults;
}
示例7: run
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
*/
function run()
{
session_start();
require_once '../../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
// this does not return on failure
CRM_Utils_System::authenticateScript(TRUE);
require_once 'CRM/Core/BAO/ConfigSetting.php';
$moveStatus = CRM_Core_BAO_ConfigSetting::doSiteMove();
echo $moveStatus . '<br />';
echo ts("If no errors are displayed above, the site move steps have completed successfully. Please visit <a href=\"{$config->userFrameworkBaseURL}\">your moved site</a> and test the move.");
}
示例8: testToggleComponent
public function testToggleComponent()
{
$origNames = array();
foreach (CRM_Core_Component::getEnabledComponents() as $c) {
$origNames[] = $c->name;
}
$this->assertTrue(!in_array('CiviCase', $origNames));
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
$newNames = array();
foreach (CRM_Core_Component::getEnabledComponents() as $c) {
$newNames[] = $c->name;
}
$this->assertTrue(in_array('CiviCase', $newNames));
$this->assertEquals(count($newNames), count($origNames) + 1);
}
示例9: postProcess
public function postProcess()
{
if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) {
$config = CRM_Core_Config::singleton();
// cleanup templates_c directory
$config->cleanup(1, FALSE);
// clear all caches
CRM_Core_Config::clearDBCache();
CRM_Utils_System::flushCache();
parent::rebuildMenu();
CRM_Core_BAO_WordReplacement::rebuild();
CRM_Core_Session::setStatus(ts('Cache has been cleared and menu has been rebuilt successfully.'), ts("Success"), "success");
}
if (!empty($_POST['_qf_UpdateConfigBackend_next_resetpaths'])) {
$msg = CRM_Core_BAO_ConfigSetting::doSiteMove();
CRM_Core_Session::setStatus($msg, ts("Success"), "success");
}
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/setting/updateConfigBackend', 'reset=1'));
}
示例10: setUp
public function setUp()
{
parent::setUp();
/** @var $hooks \CRM_Utils_Hook_UnitTests */
$hooks = \CRM_Utils_Hook::singleton();
$hooks->setHook('civicrm_caseTypes', array($this, 'hook_caseTypes'));
\CRM_Case_XMLRepository::singleton(TRUE);
\CRM_Case_XMLProcessor::flushStaticCaches();
// CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
//. Using XML was causing breakage as id numbers were changing over time
// & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
// state where tests could run afterwards without re-loading.
$this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_status', 'format.only_id' => 1));
$optionValues = array('Medical evaluation' => 'Medical evaluation', 'Mental health evaluation' => "Mental health evaluation", 'Secure temporary housing' => 'Secure temporary housing', 'Long-term housing plan' => 'Long-term housing plan', 'ADC referral' => 'ADC referral', 'Income and benefits stabilization' => 'Income and benefits stabilization');
foreach ($optionValues as $name => $label) {
$activityTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => 2, 'name' => $name, 'label' => $label, 'component_id' => 7));
// store for cleanup
$this->optionValues[] = $activityTypes['id'];
}
// We used to be inconsistent about "HousingSupport" vs "housing_support".
// Now, the rule is simply: use the "name" from "civicrm_case_type.name".
$this->caseType = 'housing_support';
$this->caseTypeId = 1;
$this->tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_case_type', 'civicrm_activity_contact', 'civicrm_managed', 'civicrm_relationship', 'civicrm_relationship_type');
$this->quickCleanup($this->tablesToTruncate);
$this->loadAllFixtures();
// enable the default custom templates for the case type xml files
$this->customDirectories(array('template_path' => TRUE));
// case is not enabled by default
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
// create a logged in USER since the code references it for source_contact_id
$this->createLoggedInUser();
$session = CRM_Core_Session::singleton();
$this->_loggedInUser = $session->get('userID');
/// note that activityType options are cached by the FULL set of options you pass in
// ie. because Activity api includes campaign in it's call cache is not flushed unless
// included in this call. Also note flush function doesn't work on this property as it sets to null not empty array
CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
}
示例11: 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;
}
示例12: verifyPreDBState
function verifyPreDBState(&$errorMessage)
{
$config = CRM_Core_Config::singleton();
// Let's first update the config defaults
$domain = new CRM_Core_DAO_Domain();
$domain->selectAdd();
$domain->selectAdd('config_backend');
$domain->find(TRUE);
if ($domain->config_backend) {
$defaults = unserialize($domain->config_backend);
// reset components
$defaults['enableComponents'] = array('CiviContribute', 'CiviPledge', 'CiviMember', 'CiviEvent', 'CiviMail');
$defaults['enableComponentIDs'] = array(1, 6, 2, 3, 4);
$defaults['moneyvalueformat'] = '%!i';
$defaults['fieldSeparator'] = ',';
$defaults['fatalErrorTemplate'] = 'CRM/common/fatal.tpl';
// update cms-version
if ($config->userFramework == 'Joomla') {
$defaults['userFrameworkVersion'] = '1.5';
if (class_exists('JVersion')) {
$version = new JVersion();
$defaults['userFrameworkVersion'] = $version->getShortVersion();
}
} elseif ($config->userSystem->is_drupal) {
$defaults['userFrameworkVersion'] = '6.3';
if (defined('VERSION')) {
$defaults['userFrameworkVersion'] = VERSION;
}
}
// serialise settings
CRM_Core_BAO_ConfigSetting::add($defaults);
$config = CRM_Core_Config::singleton();
}
// check if log file is writable
if (!is_writable($config->uploadDir . 'CiviCRM.log')) {
$errorMessage = ts('Log file CiviCRM.log is not writable. Make sure files directory is writable.', array(1 => $config->uploadDir));
return FALSE;
}
$errorMessage = ts('Database check failed - the current database is not v2.0.');
$is20db = TRUE;
// abort if partial upgraded db found.
if ($this->checkVersion('2.01') || $this->checkVersion('2.02') || $this->checkVersion('2.03')) {
$errorMessage = ts('Corrupt / Partial Upgraded database found. Looks like upgrade wizard failed to complete all the required steps to convert your database to v2.1. Please fix any errors and start the upgrade process again with a clean v2.0 database.');
return FALSE;
}
// abort if already 2.1
if ($this->checkVersion('2.1')) {
$errorMessage = ts('Database check failed - looks like you have already upgraded to the latest version (v2.1) of the database.');
return FALSE;
}
// check if 2.0 version
if (!$this->checkVersion('2.0')) {
$is20db = FALSE;
}
// check if 2.0 tables exists
if (!CRM_Core_DAO::checkTableExists('civicrm_activity') || !CRM_Core_DAO::checkTableExists('civicrm_activity_assignment') || !CRM_Core_DAO::checkTableExists('civicrm_activity_target') || !CRM_Core_DAO::checkTableExists('civicrm_address') || !CRM_Core_DAO::checkTableExists('civicrm_address') || !CRM_Core_DAO::checkTableExists('civicrm_case') || !CRM_Core_DAO::checkTableExists('civicrm_case_activity') || !CRM_Core_DAO::checkTableExists('civicrm_component') || !CRM_Core_DAO::checkTableExists('civicrm_contribution_widget') || !CRM_Core_DAO::checkTableExists('civicrm_grant') || !CRM_Core_DAO::checkTableExists('civicrm_group_nesting') || !CRM_Core_DAO::checkTableExists('civicrm_group_organization') || !CRM_Core_DAO::checkTableExists('civicrm_loc_block') || !CRM_Core_DAO::checkTableExists('civicrm_openid') || !CRM_Core_DAO::checkTableExists('civicrm_openid_associations') || !CRM_Core_DAO::checkTableExists('civicrm_openid_nonces') || !CRM_Core_DAO::checkTableExists('civicrm_preferences_date') || !CRM_Core_DAO::checkTableExists('civicrm_tell_friend') || !CRM_Core_DAO::checkTableExists('civicrm_timezone') || !CRM_Core_DAO::checkTableExists('civicrm_worldregion')) {
// db is not 2.0
$errorMessage .= ' Few 2.0 tables were found missing.';
$is20db = FALSE;
}
// check fields which MUST be present if a proper 2.0 db
if ($is20db) {
if (!CRM_Core_DAO::checkFieldExists('civicrm_activity', 'source_record_id') || !CRM_Core_DAO::checkFieldExists('civicrm_activity', 'activity_date_time') || !CRM_Core_DAO::checkFieldExists('civicrm_activity', 'status_id') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'first_name') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'last_name') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'gender_id') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'mail_to_household_id') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'user_unique_id') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'household_name') || !CRM_Core_DAO::checkFieldExists('civicrm_contact', 'organization_name') || !CRM_Core_DAO::checkFieldExists('civicrm_contribution', 'honor_type_id') || !CRM_Core_DAO::checkFieldExists('civicrm_contribution_page', 'is_pay_later') || !CRM_Core_DAO::checkFieldExists('civicrm_contribution_page', 'pay_later_text') || !CRM_Core_DAO::checkFieldExists('civicrm_country', 'region_id') || !CRM_Core_DAO::checkFieldExists('civicrm_custom_field', 'column_name') || !CRM_Core_DAO::checkFieldExists('civicrm_custom_field', 'option_group_id') || !CRM_Core_DAO::checkFieldExists('civicrm_custom_group', 'table_name') || !CRM_Core_DAO::checkFieldExists('civicrm_custom_group', 'is_multiple') || !CRM_Core_DAO::checkFieldExists('civicrm_domain', 'version') || !CRM_Core_DAO::checkFieldExists('civicrm_domain', 'loc_block_id') || !CRM_Core_DAO::checkFieldExists('civicrm_email', 'contact_id') || !CRM_Core_DAO::checkFieldExists('civicrm_email', 'location_type_id') || !CRM_Core_DAO::checkFieldExists('civicrm_email', 'is_billing') || !CRM_Core_DAO::checkFieldExists('civicrm_entity_tag', 'contact_id') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'participant_listing_id') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'loc_block_id') || !CRM_Core_DAO::checkFieldExists('civicrm_event', 'receipt_text') || !CRM_Core_DAO::checkFieldExists('civicrm_event_page', 'is_pay_later') || !CRM_Core_DAO::checkFieldExists('civicrm_event_page', 'pay_later_text') || !CRM_Core_DAO::checkFieldExists('civicrm_financial_trxn', 'contribution_id') || !CRM_Core_DAO::checkFieldExists('civicrm_im', 'contact_id') || !CRM_Core_DAO::checkFieldExists('civicrm_im', 'location_type_id') || !CRM_Core_DAO::checkFieldExists('civicrm_membership_payment', 'contribution_id') || !CRM_Core_DAO::checkFieldExists('civicrm_membership_type', 'receipt_text_signup') || !CRM_Core_DAO::checkFieldExists('civicrm_membership_type', 'receipt_text_renewal') || !CRM_Core_DAO::checkFieldExists('civicrm_option_value', 'component_id') || !CRM_Core_DAO::checkFieldExists('civicrm_participant_payment', 'contribution_id') || !CRM_Core_DAO::checkFieldExists('civicrm_payment_processor', 'url_api') || !CRM_Core_DAO::checkFieldExists('civicrm_payment_processor_type', 'url_api_default') || !CRM_Core_DAO::checkFieldExists('civicrm_phone', 'contact_id') || !CRM_Core_DAO::checkFieldExists('civicrm_phone', 'location_type_id') || !CRM_Core_DAO::checkFieldExists('civicrm_uf_match', 'uf_name')) {
// db looks to have stuck somewhere between 2.0 & 2.1
$errorMessage .= ' Few important fields were found missing in some of the tables.';
$is20db = FALSE;
}
}
if (!$is20db) {
// check if the db is 2.1
if (CRM_Core_DAO::checkTableExists('civicrm_cache') && CRM_Core_DAO::checkFieldExists('civicrm_cache', 'group_name') && CRM_Core_DAO::checkFieldExists('civicrm_cache', 'created_date') && CRM_Core_DAO::checkFieldExists('civicrm_cache', 'expired_date') && CRM_Core_DAO::checkTableExists('civicrm_group_contact_cache') && CRM_Core_DAO::checkFieldExists('civicrm_group_contact_cache', 'contact_id') && CRM_Core_DAO::checkTableExists('civicrm_menu') && CRM_Core_DAO::checkFieldExists('civicrm_menu', 'path_arguments') && CRM_Core_DAO::checkFieldExists('civicrm_menu', 'is_exposed') && CRM_Core_DAO::checkFieldExists('civicrm_menu', 'page_type') && CRM_Core_DAO::checkTableExists('civicrm_discount') && CRM_Core_DAO::checkFieldExists('civicrm_discount', 'option_group_id') && CRM_Core_DAO::checkFieldExists('civicrm_discount', 'end_date')) {
$errorMessage = ts('Database check failed - it looks like you have already upgraded to the latest version (v2.1) of the database.');
}
return FALSE;
}
// check tables which should not exist for v2.x
if (CRM_Core_DAO::checkTableExists('civicrm_custom_option') || CRM_Core_DAO::checkTableExists('civicrm_custom_value') || CRM_Core_DAO::checkTableExists('civicrm_email_history') || CRM_Core_DAO::checkTableExists('civicrm_geo_coord') || CRM_Core_DAO::checkTableExists('civicrm_individual') || CRM_Core_DAO::checkTableExists('civicrm_location') || CRM_Core_DAO::checkTableExists('civicrm_meeting') || CRM_Core_DAO::checkTableExists('civicrm_organization') || CRM_Core_DAO::checkTableExists('civicrm_phonecall') || CRM_Core_DAO::checkTableExists('civicrm_sms_history') || CRM_Core_DAO::checkTableExists('civicrm_validation')) {
// table(s) found in the db which are no longer required
// for v2.x, though would not do any harm it's recommended
// to remove them.
CRM_Core_Session::setStatus(ts("Table(s) found in your db which are no longer required for v2.x, though would not do any harm it's recommended to remove them"), ts('Redundant Tables'), 'info');
}
// show error if any of the tables, use 'MyISAM' storage engine.
// just check the first 10 civicrm tables, rather than checking all 106!
if (CRM_Core_DAO::isDBMyISAM(10)) {
$errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB before proceeding.');
return FALSE;
}
// check FK constraint names are in valid format.
if (!CRM_Core_DAO::checkFKConstraintInFormat('civicrm_contact', 'domain_id') || !CRM_Core_DAO::checkFKConstraintInFormat('civicrm_contribution_page', 'domain_id') || !CRM_Core_DAO::checkFKConstraintInFormat('civicrm_contribution_recur', 'domain_id') || !CRM_Core_DAO::checkFKConstraintInFormat('civicrm_membership_status', 'domain_id') || !CRM_Core_DAO::checkFKConstraintInFormat('civicrm_contribution', 'contact_id') || !CRM_Core_DAO::checkFKConstraintInFormat('civicrm_contribution', 'contribution_type_id')) {
$errorMessage = ts('Database consistency check failed. FK constraint names not in the required format. Please rebuild your 2.0 database to ensure schema integrity.');
return FALSE;
}
return TRUE;
}
示例13: setUp
/**
* Set up function.
*
* Ensure CiviCase is enabled.
*/
public function setUp()
{
parent::setUp();
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
}
示例14: _initVariables
/**
* Initialize the config variables.
*
* @return void
*/
private function _initVariables()
{
// retrieve serialised settings
$variables = array();
CRM_Core_BAO_ConfigSetting::retrieve($variables);
// if settings are not available, go down the full path
if (empty($variables)) {
// Step 1. get system variables with their hardcoded defaults
$variables = get_object_vars($this);
// Step 2. get default values (with settings file overrides if
// available - handled in CRM_Core_Config_Defaults)
CRM_Core_Config_Defaults::setValues($variables);
// retrieve directory and url preferences also
CRM_Core_BAO_Setting::retrieveDirectoryAndURLPreferences($variables);
// add component specific settings
$this->componentRegistry->addConfig($this);
// serialise settings
$settings = $variables;
CRM_Core_BAO_ConfigSetting::add($settings);
}
$urlArray = array('userFrameworkResourceURL', 'imageUploadURL');
$dirArray = array('uploadDir', 'customFileUploadDir');
foreach ($variables as $key => $value) {
if (in_array($key, $urlArray)) {
$value = CRM_Utils_File::addTrailingSlash($value, '/');
} elseif (in_array($key, $dirArray)) {
if ($value) {
$value = CRM_Utils_File::addTrailingSlash($value);
}
if (empty($value) || CRM_Utils_File::createDir($value, FALSE) === FALSE) {
// seems like we could not create the directories
// settings might have changed, lets suppress a message for now
// so we can make some more progress and let the user fix their settings
// for now we assign it to a know value
// CRM-4949
$value = $this->templateCompileDir;
$url = CRM_Utils_System::url('civicrm/admin/setting/path', 'reset=1');
CRM_Core_Session::setStatus(ts('%1 has an incorrect directory path. Please go to the <a href="%2">path setting page</a> and correct it.', array(1 => $key, 2 => $url)), ts('Check Settings'), 'alert');
}
} elseif ($key == 'lcMessages') {
// reset the templateCompileDir to locale-specific and make sure it exists
if (substr($this->templateCompileDir, -1 * strlen($value) - 1, -1) != $value) {
$this->templateCompileDir .= CRM_Utils_File::addTrailingSlash($value);
CRM_Utils_File::createDir($this->templateCompileDir);
CRM_Utils_File::restrictAccess($this->templateCompileDir);
}
}
$this->{$key} = $value;
}
if ($this->userFrameworkResourceURL) {
// we need to do this here so all blocks also load from an ssl server
if (CRM_Utils_System::isSSL()) {
CRM_Utils_System::mapConfigToSSL();
}
$rrb = parse_url($this->userFrameworkResourceURL);
// don't use absolute path if resources are stored on a different server
// CRM-4642
$this->resourceBase = $this->userFrameworkResourceURL;
if (isset($_SERVER['HTTP_HOST']) && isset($rrb['host'])) {
$this->resourceBase = $rrb['host'] == $_SERVER['HTTP_HOST'] ? $rrb['path'] : $this->userFrameworkResourceURL;
}
}
if (!$this->customFileUploadDir) {
$this->customFileUploadDir = $this->uploadDir;
}
if ($this->geoProvider) {
$this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->geoProvider;
} elseif ($this->mapProvider) {
$this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->mapProvider;
}
require_once str_replace('_', DIRECTORY_SEPARATOR, $this->userFrameworkClass) . '.php';
$class = $this->userFrameworkClass;
// redundant with _setUserFrameworkConfig
$this->userSystem = new $class();
}
示例15: setUp
/**
* Test setup for every test
*
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
*/
public function setUp()
{
$this->_entity = 'case';
parent::setUp();
// CRM-9404 - set-up is a bit cumbersome but had to put something in place to set up activity types & case types
//. Using XML was causing breakage as id numbers were changing over time
// & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
// state where tests could run afterwards without re-loading.
$this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_status', 'format.only_id' => 1));
$this->caseTypeGroup = $this->callAPISuccess('option_group', 'get', array('name' => 'case_type', 'format.only_id' => 1));
$caseTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => $this->caseTypeGroup, 'name' => 'housing_support', 'label' => "Housing Support", 'sequential' => 1, 'description' => 'Help homeless individuals obtain temporary and long-term housing'));
$this->caseTypeId = $caseTypes['values'][0]['value'];
$this->optionValues[] = $caseTypes['id'];
$optionValues = array('Medical evaluation' => 'Medical evaluation', 'Mental health evaluation' => "Mental health evaluation", 'Secure temporary housing' => 'Secure temporary housing', 'Long-term housing plan' => 'Long-term housing plan', 'ADC referral' => 'ADC referral', 'Income and benefits stabilization' => 'Income and benefits stabilization');
foreach ($optionValues as $name => $label) {
$activityTypes = $this->callAPISuccess('option_value', 'Create', array('option_group_id' => 2, 'name' => $name, 'label' => $label, 'component_id' => 7));
// store for cleanup
$this->optionValues[] = $activityTypes['id'];
}
$tablesToTruncate = array('civicrm_activity', 'civicrm_contact', 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_case', 'civicrm_case_contact', 'civicrm_case_activity', 'civicrm_activity_contact', 'civicrm_relationship', 'civicrm_relationship_type');
$this->quickCleanup($tablesToTruncate);
$activityTypes = $this->callAPISuccess('option_value', 'get', array('option_group_id' => 2, 'name' => 'Follow Up', 'label' => 'Follow Up', 'sequential' => 1));
$this->followup_activity_type_value = $activityTypes['values'][0]['value'];
// Insert a row in civicrm_contact creating contact 17
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_XMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'));
//Create relationship types
$relTypeParams = array('name_a_b' => 'Case Coordinator is', 'label_a_b' => 'Case Coordinator is', 'name_b_a' => 'Case Coordinator', 'label_b_a' => 'Case Coordinator', 'description' => 'Case Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Homeless Services Coordinator is', 'label_a_b' => 'Homeless Services Coordinator is', 'name_b_a' => 'Homeless Services Coordinator', 'label_b_a' => 'Homeless Services Coordinator', 'description' => 'Homeless Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Health Services Coordinator is', 'label_a_b' => 'Health Services Coordinator is', 'name_b_a' => 'Health Services Coordinator', 'label_b_a' => 'Health Services Coordinator', 'description' => 'Health Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Senior Services Coordinator is', 'label_a_b' => 'Senior Services Coordinator is', 'name_b_a' => 'Senior Services Coordinator', 'label_b_a' => 'Senior Services Coordinator', 'description' => 'Senior Services Coordinator', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
$relTypeParams = array('name_a_b' => 'Benefits Specialist is', 'label_a_b' => 'Benefits Specialist is', 'name_b_a' => 'Benefits Specialist', 'label_b_a' => 'Benefits Specialist', 'description' => 'Benefits Specialist', 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', 'is_reserved' => 0, 'is_active' => 1);
$this->relationshipTypeCreate($relTypeParams);
// enable the default custom templates for the case type xml files
$this->customDirectories(array('template_path' => TRUE));
// case is not enabled by default
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);
$this->_params = array('case_type_id' => $this->caseTypeId, 'subject' => 'Test case', 'contact_id' => 17);
// create a logged in USER since the code references it for source_contact_id
$this->createLoggedInUser();
$session = CRM_Core_Session::singleton();
$this->_loggedInUser = $session->get('userID');
/// note that activityType options are cached by the FULL set of options you pass in
// ie. because Activity api includes campaign in it's call cache is not flushed unless
// included in this call. Also note flush function doesn't work on this property as it sets to null not empty array
CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
}