96afd08508a23f69529b0d180d39721fb6231ad7
galt
Thu Aug 22 17:04:14 2013 -0700
adding support for non-versioned links which work better for qaPushQ
diff --git src/hg/lib/web.c src/hg/lib/web.c
index d99aeda..e22f172 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -174,33 +174,30 @@
newString = cloneString(textOutBuf);
for(ptr1=newString, ptr2=textOutBuf; *ptr2 ; ptr2++)
{
if (*ptr2 == '<')
{
for(; *ptr2 && (*ptr2 != '>'); ptr2++)
;
}
else
*ptr1++ = *ptr2;
}
*ptr1 = 0;
htmlTextOut(newString);
printf(" \n ");
- if (endsWith(scriptName, "qaPushQ")) // Tired of failed stylesheet versioning that messes up RR releaseLog.html (regular and ENCODE)
- printf(" \n");
- else
webIncludeResourceFile("HGStyle.css");
if (extraStyle != NULL)
puts(extraStyle);
printf("\n");
printBodyTag(stdout);
htmlWarnBoxSetup(stdout);// Sets up a warning box which can be filled with errors as they occur
puts(commonCssStyles());
}
puts(
"" "\n"
"" "\n"
"
" "\n");
if (withLogo)
{
@@ -1222,31 +1219,40 @@
// tolerate missing docRoot (i.e. when running from command line)
fullDirName = dyStringCreate("%s", dirName);
if (!fileExists(dyStringContents(fullDirName)))
errAbort("webTimeStampedLinkToResource: dir: %s doesn't exist.\n",
dyStringContents(fullDirName));
// build and verify real path to file
struct dyString *realFileName = dyStringCreate("%s/%s", dyStringContents(fullDirName), fileName);
if (!fileExists(dyStringContents(realFileName)))
errAbort("webTimeStampedLinkToResource: file: %s doesn't exist.\n",
dyStringContents(realFileName));
// build and verify link path including timestamp in the form of dir/baseName + timeStamp or CGI Version + ext
long mtime = fileModTime(dyStringContents(realFileName));
struct dyString *linkWithTimestamp;
-if ((cfgOption("versionStamped") == NULL) && (hIsPreviewHost() || hIsPrivateHost()))
+
+char *scriptName = cgiScriptName();
+if (scriptName == NULL)
+ scriptName = cloneString("");
+boolean nonVersionedLinks = FALSE;
+if (endsWith(scriptName, "qaPushQ"))
+ nonVersionedLinks = TRUE;
+if (nonVersionedLinks)
+ linkWithTimestamp = dyStringCreate("%s/%s%s", dyStringContents(fullDirName), baseName, extension);
+else if ((cfgOption("versionStamped") == NULL) && (hIsPreviewHost() || hIsPrivateHost()))
linkWithTimestamp = dyStringCreate("%s/%s-%ld%s", dyStringContents(fullDirName), baseName, mtime, extension);
else
linkWithTimestamp = dyStringCreate("%s/%s-v%s%s", dyStringContents(fullDirName), baseName, CGI_VERSION, extension);
if (!fileExists(dyStringContents(linkWithTimestamp)))
errAbort("Cannot find correct version of file '%s'; this is due to an installation error\n\nError details: %s does not exist",
fileName, dyStringContents(linkWithTimestamp));
// Free up all that extra memory
dyStringFree(&realFileName);
dyStringFree(&fullDirName);
char *linkFull = dyStringCannibalize(&linkWithTimestamp);
char *link = linkFull;
if (docRoot != NULL)
{