本文整理汇总了PHP中CRM_Utils_System::flushCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::flushCache方法的具体用法?PHP CRM_Utils_System::flushCache怎么用?PHP CRM_Utils_System::flushCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::flushCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_1007
/**
* Upgrades for adding a Bussiness Coordinator in the Business case
* @return bool
*/
public function upgrade_1007()
{
$gid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_group where name = 'Add_Keyqualifications'");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_field` SET label = 'Assessment SC/BC' WHERE `name` = 'Assessment_SC' AND custom_group_id = '" . $gid . "'");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_field` SET label = 'Remarks SC/BC' WHERE `name` = 'Remarks' AND custom_group_id = '" . $gid . "'");
CRM_Utils_System::flushCache();
CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_value` SET label = 'Request Approval Business Programme BC' WHERE label = 'Request Approval Business Programme SC' and option_group_id = 2");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_value` SET label = 'Business Debriefing BC', name = 'Business Debriefing BC' WHERE name = 'Business Debriefing SC' and option_group_id = 2");
CRM_Utils_System::flushCache();
$this->executeCustomDataFile('xml/request_approval_bc.xml');
CRM_Utils_System::flushCache();
$this->executeCustomDataFile('xml/request_approval_cc.xml');
CRM_Utils_System::flushCache();
$checkQry = 'SELECT COUNT(*) AS relCount FROM civicrm_relationship_type WHERE name_a_b = %1';
$countRelType = CRM_Core_DAO::singleValueQuery($checkQry, array(1 => array('Business Coordinator', 'String')));
if ($countRelType == 0) {
CRM_Core_DAO::executeQuery("INSERT INTO civicrm_relationship_type\n (name_a_b, label_a_b, name_b_a, label_b_a, description, contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b, is_reserved, is_active)\n VALUES\n ('Business Coordinator', 'Business Coordinator', 'Business Coordinator', 'Business Coordinator', 'Business Coordinator relationship', NULL, 'Individual', NULL, NULL, NULL, '1')");
}
CRM_Utils_System::flushCache();
$gid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_group where name = 'Business_Data'");
$fid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_field where custom_group_id = '" . $gid . "' and name = 'Position_of_Visitors'");
if ($fid) {
civicrm_api3('CustomField', 'delete', array('id' => $fid));
}
return true;
}
示例2: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
CRM_Utils_System::flushCache('CRM_Core_DAO_LocationType');
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_LocationType::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'), ts('Record Deleted'), 'success');
return;
}
// store the submitted values in an array
$params = $this->exportValues();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
// action is taken depending upon the mode
$locationType = new CRM_Core_DAO_LocationType();
$locationType->name = $params['name'];
$locationType->display_name = $params['display_name'];
$locationType->vcard_name = $params['vcard_name'];
$locationType->description = $params['description'];
$locationType->is_active = $params['is_active'];
$locationType->is_default = $params['is_default'];
if ($params['is_default']) {
$query = "UPDATE civicrm_location_type SET is_default = 0";
CRM_Core_DAO::executeQuery($query);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$locationType->id = $this->_id;
}
$locationType->save();
CRM_Core_Session::setStatus(ts("The location type '%1' has been saved.", array(1 => $locationType->name)), ts('Saved'), 'success');
}
示例3: deleteGroup
static function deleteGroup($group = null)
{
$dao = new CRM_Core_DAO_Cache();
if (!empty($group)) {
$dao->group_name = $group;
}
$dao->delete();
// also reset ACL Cache
require_once 'CRM/ACL/BAO/Cache.php';
CRM_ACL_BAO_Cache::resetCache();
// also reset memory cache if any
CRM_Utils_System::flushCache();
}
示例4: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
CRM_Utils_System::flushCache();
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_OptionGroup::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected option group has been deleted.'), ts('Record Deleted'), 'success');
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['optionGroup'] = $this->_id;
}
$optionGroup = CRM_Core_BAO_OptionGroup::add($params, $ids);
CRM_Core_Session::setStatus(ts('The Option Group \'%1\' has been saved.', array(1 => $optionGroup->name)), ts('Saved'), 'success');
}
}
示例5: 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'));
}
示例6: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
CRM_Utils_System::flushCache('CRM_Queryrunner_DAO_Query');
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Queryrunner_BAO_Query::del($this->_id);
CRM_Core_Session::setStatus("", ts('Query Deleted.'), "success");
return;
}
$values = $this->controller->exportValues($this->_name);
$ts = strtotime(trim("{$values['scheduled_run_date']} {$values['scheduled_run_date_time']}"));
$dao = new CRM_Queryrunner_DAO_Query();
$dao->id = $this->_id;
$dao->name = $values['name'];
$dao->machine_name = strtolower(CRM_Utils_String::munge($dao->name, '_', null));
$dao->description = $values['description'];
$dao->query = $values['query'];
$dao->run_frequency = $values['run_frequency'];
$dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
$dao->scheduled_run = $ts ?: 0;
$dao->save();
}
示例7: civicrm_api3_custom_field_setvalue
/**
* CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field
*/
function civicrm_api3_custom_field_setvalue($params)
{
require_once 'api/v3/Generic/Setvalue.php';
$result = civicrm_api3_generic_setValue(array("entity" => 'custom_field', 'params' => $params));
if (empty($result['is_error'])) {
CRM_Utils_System::flushCache();
}
return $result;
}
示例8: testCreateCustomFields
public function testCreateCustomFields()
{
$this->webtestLogin();
$cid_all = $this->_createContact("all_data", "move_custom_data");
$cid_from_missing = $this->_createContact("source_missing", "move_custom_data");
$cid_to_missing = $this->_createContact("destination_missing", "move_custom_data");
$from_group_id = $this->_buildCustomFieldSet("source");
CRM_Utils_System::flushCache();
$to_group_id = $this->_buildCustomFieldSet("destination");
$this->_fillCustomDataForContact($cid_all, $from_group_id);
$this->_fillCustomDataForContact($cid_to_missing, $from_group_id);
$this->_fillCustomDataForContact($cid_all, $to_group_id);
$this->_fillCustomDataForContact($cid_from_missing, $to_group_id);
//to verify data hasn't been lost, we load the values for each contact
$pre_move_values = array();
$pre_move_values[$cid_all]['source'] = $this->_loadDataFromApi($cid_all, $from_group_id);
$pre_move_values[$cid_all]['destination'] = $this->_loadDataFromApi($cid_all, $to_group_id);
$pre_move_values[$cid_from_missing]['source'] = $this->_loadDataFromApi($cid_from_missing, $from_group_id);
$pre_move_values[$cid_from_missing]['destination'] = $this->_loadDataFromApi($cid_from_missing, $to_group_id);
$pre_move_values[$cid_to_missing]['source'] = $this->_loadDataFromApi($cid_to_missing, $from_group_id);
$pre_move_values[$cid_to_missing]['destination'] = $this->_loadDataFromApi($cid_to_missing, $to_group_id);
//ok, so after all that setup, we are now good to actually move a field
//first, pick a random field from the source group to move
$fields = $this->webtest_civicrm_api("CustomField", "get", array('custom_group_id' => $from_group_id));
$field_to_move = array_rand($fields['values']);
//move the field
$this->_moveCustomField($field_to_move, $from_group_id, $to_group_id);
//now lets verify the data, load up the new values from the api...
$post_move_values = array();
$post_move_values[$cid_all]['source'] = $this->_loadDataFromApi($cid_all, $from_group_id, TRUE);
$post_move_values[$cid_all]['destination'] = $this->_loadDataFromApi($cid_all, $to_group_id);
$post_move_values[$cid_from_missing]['source'] = $this->_loadDataFromApi($cid_from_missing, $from_group_id);
$post_move_values[$cid_from_missing]['destination'] = $this->_loadDataFromApi($cid_from_missing, $to_group_id);
$post_move_values[$cid_to_missing]['source'] = $this->_loadDataFromApi($cid_to_missing, $from_group_id);
$post_move_values[$cid_to_missing]['destination'] = $this->_loadDataFromApi($cid_to_missing, $to_group_id);
// Make sure that only the appropriate values have changed.
foreach (array($cid_all, $cid_from_missing, $cid_to_missing) as $cid) {
foreach (array('source', 'destination') as $fieldset) {
foreach ($pre_move_values[$cid][$fieldset] as $id => $value) {
if ($id != $field_to_move) {
//All fields that were there should still be there
$this->assertTrue(isset($post_move_values[$cid][$fieldset][$id]), "A custom field that was not moved is missing!");
//All fields should have the same value as when we started
$this->assertTrue($post_move_values[$cid][$fieldset][$id] == $value, "A custom field value has changed in the source custom field set");
}
}
}
//check that the field is actually moved
$this->assertTrue(!isset($post_move_values[$cid]['source'][$field_to_move]), "Moved field is still present in the source fieldset");
$this->assertTrue(isset($post_move_values[$cid]['destination'][$field_to_move]), "Moved field is not present in the destination fieldset");
$this->assertTrue($pre_move_values[$cid]['source'][$field_to_move] == $post_move_values[$cid]['destination'][$field_to_move], "The moved field has changed values!");
}
//Go to the contacts page and check that the custom field is in the right group
$this->openCiviPage('contact/view', "reset=1&cid={$cid_all}");
//load the names of the custom fieldsets
$source = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $from_group_id));
$source = $source['values'][$from_group_id];
$destination = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $to_group_id));
$destination = $destination['values'][$to_group_id];
//assert that the moved custom field is missing from the source fieldset
$this->assertElementNotContainsText("css=div." . $source['name'], $fields['values'][$field_to_move]['label'], "Moved value still displays in the old fieldset on the contact record");
$this->assertElementContainsText("css=div." . $destination['name'], $fields['values'][$field_to_move]['label'], "Moved value does not display in the new fieldset on the contact record");
}
示例9: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
CRM_Utils_System::flushCache();
// get values from form
$params = $this->exportValues();
$params['id'] = $this->_config['id'];
//$params['day_start_at'] = date('His', strtotime($params['day_start_at']));
//$params['day_end_at'] = date('His', strtotime($params['day_end_at']));
if (!isset($params['log_confirmation_email'])) {
$params['log_confirmation_email'] = 0;
}
if (!isset($params['unlimited_resource_time_config'])) {
$params['unlimited_resource_time_config'] = 0;
}
// submit to BAO for updating
$set = CRM_Booking_BAO_BookingConfig::create($params);
$url = CRM_Utils_System::url('civicrm/admin/setting/preferences/booking', 'reset=1');
// show message
CRM_Core_Session::setStatus(ts('The Booking configuration has been saved.'), ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
示例10: add
/**
* function to add the event
*
* @param array $params reference array contains the values submitted by the form
*
* @access public
* @static
* @return object
*/
static function add(&$params)
{
require_once 'CRM/Utils/System.php';
CRM_Utils_System::flushCache();
require_once 'CRM/Utils/Hook.php';
if (CRM_Utils_Array::value('id', $params)) {
CRM_Utils_Hook::pre('edit', 'Event', $params['id'], $params);
} else {
CRM_Utils_Hook::pre('create', 'Event', null, $params);
}
$event = new CRM_Event_DAO_Event();
$event->copyValues($params);
$result = $event->save();
if (CRM_Utils_Array::value('id', $params)) {
CRM_Utils_Hook::post('edit', 'Event', $event->id, $event);
} else {
CRM_Utils_Hook::post('create', 'Event', $event->id, $event);
}
return $result;
}
示例11: commonProcess
/**
* Common Process.
*
* @todo Document what I do.
*
* @param array $params
*/
public function commonProcess(&$params)
{
// save autocomplete search options
if (!empty($params['autocompleteContactSearch'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch'])) . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
unset($params['autocompleteContactSearch']);
}
// save autocomplete contact reference options
if (!empty($params['autocompleteContactReference'])) {
$value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactReference'])) . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
unset($params['autocompleteContactReference']);
}
// save components to be enabled
if (array_key_exists('enableComponents', $params)) {
civicrm_api3('setting', 'create', array('enable_components' => $params['enableComponents']));
unset($params['enableComponents']);
}
// save checksum timeout
if (!empty($params['checksumTimeout'])) {
CRM_Core_BAO_Setting::setItem($params['checksumTimeout'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'checksum_timeout');
}
// update time for date formats when global time is changed
if (!empty($params['timeInputFormat'])) {
$query = "\nUPDATE civicrm_preferences_date\nSET time_format = %1\nWHERE time_format IS NOT NULL\nAND time_format <> ''\n";
$sqlParams = array(1 => array($params['timeInputFormat'], 'String'));
CRM_Core_DAO::executeQuery($query, $sqlParams);
}
// verify ssl peer option
if (isset($params['verifySSL'])) {
CRM_Core_BAO_Setting::setItem($params['verifySSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
unset($params['verifySSL']);
}
// force secure URLs
if (isset($params['enableSSL'])) {
CRM_Core_BAO_Setting::setItem($params['enableSSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL');
unset($params['enableSSL']);
}
$settings = array_intersect_key($params, $this->_settings);
$result = civicrm_api('setting', 'create', $settings + array('version' => 3));
foreach ($settings as $setting => $settingGroup) {
//@todo array_diff this
unset($params[$setting]);
}
CRM_Core_BAO_ConfigSetting::create($params);
CRM_Core_Config::clearDBCache();
CRM_Utils_System::flushCache();
CRM_Core_Resources::singleton()->resetCacheCode();
CRM_Core_Session::setStatus(" ", ts('Changes Saved'), "success");
}
示例12: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
CRM_Utils_System::flushCache();
if ($this->_action & CRM_Core_Action::DELETE) {
$isDelete = CRM_Contact_BAO_ContactType::del($this->_id);
if ($isDelete) {
CRM_Core_Session::setStatus(ts('Selected contact type has been deleted.'), ts('Record Deleted'), 'success');
} else {
CRM_Core_Session::setStatus(ts("Selected contact type can not be deleted. Make sure contact type doesn't have any associated custom data or group."), ts('Sorry'), 'error');
}
return;
}
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
// Force Enabled = true for built-in contact types to fix problems caused by CRM-6471 (parent_id is NULL for these types)
if (is_null($this->_parentId)) {
$params['is_active'] = 1;
}
}
if ($this->_action & CRM_Core_Action::ADD) {
$params['name'] = ucfirst(CRM_Utils_String::munge($params['label']));
}
$contactType = CRM_Contact_BAO_ContactType::add($params);
CRM_Core_Session::setStatus(ts("The Contact Type '%1' has been saved.", array(1 => $contactType->label)), ts('Saved'), 'success');
}
示例13: cleanupCaches
/**
* Do general cleanup of caches, temp directories and temp tables
* CRM-8739
*
* @param bool $sessionReset
*/
public function cleanupCaches($sessionReset = TRUE)
{
// cleanup templates_c directory
$this->cleanup(1, FALSE);
// clear all caches
self::clearDBCache();
CRM_Utils_System::flushCache();
if ($sessionReset) {
$session = CRM_Core_Session::singleton();
$session->reset(2);
}
}
示例14: moveField
/**
* Move a custom data field from one group (table) to another
*
* @param int $fieldID
* FK to civicrm_custom_field.
* @param int $newGroupID
* FK to civicrm_custom_group.
*
* @return void
*/
public static function moveField($fieldID, $newGroupID)
{
$validation = self::_moveFieldValidate($fieldID, $newGroupID);
if (TRUE !== $validation) {
CRM_Core_Error::fatal(implode(' ', $validation));
}
$field = new CRM_Core_DAO_CustomField();
$field->id = $fieldID;
$field->find(TRUE);
$newGroup = new CRM_Core_DAO_CustomGroup();
$newGroup->id = $newGroupID;
$newGroup->find(TRUE);
$oldGroup = new CRM_Core_DAO_CustomGroup();
$oldGroup->id = $field->custom_group_id;
$oldGroup->find(TRUE);
$add = clone $field;
$add->custom_group_id = $newGroup->id;
self::createField($add, 'add');
$sql = "INSERT INTO {$newGroup->table_name} (entity_id, {$field->column_name})\n SELECT entity_id, {$field->column_name} FROM {$oldGroup->table_name}\n ON DUPLICATE KEY UPDATE {$field->column_name} = {$oldGroup->table_name}.{$field->column_name}\n ";
CRM_Core_DAO::executeQuery($sql);
$del = clone $field;
$del->custom_group_id = $oldGroup->id;
self::createField($del, 'delete');
$add->save();
CRM_Utils_System::flushCache();
}
示例15: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
CRM_Utils_System::flushCache('CRM_SMS_DAO_Provider');
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_SMS_BAO_Provider::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected Provider has been deleted.'), ts('Deleted'), 'success');
return;
}
$recData = $values = $this->controller->exportValues($this->_name);
$recData['is_active'] = CRM_Utils_Array::value('is_active', $recData, 0);
$recData['is_default'] = CRM_Utils_Array::value('is_default', $recData, 0);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_SMS_BAO_Provider::updateRecord($recData, $this->_id);
} elseif ($this->_action & CRM_Core_Action::ADD) {
CRM_SMS_BAO_Provider::saveRecord($recData);
}
}