767f6d5f100faf63370d0a0c317db0311c055d64
braney
  Thu Aug 19 16:20:12 2021 -0700
update dbCount when updating dbList in the hubPublic table

diff --git src/hg/utils/hubPublicCheck/hubPublicCheck.c src/hg/utils/hubPublicCheck/hubPublicCheck.c
index 59ca865..79ad1b0 100644
--- src/hg/utils/hubPublicCheck/hubPublicCheck.c
+++ src/hg/utils/hubPublicCheck/hubPublicCheck.c
@@ -77,37 +77,42 @@
 	{
 	differences++;
 
 	printf("update %s set shortLabel=\"%s\" where hubUrl=\"%s\";\n",table, tHub->shortLabel, url);
 	}
     if (!sameString(longLabel, tHub->longLabel))
 	{
 	differences++;
 
 	printf("update %s set longLabel=\"%s\" where hubUrl=\"%s\";\n",table, tHub->longLabel, url);
 	}
 
     struct dyString *dy = newDyString(1024);
     struct trackHubGenome *genome = tHub->genomeList;
 
+    unsigned dbCount = 0;
     for(; genome; genome = genome->next)
+        {
+        dbCount++;
 	dyStringPrintf(dy, "%s,", trackHubSkipHubName(genome->name));
+        }
 
     if (!sameString(dy->string, dbList))
 	{
 	differences++;
 
+	printf("update %s set dbCount=\"%d\" where hubUrl=\"%s\";\n",table, dbCount, url);
 	printf("update %s set dbList=\"%s\" where hubUrl=\"%s\";\n",table, dy->string, url);
 	}
 
     if (hasDescriptionUrl && !isEmpty(tHub->descriptionUrl) && ((descriptionUrl == NULL) || !sameString(descriptionUrl, tHub->descriptionUrl)))
 	{
 	differences++;
 
 	printf("update %s set descriptionUrl=\"%s\" where hubUrl=\"%s\";\n",table, tHub->descriptionUrl, url);
 	}
 
     trackHubClose(&tHub);
     }
 return differences;
 }
 
@@ -120,38 +125,37 @@
 int dbCount = 0;
 
 if (errCatchStart(errCatch))
     tHub = trackHubOpen(url, "hub_1"); 
 errCatchEnd(errCatch);
 if (errCatch->gotError)
     {
     gotWarning = TRUE;
     warn("%s", errCatch->message->string);
     }
 errCatchFree(&errCatch);
 
 if (gotWarning)
     return 1;
 
-struct hashEl *hel;
-struct hashCookie cookie = hashFirst(tHub->genomeHash);
 struct dyString *dy = newDyString(1024);
 
-while ((hel = hashNext(&cookie)) != NULL)
+struct trackHubGenome *list;
+for(list = tHub->genomeList; list;  list = list->next)
     {
     dbCount++;
-    dyStringPrintf(dy, "%s,", trackHubSkipHubName(hel->name));
+    dyStringPrintf(dy, "%s,", trackHubSkipHubName(list->name));
     }
 
 char *descriptionUrl = tHub->descriptionUrl;
 if (descriptionUrl == NULL)
     descriptionUrl="";
 printf("insert into %s (hubUrl,descriptionUrl,shortLabel,longLabel,registrationTime,dbCount,dbList) values (\"%s\",\"%s\", \"%s\", \"%s\", now(),%d, \"%s\");\n",
     table, url, descriptionUrl, tHub->shortLabel, tHub->longLabel, dbCount, dy->string); 
 
 return 0;
 }
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 optionInit(&argc, argv, options);