2f0d3fa3d2bcbf3e23e834ca68565c470f73939d chmalee Mon Oct 21 12:32:08 2024 -0700 Back end for auto-generating a hub with every user upload done diff --git src/hg/hgHubConnect/hooks/post-finish.c src/hg/hgHubConnect/hooks/post-finish.c index a70a16d..1335cd5 100644 --- src/hg/hgHubConnect/hooks/post-finish.c +++ src/hg/hgHubConnect/hooks/post-finish.c @@ -130,31 +130,50 @@ umask(oldUmask); } copyFile(tusFile, newFile); // the files definitely should not be executable! chmod(newFile, 0666); mustRemove(tusFile); mustRemove(tusInfo); } } } // we've passed all the checks so we can write a new or updated row // to the mysql table and return to the client that we were successful if (exitStatus == 0) { - addNewFileForUser(userName, fileName, fileSize, fileType, lastModified, NULL, db, location); + // create a hub for this upload, which can be edited later + char *hubName = createNewTempHubForUpload(reqId, userName, db, fileName, fileType); + fprintf(stderr, "added hub.txt and hubSpace row for hub for file: '%s'\n", fileName); + fflush(stderr); + struct hubSpace *row = NULL; + AllocVar(row); + row->userName = userName; + row->fileName = fileName; + row->fileSize = fileSize; + row->fileType = fileType; + row->creationTime = NULL; // automatically handled by mysql + row->lastModified = sqlUnixTimeToDate(&lastModified, TRUE); + row->hubNameList = hubName; + row->db = db; + row->location = location; + row->md5sum = md5HexForFile(row->location); + addHubSpaceRowForFile(row); + hubSpaceFree(&row); + fprintf(stderr, "added hubSpace row for file '%s'\n", fileName); + fflush(stderr); } } if (errCatch->gotError) { rejectUpload(response, errCatch->message->string); exitStatus = 1; } errCatchEnd(errCatch); } // always print a response no matter what jsonPrintToFile(response, NULL, stdout, 0); return exitStatus; } int main(int argc, char *argv[])