本文整理匯總了PHP中CRM_Core_BAO_Preferences::fixAndStoreDirAndURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_BAO_Preferences::fixAndStoreDirAndURL方法的具體用法?PHP CRM_Core_BAO_Preferences::fixAndStoreDirAndURL怎麽用?PHP CRM_Core_BAO_Preferences::fixAndStoreDirAndURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Core_BAO_Preferences
的用法示例。
在下文中一共展示了CRM_Core_BAO_Preferences::fixAndStoreDirAndURL方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
/**
* Function to add civicrm settings
*
* @params array $params associated array of civicrm variables
*
* @return null
* @static
*/
static function add(&$params)
{
CRM_Core_BAO_Setting::fixParams($params);
// also set a template url so js files can use this
// CRM-6194
$params['civiRelativeURL'] = CRM_Utils_System::url('CIVI_BASE_TEMPLATE');
$params['civiRelativeURL'] = str_replace('CIVI_BASE_TEMPLATE', '', $params['civiRelativeURL']);
require_once "CRM/Core/DAO/Domain.php";
$domain = new CRM_Core_DAO_Domain();
$domain->id = CRM_Core_Config::domainID();
$domain->find(true);
if ($domain->config_backend) {
$values = unserialize($domain->config_backend);
CRM_Core_BAO_Setting::formatParams($params, $values);
}
// CRM-6151
if (isset($params['localeCustomStrings']) && is_array($params['localeCustomStrings'])) {
$domain->locale_custom_strings = serialize($params['localeCustomStrings']);
}
// unset any of the variables we read from file that should not be stored in the database
// the username and certpath are stored flat with _test and _live
// check CRM-1470
$skipVars = array('dsn', 'templateCompileDir', 'userFrameworkDSN', 'userFrameworkBaseURL', 'userFrameworkClass', 'userHookClass', 'userPermissionClass', 'userFrameworkURLVar', 'newBaseURL', 'newBaseDir', 'newSiteName', 'configAndLogDir', 'qfKey', 'gettextResourceDir', 'cleanURL', 'locale_custom_strings', 'localeCustomStrings');
foreach ($skipVars as $var) {
unset($params[$var]);
}
require_once 'CRM/Core/BAO/Preferences.php';
CRM_Core_BAO_Preferences::fixAndStoreDirAndURL($params);
// also skip all Dir Params, we dont need to store those in the DB!
foreach ($params as $name => $val) {
if (substr($name, -3) == 'Dir') {
unset($params[$name]);
}
}
$domain->config_backend = serialize($params);
$domain->save();
}