You are here

function hosting_migrate_comparison in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 migrate/hosting_migrate.module \hosting_migrate_comparison()
  2. 7.4 migrate/hosting_migrate.module \hosting_migrate_comparison()

Compare package schema versions between the current and target platform in temp tables

1 string reference to 'hosting_migrate_comparison'
hosting_migrate_menu in migrate/hosting_migrate.module
Implements hook_menu().

File

migrate/hosting_migrate.module, line 220

Code

function hosting_migrate_comparison($current, $target) {
  $current_tbl = _hosting_package_temporary_table($current);
  $target_tbl = _hosting_package_temporary_table($target);
  $packages = array();
  $result = db_query("SELECT c.nid, c.short_name,\n    c.version as current_version, t.version as target_version,\n    c.version_code as current_version_code, t.version_code as target_version_code,\n    c.schema_version as current_schema, t.schema_version as target_schema, c.status AS enabled\n    FROM {$current_tbl} c LEFT JOIN {$target_tbl} t ON c.nid = t.nid ORDER BY c.status DESC, short_name");
  while ($obj = $result
    ->fetch()) {
    if (isset($obj->current_schema) && (int) $obj->target_schema > 0 && (int) $obj->current_schema > (int) $obj->target_schema) {
      $obj->status = 'downgrade';
    }
    elseif ($obj->current_version_code > $obj->target_version_code || is_null($obj->target_version_code)) {
      $obj->status = 'missing';
    }
    elseif ($obj->current_version_code < $obj->target_version_code || $obj->current_schema < $obj->target_schema) {
      $obj->status = 'upgrade';
    }
    else {
      $obj->status = 'same';
    }
    $packages[$obj->nid] = $obj;
  }
  return theme("hosting_migrate_comparison", array(
    'packages' => $packages,
  ));
}