Index: src/hg/lib/wikiTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/wikiTrack.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -b -B -U 4 -r1.26 -r1.27
--- src/hg/lib/wikiTrack.c	23 Jan 2009 22:39:53 -0000	1.26
+++ src/hg/lib/wikiTrack.c	10 Feb 2010 21:41:36 -0000	1.27
@@ -6,8 +6,9 @@
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
 #include "wikiTrack.h"
+#include "errCatch.h"
 
 static char const rcsid[] = "$Id$";
 
 void wikiTrackStaticLoad(char **row, struct wikiTrack *ret)
@@ -328,8 +329,9 @@
 /*determine if wikiTrack can be used, and is this user logged into the wiki ?*/
 {
 static boolean done = FALSE;
 static boolean status = FALSE;
+static boolean wikiUp = FALSE;
 static char *userName = NULL;
 
 /* do not repeat this query */
 if (done)
@@ -377,10 +379,24 @@
     char *wikiUser = wikiLinkUserName();
     if ( (wikiUser) &&
 	(findCookieData(cfgOption(CFG_WIKI_SESSION_COOKIE)) != NULL) )
 	{
-	    struct htmlPage *page = fetchEditPage(TEST_EMAIL_VERIFIED);
-	    char *loginExpired = stringIn(LOGIN_EXPIRED, page->fullText);
+	    struct htmlPage *page = NULL;
+	    /* protect against temporarily offline wiki site */
+	    struct errCatch *errCatch = errCatchNew();
+	    if (errCatchStart(errCatch))
+		{
+		page = fetchEditPage(TEST_EMAIL_VERIFIED);
+		}
+	    errCatchEnd(errCatch);
+	    if (! errCatch->gotError)
+		{
+		wikiUp = TRUE;
+		}
+	    errCatchFree(&errCatch);
+	    char *loginExpired = NULL;
+	    if (page)
+		loginExpired = stringIn(LOGIN_EXPIRED, page->fullText);
 	    if (loginExpired == NULL)
 		userName = wikiUser;	/* save result for next time */
 	}
     /* see if table exists, create it if it is not yet there */
@@ -391,8 +407,9 @@
 	sqlUpdate(wikiConn, query);
 	freeMem(query);
 	}
     wikiDisconnect(&wikiConn);
+    if (wikiUp)
     status = TRUE; /* system is enabled */
     }
 if (wikiUserName)
     *wikiUserName = userName;  /* returning name indicates logged in */

