You are here

function coder_upgrade_parameters_save in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/includes/conversion.inc \coder_upgrade_parameters_save()

Saves the runtime parameters to a file for use by script.

1 call to coder_upgrade_parameters_save()
coder_upgrade_conversions_apply in coder_upgrade/includes/conversion.inc
Applies the module conversion code.

File

coder_upgrade/includes/conversion.inc, line 384

Code

function coder_upgrade_parameters_save($upgrades, $extensions, $items) {

  // Add path to upgrades array for use by script.
  foreach ($upgrades as $name => &$upgrade) {
    $upgrade['path'] = drupal_get_path('module', $upgrade['module']);
  }

  // Create paths array.
  $paths = array(
    'files_base' => coder_upgrade_directory_path('', FALSE),
    'libraries_base' => str_replace('/grammar_parser', '', libraries_get_path('grammar_parser')),
    'modules_base' => str_replace('/coder', '', drupal_get_path('module', 'coder')),
  );

  // Create variables array.
  $variables = array(
    'coder_upgrade_dir' => variable_get('coder_upgrade_dir', DEADWOOD_DIR),
    'coder_upgrade_dir_patch' => variable_get('coder_upgrade_dir_patch', DEADWOOD_PATCH),
    'coder_upgrade_replace_files' => variable_get('coder_upgrade_replace_files', FALSE),
    'coder_upgrade_preserve_array_format' => variable_get('coder_upgrade_preserve_array_format', FALSE),
    'coder_upgrade_enable_debug_output' => variable_get('coder_upgrade_enable_debug_output', FALSE),
    'coder_upgrade_enable_parser_debug_output' => variable_get('coder_upgrade_enable_parser_debug_output', FALSE),
    'coder_upgrade_use_separate_process' => variable_get('coder_upgrade_use_separate_process', FALSE),
  );

  // Create parameters array.
  $parameters['paths'] = $paths;
  $parameters['theme_cache'] = coder_upgrade_path('theme_cache');
  $parameters['variables'] = $variables;
  $parameters['upgrades'] = $upgrades;
  $parameters['extensions'] = $extensions;
  $parameters['items'] = $items;

  // Write parameters to file.
  $path = coder_upgrade_path('runtime');

  // @todo Use random name and delete afterwards.
  file_put_contents($path, serialize($parameters));
  return $path;
}