You are here

function salesforce_api_update_wsdl_form_submit in Salesforce Suite 6.2

Same name and namespace in other branches
  1. 7.2 salesforce_api/salesforce_api.admin.inc \salesforce_api_update_wsdl_form_submit()

If we get this far, we've successfully uploaded the new WSDL. Clean up after ourselves and display the appropriate confirmation messages.

File

salesforce_api/salesforce_api.admin.inc, line 1055
Contains the admin page callbacks for the Salesforce module, including forms for general settings and fieldmap administration.

Code

function salesforce_api_update_wsdl_form_submit($form, &$form_state) {
  drupal_set_message(t('The WSDL file has been successfully uploaded. You should remove write permissions from the wsdl directory.'));

  // Set the WSDL directory, already validated to exist and be writable
  variable_set('salesforce_api_dir_wsdl', $form_state['values']['wsdl']);

  // Disable PHP SOAP WSDL cache for this request. This doesn't disable the
  // cache permanently, but should force PHP to reload it.
  ini_set('soap.wsdl_cache_enabled', '0');

  // Clear the cache
  drupal_flush_all_caches();

  // Clear WSDL files from tmp directory
  $tmp_dir = file_directory_temp();

  // Make sure the tmp dir exists and isn't the root, just to be safe
  if (is_dir($tmp_dir) && $tmp_dir != '/') {
    $cmd = 'rm -f ' . $tmp_dir . '/*.wsdl.*';
    $exec_output = exec($cmd);
  }
  drupal_set_message(t('Drupal cache emptied and WSDL files removed from temp directory.'));
}