310ed9324362faacfdf0ca7d0cd011605ce2e750 galt Tue Nov 28 03:05:06 2023 -0800 Improving ability to restore symlinked files back into their wrangle or submit directories so they are not lost. Includes special files such as 2bit under the path "". Handles either one dataset at a time, or can with great care be used to restore all files for all sets. Great care must be used with this command, and observe many caviots as well. We have no real way to preserve our symlinks other than this. diff --git src/hg/cirm/cdw/inc/cdwLib.h src/hg/cirm/cdw/inc/cdwLib.h index 0244a69..e1612ae 100644 --- src/hg/cirm/cdw/inc/cdwLib.h +++ src/hg/cirm/cdw/inc/cdwLib.h @@ -505,30 +505,34 @@ /* For a file that was just copied, remove original and symlink to new one instead * to save space. Follows symlinks if any to the real file and replaces it with a symlink */ int findSubmitSymlinkExt(char *submitFileName, char *submitDir, char **pPath, char **pLastPath, int *pSymlinkLevels); /* Find the last symlink and real file in the chain from submitDir/submitFileName. * This is useful for when target of symlink in cdw/ gets renamed * (e.g. license plate after passes validation), or removed (e.g. cdwReallyRemove* commands). * Returns 0 for success. / * Returns -1 if path does not exist. */ char *findSubmitSymlink(char *submitFileName, char *submitDir, char *oldPath); /* Find the last symlink in the chain from submitDir/submitFileName. * This is useful for when target of symlink in cdw/ gets renamed * (e.g. license plate after passes validation), or removed (e.g. cdwReallyRemove* commands). */ +void safeCopyFile(char *source, char *dest); +/* Copy file from source to dest using temp file. Perform move at the end only when the file is complete. + * Prevents partial copies. */ + void cdwReallyRemoveFile(struct sqlConnection *conn, char *submitDir, long long fileId, boolean unSymlinkOnly, boolean really); /* Remove all records of file from database and from Unix file system if * the really flag is set. Otherwise just print some info on the file. */ char *cdwHeadTagDependencies(struct cart *cart, boolean makeAbsolute); /* Return page head dependencies string. This is content that actually appears at the top * of the page, in the head tag. Optionally make links point to absolute URLs instead of relative. */ char *cdwPageHeader(struct cart *cart, boolean makeAbsolute); /* Return page header string. This is content that actually appears at the top * of the page, like menu stuff. Optionally make links point to absolute URLs instead of relative. */ char *cdwPageFooter(struct cart *cart, boolean makeAbsolute); /* Return page footer string. This is content that appears in the page footer, like * links to other institutions etc. Optionally make any relative URLs into absolute