*** empty log message ***

svn path=/trunk/boinc/; revision=2854
This commit is contained in:
David Anderson 2004-01-08 00:09:26 +00:00
parent 6b68c38794
commit a64cad881c
11 changed files with 121 additions and 58 deletions

View File

@ -8959,3 +8959,28 @@ David 6 Jan 2004
forum/
repair.php (new)
user_posts.php
David 7 Jan 2004
- don't show #results in 1-line host summary (too slow)
- totally redid "host merge" mechanism.
- show all hosts that are compatible with this one
(not just older ones)
- show checkboxes with "select all" button
so you can easily merge large #s of hosts
- merge logic merges into newest host
- let anyone look at any result and any host
(may want to change this later,
but for now it helps with debuggin)
html_user/
host.inc
host_edit_action.php
host_edit_form.php
repair.php
result.php
results.php
show_host_detail.php
user.inc
workunit.php
sched/
handle_request.C

View File

@ -125,7 +125,6 @@ function host_table_start($title, $private, $show_owner) {
<th>Total credit</th>
<th>CPU type</th>
<th>Operating system</th>
<th>Results</th>
</tr>
";
}
@ -172,9 +171,9 @@ function show_host_row($host, $i, $private, $show_owner) {
$host->os_name, $host->os_version
);
$nresults = host_nresults($host);
echo "<td><a href=results.php?hostid=$host->id>$nresults</a>";
echo "</td></tr>\n";
//$nresults = host_nresults($host);
//echo "<td><a href=results.php?hostid=$host->id>$nresults</a></td>";
echo "</tr>\n";
}
// return true iff it's possible that the hosts are actually

View File

