当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Setting::updateSettingsFromMetaData方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_Setting::updateSettingsFromMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Setting::updateSettingsFromMetaData方法的具体用法?PHP CRM_Core_BAO_Setting::updateSettingsFromMetaData怎么用?PHP CRM_Core_BAO_Setting::updateSettingsFromMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_Setting的用法示例。


在下文中一共展示了CRM_Core_BAO_Setting::updateSettingsFromMetaData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rebuildMenuAndCaches

 static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $config->clearModuleList();
     // also cleanup all caches
     $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     CRM_Core_Menu::store();
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
     // also cleanup module permissions
     $config->cleanupPermissions();
     // also rebuild word replacement cache
     CRM_Core_BAO_WordReplacement::rebuild();
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     CRM_Core_Resources::singleton()->resetCacheCode();
     // also rebuild triggers if requested explicitly
     if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
         CRM_Core_DAO::triggerRebuild();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:22,代码来源:Invoke.php

示例2: upgrade_4_4_1

 /**
  * @param $rev
  */
 public function upgrade_4_4_1($rev)
 {
     $config = CRM_Core_Config::singleton();
     // CRM-13327 upgrade handling for the newly added name badges
     $ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'name_badge', 'id', 'name');
     $nameBadges = array_flip(array_values(CRM_Core_BAO_OptionValue::getOptionValuesAssocArrayFromName('name_badge')));
     unset($nameBadges['Avery 5395']);
     if (!empty($nameBadges)) {
         $dimension = '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}';
         $query = "UPDATE civicrm_option_value\n        SET value = '{$dimension}'\n        WHERE option_group_id = %1 AND name = 'Fattorini Name Badge 100x65'";
         CRM_Core_DAO::executeQuery($query, array(1 => array($ogID, 'Integer')));
     } else {
         $dimensions = array(1 => '{"paper-size":"a4","orientation":"landscape","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":1,"metric":"mm","lMargin":25,"tMargin":27,"SpaceX":0,"SpaceY":35,"width":106,"height":150,"lPadding":5,"tPadding":5}', 2 => '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":6,"tMargin":19,"SpaceX":0,"SpaceY":0,"width":100,"height":65,"lPadding":0,"tPadding":0}', 3 => '{"paper-size":"a4","orientation":"portrait","font-name":"times","font-size":6,"font-style":"","NX":2,"NY":2,"metric":"mm","lMargin":10,"tMargin":28,"SpaceX":0,"SpaceY":0,"width":96,"height":121,"lPadding":5,"tPadding":5}');
         $insertStatements = array(1 => "({$ogID}, %1, '{$dimensions[1]}', %1, NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL)", 2 => "({$ogID}, %2, '{$dimensions[2]}', %2, NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL)", 3 => "({$ogID}, %3, '{$dimensions[3]}', %3, NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL)");
         $queryParams = array(1 => array('A6 Badge Portrait 150x106', 'String'), 2 => array('Fattorini Name Badge 100x65', 'String'), 3 => array('Hanging Badge 3-3/4" x 4-3"/4', 'String'));
         foreach ($insertStatements as $values) {
             $query = 'INSERT INTO civicrm_option_value (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES' . $values;
             CRM_Core_DAO::executeQuery($query, $queryParams);
         }
     }
     // CRM-12578 - Prior to this version a CSS file under drupal would disable core css
     if (!empty($config->customCSSURL) && strpos($config->userFramework, 'Drupal') === 0) {
         // The new setting doesn't exist yet - need to create it first
         CRM_Core_BAO_Setting::updateSettingsFromMetaData();
         CRM_Core_BAO_Setting::setItem('1', CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'disable_core_css');
     }
     // CRM-13701 - Fix $config->timeInputFormat
     $sql = "\n      SELECT time_format\n      FROM   civicrm_preferences_date\n      WHERE  time_format IS NOT NULL\n      AND    time_format <> ''\n      LIMIT  1\n    ";
     $timeInputFormat = CRM_Core_DAO::singleValueQuery($sql);
     if ($timeInputFormat && $timeInputFormat != $config->timeInputFormat) {
         $params = array('timeInputFormat' => $timeInputFormat);
         CRM_Core_BAO_ConfigSetting::add($params);
     }
     // CRM-13698 - add 'Available' and 'No-show' activity statuses
     $insertStatus = array();
     $nsinc = $avinc = $inc = 0;
     if (!CRM_Core_OptionGroup::getValue('activity_status', 'Available', 'name')) {
         $insertStatus[] = "(%1, 'Available', %2, 'Available',  NULL, 0, NULL, %3, 0, 0, 1, NULL, NULL)";
         $avinc = $inc = 1;
     }
     if (!CRM_Core_OptionGroup::getValue('activity_status', 'No_show', 'name')) {
         $insertStatus[] = "(%1, 'No-show', %4, 'No_show',  NULL, 0, NULL, %5, 0, 0, 1, NULL, NULL)";
         $nsinc = $inc + 1;
     }
     if (!empty($insertStatus)) {
         $acOptionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_status', 'id', 'name');
         $maxVal = CRM_Core_DAO::singleValueQuery("SELECT MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id  = {$acOptionGroupID}");
         $maxWeight = CRM_Core_DAO::singleValueQuery("SELECT MAX(weight) FROM civicrm_option_value WHERE option_group_id = {$acOptionGroupID}");
         $p[1] = array($acOptionGroupID, 'Integer');
         if ($avinc) {
             $p[2] = array($avinc + $maxVal, 'Integer');
             $p[3] = array($avinc + $maxWeight, 'Integer');
         }
         if ($nsinc) {
             $p[4] = array($nsinc + $maxVal, 'Integer');
             $p[5] = array($nsinc + $maxWeight, 'Integer');
         }
         $insertStatus = implode(',', $insertStatus);
         $sql = "\nINSERT INTO\n   civicrm_option_value (`option_group_id`, label, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)\nVALUES {$insertStatus}";
         CRM_Core_DAO::executeQuery($sql, $p);
     }
     $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.1')), 'task_4_4_x_runSql', $rev);
     $this->addTask('Patch word-replacement schema', 'wordReplacements_patch', $rev);
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:67,代码来源:FourFour.php

