5b52f94be8580d3538787e63d0828de8376b181e
braney
  Thu Mar 8 17:11:45 2018 -0800
add a specific warning for collections that disappear telling users to
save them in a session

diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index 6b1ca82..70d5965 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -192,32 +192,34 @@
     AllocVar(hub);
     hub->id = id;
     hub->hubUrl = cloneString(row[0]);
     hub->status = sqlUnsigned(row[1]);
     hub->errorMessage = cloneString(row[2]);
     char *shortLabel = row[4];
 
     if (isEmpty(row[2]) || hubTimeToCheck(hub, row[3]))
 	{
 	char *errorMessage = NULL;
 	hub->trackHub = fetchHub( hub, &errorMessage);
 	hub->errorMessage = cloneString(errorMessage);
 	hubUpdateStatus( hub->errorMessage, hub);
 	if (!isEmpty(hub->errorMessage))
 	    {
-            // we need to do something special here to 
-            // not warn about local hubs disappearing
+            boolean isCollection = (strstr(hub->hubUrl, "hgComposite") != NULL);
+            if (isCollection)
+                warn("Your Track Collections have been removed by our trash collectors.  If you'd like your Track Collections to stay on our servers, you need to save them in a session." );
+            else
                 warn("Could not connect to hub \"%s\": %s", shortLabel, hub->errorMessage);
 	    }
 	}
     }
 sqlFreeResult(&sr);
 return hub;
 }
 
 struct hubConnectStatus *hubConnectStatusListFromCartAll(struct cart *cart)
 /* Return list of all track hubs that are referenced by cart. */
 {
 struct hubConnectStatus *hubList = NULL, *hub;
 struct slPair *pair, *pairList = cartVarsWithPrefix(cart, hgHubConnectHubVarPrefix);
 struct sqlConnection *conn = hConnectCentral();
 for (pair = pairList; pair != NULL; pair = pair->next)
@@ -235,30 +237,39 @@
 return hubList;
 }
 
 struct hubConnectStatus *hubConnectStatusListFromCart(struct cart *cart)
 /* Return list of track hubs that are turned on by user in cart. */
 {
 struct hubConnectStatus *hubList = NULL, *hub;
 struct slName *name, *nameList = hubConnectHubsInCart(cart);
 struct sqlConnection *conn = hConnectCentral();
 for (name = nameList; name != NULL; name = name->next)
     {
     int id = sqlSigned(name->name);
     hub = hubConnectStatusForId(conn, id);
     if (hub != NULL)
 	{
+	if (!isEmpty(hub->errorMessage) && (strstr(hub->hubUrl, "hgComposite") != NULL))
+            {
+            // custom collection hub has disappeared.   Remove it from cart
+            cartSetString(cart, hgHubConnectRemakeTrackHub, "on");
+            char buffer[1024];
+            safef(buffer, sizeof buffer, "hgHubConnect.hub.%d", id);
+            cartRemove(cart, buffer);
+            }
+        else
             slAddHead(&hubList, hub);
 	}
     }
 slFreeList(&nameList);
 hDisconnectCentral(&conn);
 slReverse(&hubList);
 return hubList;
 }
 
 int hubIdFromCartName(char *cartName)
 /* Given something like "hgHubConnect.hub.123" return 123 */
 {
 assert(startsWith("hgHubConnect.hub.", cartName));
 
 char *ptr1 = strchr(cartName, '.');