You are here

function upgrade_assist_system_info_alter in Upgrade Status 6

Implements hook_system_info_alter().

Don't try this at home.

File

upgrade_assist/upgrade_assist.module, line 13
Assists in upgrading Drupal.

Code

function upgrade_assist_system_info_alter(&$info, $file) {

  // Upgrade Assist has been designed to be compatible with multiple major
  // versions of Drupal core. To be able to continue the upgrade assistance
  // after replacing Drupal core, the Drupal core compatibility of Upgrade
  // Assist module is adjusted upon the first invocation of
  // update_check_incompatibility() in the new environment (called from
  // update.php/update.inc).
  if ($file->name == 'upgrade_assist' && $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
    $info['core'] = DRUPAL_CORE_COMPATIBILITY;
    if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
      if (DRUPAL_CORE_COMPATIBILITY == '7.x') {
        $system_info = db_query('SELECT info FROM {system} WHERE name = :name', array(
          ':name' => 'upgrade_assist',
        ))
          ->fetchField();
        $system_info = unserialize($system_info);
        $system_info['core'] = DRUPAL_CORE_COMPATIBILITY;
        db_update('system')
          ->fields(array(
          'info' => serialize($system_info),
        ))
          ->condition('name', 'upgrade_assist')
          ->execute();
      }
    }
  }
}