You are here

function coder_upgrade_load_code in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/includes/main.inc \coder_upgrade_load_code()

Loads upgrade routine code files.

Parameters

array $upgrades: Array of upgrade sets to apply.

1 call to coder_upgrade_load_code()
coder_upgrade_start in coder_upgrade/includes/main.inc
Prepares conversion environment and starts conversion loop.

File

coder_upgrade/includes/main.inc, line 101
Manages application of conversion routines, logging, and patch file creation.

Code

function coder_upgrade_load_code(&$upgrades) {
  global $_coder_upgrade_upgrade_modules;
  $_coder_upgrade_upgrade_modules = array();
  foreach ($upgrades as $name => $upgrade) {
    $_coder_upgrade_upgrade_modules[] = $upgrade['module'];
    if (isset($upgrade['path']) && !empty($upgrade['path'])) {

      // This is being run as a separate process outside of Drupal.
      $path = DRUPAL_ROOT . '/' . $upgrade['path'];
    }
    else {
      $path = DRUPAL_ROOT . '/' . drupal_get_path('module', $upgrade['module']);
    }
    if (isset($upgrade['files']) && !empty($upgrade['files'])) {
      foreach ($upgrade['files'] as $file) {
        require_once $path . '/' . $file;
      }
    }
    elseif (file_exists($path . '/' . $upgrade['module'] . '.upgrade')) {

      // Default file name is module.upgrade in the module's root directory.
      require_once $path . '/' . $upgrade['module'] . '.upgrade';
    }
  }
  coder_upgrade_memory_print('load upgrade code');
}