示例3: testConvertAndFillSettings

 /**
  * This test checks that CRM_Core_BAO_Setting::updateSettingsFromMetaData();
  * 1) Removes 'maxAttachments' from config (because 'prefetch' is not set in the metadata it should
  * be removed
  *  2) for current domain setting max_attachments is set to the value that $config->maxAttachments
  *    had (6)
  *  3) for other domain (2) max_attachments is set to the configured default (3)
  *
  *
  **/
 function testConvertAndFillSettings()
 {
     $settings = array('maxAttachments' => 6);
     CRM_Core_BAO_ConfigSetting::add($settings);
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     $this->assertEquals(6, $config->maxAttachments);
     $checkSQL = "SELECT  count(*) FROM civicrm_domain WHERE config_backend LIKE '%\"maxAttachments\";i:6%' AND id = 1\n    ";
     $checkresult = CRM_Core_DAO::singleValueQuery($checkSQL);
     $this->assertEquals(1, $checkresult, "Check that maxAttachments has been saved to database not just stored in config");
     $sql = " DELETE FROM civicrm_setting WHERE name = 'max_attachments'";
     CRM_Core_DAO::executeQuery($sql);
     $currentDomain = CRM_Core_Config::domainID();
     // we are setting up an artificial situation here as we are trying to drive out
     // previous memory of this setting so we need to flush it out
     $cachekey = CRM_Core_BAO_Setting::inCache('CiviCRM Preferences', 'max_attachments', NULL, NULL, TRUE, $currentDomain);
     CRM_Core_BAO_Setting::flushCache($cachekey);
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     //check current domain
     $value = civicrm_api('setting', 'getvalue', array('version' => 3, 'name' => 'max_attachments', 'group' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME));
     $this->assertEquals(6, $value);
     // check alternate domain
     $value = civicrm_api('setting', 'getvalue', array('version' => 3, 'name' => 'max_attachments', 'group' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'domain_id' => 2));
     $this->assertEquals(3, $value);
     //some caching inconsistency here
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     $maxAttachments = empty($config->maxAttachments) ? NULL : $config->maxAttachments;
     $this->assertEmpty($maxAttachments, "Config item still Set to {$maxAttachments}\n    . This works fine when test run alone");
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:38,代码来源:SettingTest.php

示例4: doFinish

 public static function doFinish()
 {
     $upgrade = new CRM_Upgrade_Form();
     list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
     // Seems extraneous in context, but we'll preserve old behavior
     $upgrade->setVersion($latestVer);
     // lets rebuild the config array in case we've made a few changes in the
     // code base
     // this also helps us always store the latest version of civi in the DB
     $params = array();
     CRM_Core_BAO_ConfigSetting::add($params);
     // CRM-12804 comment-51411 : add any missing settings
     // at the end of upgrade
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     // cleanup caches CRM-8739
     $config = CRM_Core_Config::singleton();
     $config->cleanupCaches(1);
     // Rebuild all triggers and re-enable logging if needed
     $logging = new CRM_Logging_Schema();
     $logging->fixSchemaDifferences();
     //CRM-16257 update Config.IDS.ini might be an old copy
     CRM_Core_IDS::createConfigFile(TRUE);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:23,代码来源:Form.php

示例5: rebuildMenuAndCaches

 /**
  * @param bool $triggerRebuild
  * @param bool $sessionReset
  *
  * @throws Exception
  */
 public static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $config->clearModuleList();
     // also cleanup all caches
     $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     CRM_Core_Menu::store();
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
     // also cleanup module permissions
     $config->cleanupPermissions();
     // rebuild word replacement cache - pass false to prevent operations redundant with this fn
     CRM_Core_BAO_WordReplacement::rebuild(FALSE);
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     // Clear js caches
     CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
     CRM_Case_XMLRepository::singleton(TRUE);
     // also rebuild triggers if requested explicitly
     if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
         CRM_Core_DAO::triggerRebuild();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
     //CRM-16257 update Config.IDS.ini might be an old copy
     CRM_Core_IDS::createConfigFile(TRUE);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:32,代码来源:Invoke.php


注:本文中的CRM_Core_BAO_Setting::updateSettingsFromMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。