From faf7fe54c84c07dff3fec9d24d5998d8160d684a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 11 Feb 2011 00:37:01 +0000 Subject: [PATCH] - client: if a logical filename contains /'s, create the needed dirs under the slot dir - user web: pages with translatable text should not be cached. Fix this for home page; there are some others svn path=/trunk/boinc/; revision=23019 --- checkin_notes | 11 +++++++++++ client/app_start.cpp | 39 +++++++++++++++++++++++++++++++++----- html/user/sample_index.php | 14 +------------- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/checkin_notes b/checkin_notes index 60c8a40c63..a632a833e3 100644 --- a/checkin_notes +++ b/checkin_notes @@ -647,3 +647,14 @@ David 10 Feb 2011 forum_index.php style2.css white.css + +David 10 Feb 2011 + - client: if a logical filename contains /'s, + create the needed dirs under the slot dir + - user web: pages with translatable text should not be cached. + Fix this for home page; there are some others + + client/ + app_start.cpp + html/user/ + sample_index.php diff --git a/client/app_start.cpp b/client/app_start.cpp index a23dce6959..46dfa2edcf 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -272,6 +272,32 @@ int ACTIVE_TASK::write_app_init_file() { return retval; } +// Given a logical name of the form D1/D2/.../Dn/F, +// create the directories D1 ... Dn in the slot dir +// +static int create_dirs_for_logical_name( + const char* name, const char* slot_dir +) { + char buf[1024]; + char dir_path[1024]; + int retval; + + strcpy(buf, name); + strcpy(dir_path, slot_dir); + char* p = buf; + while (1) { + char* q = strstr(p, "/"); + if (!q) break; + *q = 0; + strcat(dir_path, "/"); + strcat(dir_path, p); + retval = boinc_mkdir(dir_path); + if (retval) return retval; + p = q+1; + } + return 0; +} + // set up a file reference, given a slot dir and project dir. // This means: // 1) copy the file to slot dir, if reference is by copy @@ -284,10 +310,13 @@ static int setup_file( char link_path[256], rel_file_path[256]; int retval; - sprintf(link_path, - "%s/%s", - slot_dir, strlen(fref.open_name)?fref.open_name:fip->name - ); + if (strlen(fref.open_name)) { + create_dirs_for_logical_name(fref.open_name, slot_dir); + sprintf(link_path, "%s/%s", slot_dir, fref.open_name); + } else { + sprintf(link_path, "%s/%s", slot_dir, fip->name); + } + sprintf(rel_file_path, "../../%s", file_path ); // if anonymous platform, this is called even if not first time, @@ -902,7 +931,7 @@ int ACTIVE_TASK::start(bool first_time) { } #endif } - sprintf(buf, "../../%s", exec_path ); + sprintf(buf, "../../%s", exec_path); if (g_use_sandbox) { char switcher_path[100]; sprintf(switcher_path, "../../%s/%s", diff --git a/html/user/sample_index.php b/html/user/sample_index.php index 92beeff32b..7c955bf437 100644 --- a/html/user/sample_index.php +++ b/html/user/sample_index.php @@ -79,12 +79,6 @@ function show_nav() { "; } -$caching = false; - -if ($caching) { - start_cache(INDEX_PAGE_TTL); -} - $stopped = web_stopped(); $rssname = PROJECT . " RSS 2.0" ; $rsslink = URL_BASE . "rss_main.php"; @@ -149,12 +143,6 @@ echo " "; - -if ($caching) { - page_tail_main(true); - end_cache(INDEX_PAGE_TTL); -} else { - page_tail_main(); -} +page_tail_main(); ?>