@ -4,59 +4,73 @@
require_once("host.inc");
function fail($msg) {
page_head("Host merge failed");
echo $msg;
echo "Error: $msg";
page_tail();
exit();
}
db_init();
$user = get_logged_in_user();
function get_host($hostid, $user) {
$host = lookup_host($hostid);
if (!$host || $host->userid != $user->id) {
fail("No such host");
}
return $host;
}
$hostid = $_GET["hostid"];
$targetid = $_GET["targetid"];
if ($hostid == $targetid) {
function merge_hosts($old_host, $new_host) {
if ($old_host->id == $new_host->id) {
fail("same host");
}
$result = mysql_query("select * from host where id=$hostid");
$old_host = mysql_fetch_object($result);
mysql_free_result($result);
if (!$old_host || $old_host->userid != $user->id) {
fail("Host not found");
}
$result = mysql_query("select * from host where id=$targetid");
$new_host = mysql_fetch_object($result);
mysql_free_result($result);
if (!$new_host || $new_host->userid != $user->id) {
fail("Host not found");
}
if (!hosts_compatible($old_host, $new_host)) {
fail("Can't merge hosts - they're incompatible");
}
echo "<br>Merging $old_host->id into $new_host->id\n";
// update the database:
// - add credit from old to new host
// - change results to refer to new host
// - delete old host
$t = $old_host->total_credit + $new_host->total_credit;
$a = $old_host->expavg_credit + $new_host->expavg_credit;
$result = mysql_query("update host set total_credit=$t, expavg_credit=$a where id=$new_host->id");
$result = mysql_query("update host set total_credit=$t where id=$new_host->id");
if (!result) {
fail("Couldn't update credit of new host");
}
$result = mysql_query("update result set hostid=$targetid where hostid=$hostid");
$result = mysql_query("update result set hostid=$new_host->id where hostid=$old_host->id");
if (!$result) {
fail("Couldn't update results");
}
$result = mysql_query("delete from host where id=$hostid");
$result = mysql_query("delete from host where id=$old_host->id");
if (!$result) {
fail("Couldn't delete host");
}
Header("Location: show_host_detail.php?hostid=$targetid");
}
db_init();
$user = get_logged_in_user();
page_head("Host merge");
$nhosts = $_GET["nhosts"];
$hostid = $_GET["id_0"];
$latest_host = get_host($hostid, $user);
for ($i=1; $i<$nhosts; $i++) {
$var = "id_$i";
$hostid = $_GET[$var];
if (!$hostid) continue;
$host = get_host($hostid, $user);
if ($host->create_time > $latest_host->create_time) {
merge_hosts($latest_host, $host);
$latest_host = $host;
} else {
merge_hosts($host, $latest_host);
}
}
echo "
<p><a href=hosts_user.php>Return to list of your computers</a>
";
page_tail();
//Header("Location: show_host_detail.php?hostid=$latest_host->id");
?>

View File

@ -20,27 +20,49 @@ if (!$host || $host->userid != $user->id) {
$t = time_str($host->create_time);
echo "
Sometimes BOINC assigns separate identities to the same host.
Sometimes BOINC assigns separate identities to the same computer by mistake.
You can correct this by merging old identities with the newest one.
<form action=host_edit_action.php>
<input type=hidden name=hostid value=$hostid>
<form name=blah action=host_edit_action.php>
<input type=hidden name=id_0 value=$hostid>
<p>
Check the computers that are the same as $host->domain_name (created $t):
<p>
Merge $host->domain_name (created $t) with
<select name=targetid>
<option value=0> -
";
$result = mysql_query("select * from host where userid=$user->id");
$nhosts = 1;
while ($host2 = mysql_fetch_object($result)) {
if ($host->id == $host2->id) continue;
if ($host2->create_time < $host->create_time) continue;
//if ($host2->create_time > $host->create_time) continue;
if (!hosts_compatible($host, $host2)) continue;
$t = time_str($host2->create_time);
echo "<option value=$host2->id> $host2->domain_name (created $t)\n";
echo "<br><input type=checkbox name=id_$nhosts value=$host2->id> $host2->domain_name (created $t)\n";
$nhosts++;
if ($nhosts==500) break;
}
mysql_free_result($result);
echo "
<br>
<script>
function set_all() {
";
for ($i=1; $i<$nhosts; $i++) {
echo "document.blah.id_$i.checked=1;\n";
}
echo "
</select>
<input type=submit value='Merge host'>
}
function clear_all() {
";
for ($i=1; $i<$nhosts; $i++) {
echo "document.blah.id_$i.checked=0;\n";
}
echo "
}
</script>
<p><a href=javascript:set_all()>Select all</a>
<p><a href=javascript:clear_all()>Unselect all</a>
<input type=hidden name=nhosts value=$nhosts>
<p><input type=submit value='Merge hosts'>
</form>
";

View File

@ -16,7 +16,7 @@ function wu_over($wu) {
}
function fix_validate_state() {
for ($i=0; $i<825637; $i++) {
for ($i=458983; $i<825637; $i++) {
$result = mysql_query("select * from workunit where id=$i");
$wu = mysql_fetch_object($result);
if ($wu) {

View File

@ -12,10 +12,14 @@
$r = mysql_query("select * from result where id=$resultid");
$result = mysql_fetch_object($r);
mysql_free_result($r);
if (!$result || $result->userid != $user->id) {
if (!$result) {
echo "No such result";
exit();
}
//if ($result->userid != $user->id) {
// echo "No access";
// exit();
//}
show_result($result);
page_tail();
?>

View File

@ -17,10 +17,10 @@
if ($hostid) {
$host = lookup_host($hostid);
if (!$host || $host->userid != $user->id) {
echo "No access";
exit();
}
// if (!$host || $host->userid != $user->id) {
// echo "No access";
// exit();
// }
$type = "host";
$clause = "hostid=$hostid";
} else {

View File

@ -14,7 +14,7 @@
}
$private = false;
$user = get_logged_in_user();
if ($user || $user->id == $host->userid) {
if ($user && $user->id == $host->userid) {
$private = true;
}

View File

@ -74,8 +74,6 @@ function show_user_profile_private($user) {
// show summary of dynamic and static info (public)
function show_user_summary_public($user) {
$result = mysql_query("SELECT * FROM profile WHERE userid = $user->id");
row1("Account data for $user->name");
row2(PROJECT." member since", time_str($user->create_time));
row2("Country", $user->country);
@ -85,10 +83,6 @@ function show_user_summary_public($user) {
row2("Total credit", format_credit($user->total_credit));
row2("Recent average credit", format_credit($user->expavg_credit));
if (mysql_num_rows($result) != 0) {
row2("Profile", "<a href=view_profile.php?userid=$user->id>View</a>");
}
if ($user->teamid) {
$result = mysql_query("select * from team where id = $user->teamid");
$team = mysql_fetch_object($result);

View File

@ -24,10 +24,10 @@
echo "</table>\n";
echo "<br><br><b>Results:</b>\n";
result_table_start(false, true, false);
result_table_start(false, true, true);
$result = mysql_query("select * from result where workunitid=$wuid");
while ($res = mysql_fetch_object($result)) {
show_result_row($res, false, true, false);
show_result_row($res, false, true, true);
}
mysql_free_result($result);
echo "</table>\n";

View File

@ -329,6 +329,11 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
// Make a new host record.
if (sreq.rpc_seqno < reply.host.rpc_seqno) {
sreq.hostid = 0;
log_messages.printf(
SchedMessages::NORMAL,
"[HOST#%d] [USER#%d] RPC seqno %d less than expected %d; creating new host\n",
reply.host.id, user.id, sreq.rpc_seqno, reply.host.rpc_seqno
);
goto new_host;
}
reply.host.rpc_seqno = sreq.rpc_seqno;