本文整理汇总了PHP中CRM_Core_DAO_Domain类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_Domain类的具体用法?PHP CRM_Core_DAO_Domain怎么用?PHP CRM_Core_DAO_Domain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_DAO_Domain类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setLocale
/**
* Sets the tsLocale and dbLocale for multi-lingual sites.
* Some code duplication from CRM/Core/BAO/ConfigSetting.php retrieve()
* to avoid regressions from refactoring.
* @param $lcMessagesRequest
* @throws \API_Exception
*/
public function setLocale($lcMessagesRequest)
{
// We must validate whether the locale is valid, otherwise setting a bad
// dbLocale could probably lead to sql-injection.
$domain = new \CRM_Core_DAO_Domain();
$domain->id = \CRM_Core_Config::domainID();
$domain->find(TRUE);
if ($domain->config_backend) {
$defaults = unserialize($domain->config_backend);
// are we in a multi-language setup?
$multiLang = $domain->locales ? TRUE : FALSE;
$lcMessages = NULL;
// on multi-lang sites based on request and civicrm_uf_match
if ($multiLang) {
$languageLimit = array();
if (array_key_exists('languageLimit', $defaults) && is_array($defaults['languageLimit'])) {
$languageLimit = $defaults['languageLimit'];
}
if (in_array($lcMessagesRequest, array_keys($languageLimit))) {
$lcMessages = $lcMessagesRequest;
} else {
throw new \API_Exception(ts('Language not enabled: %1', array(1 => $lcMessagesRequest)));
}
}
global $dbLocale;
// set suffix for table names - use views if more than one language
if ($lcMessages) {
$dbLocale = $multiLang && $lcMessages ? "_{$lcMessages}" : '';
// FIXME: an ugly hack to fix CRM-4041
global $tsLocale;
$tsLocale = $lcMessages;
}
}
}
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:I18nSubscriber.php
示例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');
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:40,代码来源:Step4.php
示例3: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Settings - Undelete, Logging and ReCAPTCHA'));
$this->addYesNo('contactUndelete', ts('Contact Trash & Undelete'));
// also check if we can enable triggers
$validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(FALSE);
// FIXME: for now, disable logging for multilingual sites OR if triggers are not permittted
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$attribs = $domain->locales || !$validTriggerPermission ? array('disabled' => 'disabled') : NULL;
$this->assign('validTriggerPermission', $validTriggerPermission);
$this->addYesNo('logging', ts('Logging'), NULL, NULL, $attribs);
$this->addYesNo('versionCheck', ts('Version Check & Statistics Reporting'));
$this->addYesNo('doNotAttachPDFReceipt', ts('Attach PDF copy to receipts'));
$this->addElement('text', 'wkhtmltopdfPath', ts('Path to wkhtmltopdf executable'), array('size' => 64, 'maxlength' => 256));
$this->addElement('text', 'maxAttachments', ts('Maximum Attachments'), array('size' => 2, 'maxlength' => 8));
$this->addElement('text', 'maxFileSize', ts('Maximum File Size'), array('size' => 2, 'maxlength' => 8));
$this->addElement('text', 'recaptchaPublicKey', ts('Public Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'recaptchaPrivateKey', ts('Private Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'dashboardCacheTimeout', ts('Dashboard cache timeout'), array('size' => 3, 'maxlength' => 5));
$this->addElement('text', 'checksumTimeout', ts('CheckSum Lifespan'), array('size' => 2, 'maxlength' => 8));
$this->addElement('text', 'recaptchaOptions', ts('Recaptcha Options'), array('size' => 64, 'maxlength' => 64));
$this->addRule('maxAttachments', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('checksumTimeout', ts('Value should be a positive number'), 'positiveInteger');
parent::buildQuickForm();
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:33,代码来源:Miscellaneous.php
示例4: checkLoggingSupport
/**
* Setting Callback - Validate.
*
* @param mixed $value
* @param array $fieldSpec
*
* @return bool
* @throws API_Exception
*/
public static function checkLoggingSupport(&$value, $fieldSpec)
{
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if (!CRM_Core_DAO::checkTriggerViewPermission(FALSE) && $value) {
throw new API_Exception("In order to use this functionality, the installation's database user must have privileges to create triggers (in MySQL 5.0 – and in MySQL 5.1 if binary logging is enabled – this means the SUPER privilege). This install either does not seem to have the required privilege enabled.");
}
return TRUE;
}
开发者ID:sarehag,项目名称:civicrm-core,代码行数:18,代码来源:Schema.php
示例5: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)'));
// also check if we can enable triggers
$validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(FALSE);
// FIXME: for now, disable logging for multilingual sites OR if triggers are not permittted
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$attribs = $domain->locales || !$validTriggerPermission ? array('disabled' => 'disabled') : array();
$this->assign('validTriggerPermission', $validTriggerPermission);
$this->addYesNo('logging', ts('Logging'), NULL, NULL, $attribs);
$this->addElement('text', 'wkhtmltopdfPath', ts('Path to wkhtmltopdf executable'), array('size' => 64, 'maxlength' => 256));
$this->addElement('text', 'recaptchaPublicKey', ts('Public Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'recaptchaPrivateKey', ts('Private Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'dashboardCacheTimeout', ts('Dashboard cache timeout'), array('size' => 3, 'maxlength' => 5));
$this->addElement('text', 'recaptchaOptions', ts('Recaptcha Options'), array('size' => 64, 'maxlength' => 64));
$this->addFormRule(array('CRM_Admin_Form_Setting_Miscellaneous', 'formRule'), $this);
parent::buildQuickForm();
$this->addRule('checksumTimeout', ts('Value should be a positive number'), 'positiveInteger');
}
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:25,代码来源:Miscellaneous.php
示例6: upgrade
function upgrade()
{
$sqlFile = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', '..', 'Incremental', 'sql', '2.2.alpha1.mysql'));
$tplFile = "{$sqlFile}.tpl";
$isMultilingual = FALSE;
if (file_exists($tplFile)) {
$isMultilingual = $this->processLocales($tplFile, '2.2');
} else {
if (!file_exists($sqlFile)) {
CRM_Core_Error::fatal("sqlfile - {$rev}.mysql not found.");
}
$this->source($sqlFile);
}
if ($isMultilingual) {
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales, '2.2');
}
$this->setVersion('2.1.102');
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:21,代码来源:Step2.php
示例7: __construct
function __construct($state = NULL, $action = CRM_Core_Action::NONE, $method = 'post', $name = NULL)
{
$this->_config = CRM_Core_Config::singleton();
// this->latestVersion is legacy code, only used for 2.0 -> 2.1 upgrade
// latest ver in 2.1 series
$this->latestVersion = '2.1.6';
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$this->multilingual = (bool) $domain->locales;
$this->locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
$smarty = CRM_Core_Smarty::singleton();
$smarty->compile_dir = $this->_config->templateCompileDir;
$smarty->assign('multilingual', $this->multilingual);
$smarty->assign('locales', $this->locales);
// we didn't call CRM_Core_BAO_ConfigSetting::retrieve(), so we need to set $dbLocale by hand
if ($this->multilingual) {
global $dbLocale;
$dbLocale = "_{$this->_config->lcMessages}";
}
parent::__construct($state, $action, $method, $name);
}
开发者ID:hguru,项目名称:224Civi,代码行数:21,代码来源:Form.php
示例8: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Settings - Miscellaneous'));
$this->addYesNo('contactUndelete', ts('Contact Trash & Undelete'));
// also check if we can enable triggers
$validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(false);
// FIXME: for now, disable logging for multilingual sites OR if triggers are not permittted
$domain = new CRM_Core_DAO_Domain();
$domain->find(true);
$attribs = $domain->locales || !$validTriggerPermission ? array('disabled' => 'disabled') : null;
$this->assign('validTriggerPermission', $validTriggerPermission);
$this->addYesNo('logging', ts('Logging'), null, null, $attribs);
$this->addYesNo('versionCheck', ts('Version Check & Statistics Reporting'));
$this->addElement('text', 'maxAttachments', ts('Maximum Attachments'), array('size' => 2, 'maxlength' => 8));
$this->addElement('text', 'maxFileSize', ts('Maximum File Size'), array('size' => 2, 'maxlength' => 8));
$this->addElement('text', 'recaptchaPublicKey', ts('Public Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'recaptchaPrivateKey', ts('Private Key'), array('size' => 64, 'maxlength' => 64));
$this->addElement('text', 'dashboardCacheTimeout', ts('Dashboard cache timeout'), array('size' => 3, 'maxlength' => 5));
$this->addRule('maxAttachments', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger');
parent::buildQuickForm();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:28,代码来源:Miscellaneous.php
示例9: verifyPreDBState
function verifyPreDBState(&$errorMessage)
{
$config = CRM_Core_Config::singleton();
// Let's first update the config defaults
require_once "CRM/Core/DAO/Domain.php";
$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();
}
} else {
if ($config->userFramework == 'Drupal') {
$defaults['userFrameworkVersion'] = '6.3';
if (defined('VERSION')) {
$defaults['userFrameworkVersion'] = VERSION;
}
}
}
// serialise settings
require_once "CRM/Core/BAO/Setting.php";
CRM_Core_BAO_Setting::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"));
}
// 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;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:99,代码来源:Step1.php
示例10: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$this->_numStrings = sizeof($params['old']);
$enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
for ($i = 1; $i <= $this->_numStrings; $i++) {
if (!empty($params['new'][$i]) && !empty($params['old'][$i])) {
if (isset($params['enabled']) && !empty($params['enabled'][$i])) {
if (!empty($params['cb']) && !empty($params['cb'][$i])) {
$enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$enabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
} else {
if (isset($params['cb']) && is_array($params['cb']) && array_key_exists($i, $params['cb'])) {
$disabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]);
} else {
$disabled['wildcardMatch'] += array($params['old'][$i] => $params['new'][$i]);
}
}
}
}
$overrides = array('enabled' => $enabled, 'disabled' => $disabled);
$config = CRM_Core_Config::singleton();
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if ($domain->locales && $config->localeCustomStrings) {
// for multilingual
$addReplacements = $config->localeCustomStrings;
$addReplacements[$config->lcMessages] = $overrides;
$stringOverride = serialize($addReplacements);
} else {
// for single language
$stringOverride = serialize(array($config->lcMessages => $overrides));
}
$params = array('locale_custom_strings' => $stringOverride);
$id = CRM_Core_Config::domainID();
$wordReplacementSettings = CRM_Core_BAO_Domain::edit($params, $id);
if ($wordReplacementSettings) {
// This controller was originally written to CRUD $config->locale_custom_strings,
// but that's no longer the canonical store. Sync changes to canonical store.
// This is inefficient - at some point, we should rewrite this UI.
CRM_Core_BAO_WordReplacement::rebuildWordReplacementTable();
CRM_Core_Session::setStatus("", ts("Settings Saved"), "success");
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1"));
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:54,代码来源:WordReplacements.php
示例11: convertConfigToSetting
/**
* Move an item from being in the config array to being stored as a setting
* remove from config - as appropriate based on metadata
*
* Note that where the key name is being changed the 'legacy_key' will give us the old name
*/
public static function convertConfigToSetting($name, $domainID = NULL)
{
// we have to force this here in case more than one domain is in play.
// whenever there is a possibility of more than one domain we must force it
$config = CRM_Core_Config::singleton();
if (empty($domainID)) {
$domainID = CRM_Core_Config::domainID();
}
$domain = new CRM_Core_DAO_Domain();
$domain->id = $domainID;
$domain->find(TRUE);
if ($domain->config_backend) {
$values = unserialize($domain->config_backend);
} else {
$values = array();
}
$spec = self::getSettingSpecification(NULL, array('name' => $name), $domainID);
$configKey = CRM_Utils_Array::value('config_key', $spec[$name], CRM_Utils_Array::value('legacy_key', $spec[$name], $name));
//if the key is set to config_only we don't need to do anything
if (empty($spec[$name]['config_only'])) {
if (!empty($values[$configKey])) {
civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID));
} else {
civicrm_api('setting', 'fill', array('version' => 3, 'name' => $name, 'domain_id' => $domainID));
}
if (empty($spec[$name]['prefetch']) && !empty($values[$configKey])) {
unset($values[$configKey]);
$domain->config_backend = serialize($values);
$domain->save();
unset($config->{$configKey});
}
}
}
开发者ID:kidaa30,项目名称:yes,代码行数:39,代码来源:Setting.php
示例12: isMultilingual
/**
* Is the CiviCRM in multilingual mode.
*
* @return Bool
* True if CiviCRM is in multilingual mode.
*/
public static function isMultilingual()
{
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
return (bool) $domain->locales;
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:12,代码来源:I18n.php
示例13: createIndexes
static function createIndexes(&$tables, $createIndexPrefix = 'index')
{
$queries = array();
$domain = new CRM_Core_DAO_Domain();
$domain->find(true);
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
// if we're multilingual, cache the information on internationalised fields
static $columns = null;
require_once 'CRM/Utils/System.php';
if (!CRM_Utils_System::isNull($locales) and $columns === null) {
require_once 'CRM/Core/I18n/SchemaStructure.php';
$columns =& CRM_Core_I18n_SchemaStructure::columns();
}
foreach ($tables as $table => $fields) {
$query = "SHOW INDEX FROM {$table}";
$dao = CRM_Core_DAO::executeQuery($query);
$currentIndexes = array();
while ($dao->fetch()) {
$currentIndexes[] = $dao->Key_name;
}
// now check for all fields if the index exists
foreach ($fields as $field) {
$names = array("index_{$field}", "FK_{$table}_{$field}", "UI_{$field}", "{$createIndexPrefix}_{$field}");
// skip to the next $field if one of the above $names exists; handle multilingual for CRM-4126
foreach ($names as $name) {
$regex = '/^' . preg_quote($name) . '(_[a-z][a-z]_[A-Z][A-Z])?$/';
if (preg_grep($regex, $currentIndexes)) {
continue 2;
}
}
// the index doesn't exist, so create it
// if we're multilingual and the field is internationalised, do it for every locale
if (!CRM_Utils_System::isNull($locales) and isset($columns[$table][$field])) {
foreach ($locales as $locale) {
$queries[] = "CREATE INDEX {$createIndexPrefix}_{$field}_{$locale} ON {$table} ({$field}_{$locale})";
}
} else {
$queries[] = "CREATE INDEX {$createIndexPrefix}_{$field} ON {$table} ({$field})";
}
}
}
// run the queries without i18n-rewriting
$dao = new CRM_Core_DAO();
foreach ($queries as $query) {
$dao->query($query, false);
}
}
开发者ID:ksecor,项目名称:civicrm,代码行数:47,代码来源:SchemaHandler.php
示例14: migrateHonoreeInfo
/**
* Migrate honoree information to uf_join.module_data as honoree columns (text and title) will be dropped
* on DB upgrade
*
* @param CRM_Queue_TaskContext $ctx
*
* @return bool
* TRUE for success
*/
public static function migrateHonoreeInfo(CRM_Queue_TaskContext $ctx)
{
$query = "ALTER TABLE `civicrm_uf_join`\n ADD COLUMN `module_data` longtext COMMENT 'Json serialized array of data used by the ufjoin.module'";
CRM_Core_DAO::executeQuery($query);
$honorTypes = array_keys(CRM_Core_OptionGroup::values('honor_type'));
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'new_individual';
$ufGroupDAO->find(TRUE);
$query = "SELECT * FROM civicrm_contribution_page";
$dao = CRM_Core_DAO::executeQuery($query);
if ($dao->N) {
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
while ($dao->fetch()) {
$honorParams = array('soft_credit' => array('soft_credit_types' => $honorTypes));
if ($domain->locales) {
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
foreach ($locales as $locale) {
$honor_block_title = "honor_block_title_{$locale}";
$honor_block_text = "honor_block_text_{$locale}";
$honorParams['soft_credit'] += array($locale => array('honor_block_title' => $dao->{$honor_block_title}, 'honor_block_text' => $dao->{$honor_block_text}));
}
} else {
$honorParams['soft_credit'] += array('default' => array('honor_block_title' => $dao->honor_block_title, 'honor_block_text' => $dao->honor_block_text));
}
$ufJoinParam = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'is_active' => $dao->honor_block_is_active, 'entity_id' => $dao->id, 'uf_group_id' => $ufGroupDAO->id, 'module_data' => json_encode($honorParams));
CRM_Core_BAO_UFJoin::create($ufJoinParam);
}
}
return TRUE;
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:40,代码来源:FourFive.php
示例15: retrieve
/**
* Function to retrieve the settings values from db
*
* @return array $defaults
* @static
*/
static function retrieve(&$defaults)
{
require_once "CRM/Core/DAO/Domain.php";
$domain = new CRM_Core_DAO_Domain();
$domain->selectAdd();
if (CRM_Utils_Array::value('q', $_GET) == 'civicrm/upgrade') {
$domain->selectAdd('config_backend');
} else {
$domain->selectAdd('config_backend, locales');
}
$domain->id = CRM_Core_Config::domainID();
$domain->find(true);
if ($domain->config_backend) {
$defaults = unserialize($domain->config_backend);
// calculate month var
$defaults['dateformatMonthVar'] = strstr($defaults['dateformatQfDate'], '%m') ? 'm' : (strstr($defaults['dateformatQfDate'], '%b') ? 'M' : (strstr($defaults['dateformatQfDate'], '%B') ? 'F' : null));
//calculate month var for Date Time
$defaults['datetimeformatMonthVar'] = strstr($defaults['dateformatQfDatetime'], '%m') ? 'm' : (strstr($defaults['dateformatQfDatetime'], '%b') ? 'M' : (strstr($defaults['dateformatQfDatetime'], '%B') ? 'F' : null));
//calculate hour var for Date Time
$defaults['datetimeformatHourVar'] = strstr($defaults['dateformatQfDatetime'], '%I') ? 'h' : (strstr($defaults['dateformatQfDatetime'], '%l') ? 'g' : null);
// set proper monetary formatting, falling back to en_US and C (CRM-2782)
setlocale(LC_MONETARY, $defaults['lcMonetary'] . '.utf8', $defaults['lcMonetary'], 'en_US.utf8', 'en_US', 'C');
$skipVars = array('dsn', 'templateCompileDir', 'userFrameworkDSN', 'userFrameworkBaseURL', 'userFrameworkClass', 'userHookClass', 'userPermissionClass', 'userFrameworkURLVar', 'qfKey', 'gettextResourceDir', 'cleanURL');
foreach ($skipVars as $skip) {
if (array_key_exists($skip, $defaults)) {
unset($defaults[$skip]);
}
}
// since language field won't be present before upgrade.
if (CRM_Utils_Array::value('q', $_GET) == 'civicrm/upgrade') {
return;
}
// are we in a multi-language setup?
$multiLang = $domain->locales ? true : false;
// set the current language
$lcMessages = null;
$session =& CRM_Core_Session::singleton();
// on multi-lang sites based on request and civicrm_uf_match
if ($multiLang) {
require_once 'CRM/Utils/Request.php';
$lcMessagesRequest = CRM_Utils_Request::retrieve('lcMessages', 'String', $this);
$languageLimit = array();
if (array_key_exists('languageLimit', $defaults) && is_array($defaults['languageLimit'])) {
$languageLimit = $defaults['languageLimit'];
}
if (in_array($lcMessagesRequest, array_keys($languageLimit))) {
$lcMessages = $lcMessagesRequest;
} else {
$lcMessagesRequest = null;
}
if (!$lcMessagesRequest) {
$lcMessagesSession = $session->get('lcMessages');
if (in_array($lcMessagesSession, array_keys($languageLimit))) {
$lcMessages = $lcMessagesSession;
} else {
$lcMessagesSession = null;
}
}
if ($lcMessagesRequest) {
require_once 'CRM/Core/DAO/UFMatch.php';
$ufm = new CRM_Core_DAO_UFMatch();
$ufm->contact_id = $session->get('userID');
if ($ufm->find(true)) {
$ufm->language = $lcMessages;
$ufm->save();
}
$session->set('lcMessages', $lcMessages);
}
if (!$lcMessages and $session->get('userID')) {
require_once 'CRM/Core/DAO/UFMatch.php';
$ufm = new CRM_Core_DAO_UFMatch();
$ufm->contact_id = $session->get('userID');
if ($ufm->find(true) && in_array($ufm->language, array_keys($languageLimit))) {
$lcMessages = $ufm->language;
}
$session->set('lcMessages', $lcMessages);
}
}
// if unset, try to inherit the language from the hosting CMS
if ($lcMessages === null) {
require_once 'CRM/Utils/System.php';
$lcMessages = CRM_Utils_System::getUFLocale();
require_once 'CRM/Core/BAO/CustomOption.php';
if ($domain->locales and !in_array($lcMessages, explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $domain->locales))) {
$lcMessages = null;
}
}
if ($lcMessages) {
// update config lcMessages - CRM-5027 fixed.
$defaults['lcMessages'] = $lcMessages;
} else {
// if a single-lang site or the above didn't yield a result, use default
$lcMessages = $defaults['lcMessages'];
}
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Setting.php
示例16: getDefaultLocaleOptions
/**
* @return array
*/
public static function getDefaultLocaleOptions()
{
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$locales = CRM_Core_I18n::languages();
if ($domain->locales) {
// for multi-lingual sites, populate default language drop-down with available languages
$defaultLocaleOptions = array();
foreach ($locales as $loc => $lang) {
if (substr_count($domain->locales, $loc)) {
$defaultLocaleOptions[$loc] = $lang;
}
}
} else {
$defaultLocaleOptions = $locales;
}
return $defaultLocaleOptions;
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:21,代码来源:Localization.php
示例17: loadCaseSampleData
/**
* @param $dsn
* @param string $fileName
* @param bool $lineMode
*/
public static function loadCaseSampleData($dsn, $fileName, $lineMode = FALSE)
{
$db =& DB::connect($dsn);
if (PEAR::isError($db)) {
die("Cannot open {$dsn}: " . $db->getMessage());
}
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$multiLingual = (bool) $domain->locales;
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('multilingual', $multiLingual);
$smarty->assign('locales', explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales));
if (!$lineMode) {
$string = $smarty->fetch($fileName);
// change \r\n to fix windows issues
$string = str_replace("\r\n", "\n", $string);
//get rid of comments starting with # and --
$string = preg_replace("/^#[^\n]*\$/m", "\n", $string);
$string = preg_replace("/^(--[^-]).*/m", "\n", $string);
$queries = preg_split('/;$/m', $string);
foreach ($queries as $query) {
$query = trim($query);
if (!empty($query)) {
$res =& $db->query($query);
if (PEAR::isError($res)) {
die("Cannot execute {$query}: " . $res->getMessage());
}
}
}
} else {
$fd = fopen($fileName, "r");
while ($string = fgets($fd)) {
$string = preg_replace("/^#[^\n]*\$/m", &q
|
请发表评论