Index: site/hosting_site.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hosting/site/hosting_site.install,v
retrieving revision 1.12
diff -u -p -r1.12 hosting_site.install
--- site/hosting_site.install	13 Sep 2009 13:12:55 -0000	1.12
+++ site/hosting_site.install	26 Sep 2009 00:18:41 -0000
@@ -220,3 +220,16 @@ function hosting_site_update_6002() {
   db_add_field($ret, 'hosting_site', 'ssl_redirect', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
   return $ret;
 }
+
+// Update imported sites that have port 0 in the db. See #588072
+function hosting_site_update_6003() {
+  $ret = array();
+  $sites = db_query("SELECT nid, platform FROM {hosting_site} WHERE port = 0");
+  while ($obj = db_fetch_object($sites)) {
+    $showports = _hosting_site_allowed_ports($obj->platform);
+    $defport = reset($showports);
+    $result = db_query("UPDATE {hosting_site} SET port = '%s' WHERE nid = %d AND port = 0", $defport, $obj->nid);
+  }
+  return $ret;
+}
+
Index: site/hosting_site.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hosting/site/hosting_site.module,v
retrieving revision 1.126
diff -u -p -r1.126 hosting_site.module
--- site/hosting_site.module	17 Sep 2009 07:09:37 -0000	1.126
+++ site/hosting_site.module	26 Sep 2009 00:18:41 -0000
@@ -146,6 +146,11 @@ function hosting_import_site($site_id, $
   $db_server = hosting_get_db_server($data['db_id']);
   $site->db_server = ($db_server) ? $db_server->nid : HOSTING_DEFAULT_DB_SERVER;
   $site->site_language = $data['language'] ? $data['language'] : 'en';
+  // Try and find a default port from the web server and use that for the imported site.
+  // Needs to be improved (one vhost > many ports, and a proper 'default port' feature
+  $showports = _hosting_site_allowed_ports($platform);
+  $defport = reset($showports);
+  $site->port = $defport;
 
   // Drupal 6 introduced a language field on nodes
   unset($data['language']);
