diff --git a/checkin_notes b/checkin_notes index 35ea4fee9d..29e70ef069 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8004,3 +8004,24 @@ Karl 2003-12-02 - created export-tarball program for nightly-tarball nightly-tarball + +David 28 Nov 2003 + - changed indices on result table + changed res_hostid to include id desc + removed res_wuid + added app_received_time + - removed "last result for host" info from web pages; + this required an index with no other function + - added comments to constraints.sql explaining why each index is needed + - add "subscriptions" table to schema.sql + + db/ + constraints.sql + schema.sql + html_user/ + host.inc + totals.php + util.inc + forum/ + post.php + subscribe.inc diff --git a/db/constraints.sql b/db/constraints.sql index c4b1d8ad17..75c54c059e 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -22,33 +22,71 @@ alter table user add unique(authenticator), add index ind_tid (teamid), add index user_tot (total_credit desc), + -- db_dump.C add index user_avg (expavg_credit desc); + -- db_dump.C alter table team add unique(name), add index team_avg (expavg_credit desc), + -- db_dump.C add index team_tot (total_credit desc); + -- db_dump.C alter table workunit add unique(name), + -- not currently used but good invariant add index wu_val (appid, need_validate), + -- validator add index wu_timeout (transition_time), + -- transitioner add index wu_filedel (file_delete_state), + -- file_deleter add index wu_assim (appid, assimilate_state); + -- assimilator alter table result add unique(name), - add index res_wuid (workunitid), + -- the scheduler looks up results by name + + //add index res_wuid (workunitid), + // -- transitioner + // -- NOTE: res_wu_user may suffice; could try dropping this one + add index ind_res_st (server_state, random), + -- feeder (random is to avoid sending WU result close together) + + add index res_app_state(appid, server_state), + -- splitter, e.g. + add index res_filedel (file_delete_state), - add index res_hostid (hostid), + -- file_deleter + + add index res_userid_id(userid, id desc), + -- html_user/results.php + + add index res_userid_val(userid, validate_state), + -- to show pending credit + + add index res_hostid (hostid, id desc), + -- html_user/results.php + add index res_wu_user (workunitid, userid), + -- scheduler (avoid sending mult results of same WU to one user) + add index app_received_time (appid, received_time desc); + -- html_ops/result_summary.php alter table host add index host_user (userid), + -- html_user/host_user.php add index host_avg (expavg_credit desc), + -- db_dump.C add index host_tot (total_credit desc); + -- db_dump.C alter table profile add unique profile_userid(userid); + +alter table subscriptions + add unique sub_unique(userid, threadid); diff --git a/db/schema.sql b/db/schema.sql index 33d1e1058c..a6ecdd402b 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -317,3 +317,9 @@ create table post ( primary key (id) ); +-- subscription to a thread +-- +create table subscriptions ( + userid integer not null, + threadid integer not null +); diff --git a/html/forum/post.php b/html/forum/post.php index c0a72edc01..ee93b02a0e 100644 --- a/html/forum/post.php +++ b/html/forum/post.php @@ -91,10 +91,10 @@ if ($category->is_helpdesk) { echo "
If you are having software problems, mention the version number of the software, - your computer type, operating system, etc. + your computer type and operating system. "; -} else { +} echo " diff --git a/html/forum/subscribe.inc b/html/forum/subscribe.inc index e6c3aea5f6..c50d18452e 100644 --- a/html/forum/subscribe.inc +++ b/html/forum/subscribe.inc @@ -13,16 +13,6 @@ function subscribe($thread, $user=null) { $user = get_logged_in_user(true, '../'); } - $sql = "SELECT * FROM subscriptions WHERE (userid = " . $user->id . ") AND (threadid = " . $thread->id . ")"; - $result = mysql_query($sql); - - // If they're already subscribed, don't add them again; - if (mysql_num_rows($result) > 0) { - // TODO: Specific "error" page for this case. - show_result_page("subscribe", true, $thread); - exit(); - } - $sql = "INSERT INTO subscriptions SET userid = " . $user->id . ", threadid = " . $thread->id; show_result_page("subscribe", (mysql_query($sql) != null), $thread); } @@ -47,11 +37,11 @@ function show_result_page($action, $success, $thread) { echo "
You are now subscribed to ", stripslashes($thread->title), ". You will receive an email whenever another user posts to this thread.
"; } else if ($action == "unsubscribe" && $success) { page_head("Unsubscription Successful"); - echo "Unsubscription successful"; + echo "Unsubscription successful"; echo "You have successfully unsubscribed from ", stripslashes($thread->title), ". You will no longer receive emails for posts to this thread.
"; } else if ($action == "subscribe" && !$success) { page_head("Subscription Failed"); - echo "Subscription failed"; + echo "Subscription failed"; if ($thread) { echo "There was a problem subscribing you to ", stripslashes($thread->title), ". Please try again later.
"; } else { @@ -88,7 +78,7 @@ function notify_subscribers($threadID) { } function send_notice_email($userId, $threadID) { - $thread = getThread($threadID); + $thread = getThread($threadID); $result = mysql_query("SELECT * FROM user WHERE id = $userId"); $row = mysql_fetch_assoc($result); @@ -96,9 +86,9 @@ function send_notice_email($userId, $threadID) { $title = PROJECT . ": A user has posted to your subscribed thread."; $link = URL_BASE . "forum/thread.php?id=" . $threadID; $body = "Another " . PROJECT . " user has posted to the thread \"" . stripslashes($thread->title) . "\".\n" - ."To view the updated thread, direct your web browser to the following URL:\n\n$link"; + ."To view the updated thread, visit the following URL:\n\n$link"; mail($row['email_addr'], $title, $body); } -?> \ No newline at end of file +?> diff --git a/html/user/host.inc b/html/user/host.inc index 341a7ea09b..7291aecf81 100644 --- a/html/user/host.inc +++ b/html/user/host.inc @@ -76,15 +76,10 @@ function show_host($host, $private) { } else { row2("Average download rate", "Unknown"); } - $last_result = host_last_result($host); $nresults = host_nresults($host); $nresults_success = host_nresults_success($host); $nresults_valid = host_nresults_valid($host); $results = "$nresults_valid valid / $nresults_success successful / id>$nresults total"; - if ($last_result) { - $time_last_result = time_str($last_result->received_time); - $results .= "