function salesforce_api_cache_build in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_cache_build()
- 7 salesforce_api/salesforce_api.module \salesforce_api_cache_build()
Recreate the Salesforce object cache.
Return value
array An array of Salesforce objects enabled for use in fieldmaps.
4 calls to salesforce_api_cache_build()
- salesforce_api_admin_object_submit in salesforce_api/
salesforce_api.admin.inc - FAPI submit handler Gather enabled SF Objects and rebuild the cache.
- salesforce_api_cron in salesforce_api/
salesforce_api.module - Implements hook_cron().
- salesforce_api_fieldmap_objects in salesforce_api/
salesforce_api.module - Implements hook_fieldmap_objects().
- salesforce_api_fieldmap_target_enabled in salesforce_api/
salesforce_api.module - Helper function to determine whether the Salesforce object (target) for a given fieldmap is available.
1 string reference to 'salesforce_api_cache_build'
- salesforce_api_settings_form in salesforce_api/
salesforce_api.admin.inc - The settings form at admin/settings/salesforce.
File
- salesforce_api/
salesforce_api.module, line 638 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_cache_build() {
// @todo: Change Campaign to Case to provide a better demo of a node export.
$sf_objects = variable_get('salesforce_api_enabled_objects', array(
'Campaign',
'Contact',
'Lead',
));
$result = salesforce_api_describeSObjects($sf_objects);
foreach ($sf_objects as $i => $obj) {
$objects[$obj] = salesforce_api_object_to_fieldmap_fields($result[$obj]);
}
// Look up the cache expiration time.
$lifetime = variable_get('salesforce_api_object_expire', CACHE_PERMANENT);
$expire = $lifetime == CACHE_PERMANENT ? CACHE_PERMANENT : REQUEST_TIME + $lifetime;
cache_set('salesforce_api_sf_objects', $objects, $table = 'cache', $expire, $headers = NULL);
// Notify administrators when the Salesforce object cache has been refreshed.
// This typically happens either when a manual refresh is requested, a new Salesforce object
// is enabled for mapping, or Drupal does a flush of all caches.
if (user_access('administer salesforce')) {
drupal_set_message(t('Salesforce object cache has been refreshed.'));
}
return $objects;
}