- user web: host merge: don't require OS names to match exactly;

OK if both contain "Windows", "Linux", "SunOS" or "Darwin".

html/inc/
    host.inc

svn path=/trunk/boinc/; revision=13038
This commit is contained in:
David Anderson 2007-06-27 18:14:25 +00:00
parent 45639a8019
commit 6f94f032a4
2 changed files with 27 additions and 3 deletions

View File

@ -6781,3 +6781,10 @@ David 27 June 2007
html/inc/
host.inc
David 27 June 2007
- user web: host merge: don't require OS names to match exactly;
OK if both contain "Windows", "Linux", "SunOS" or "Darwin".
html/inc/
host.inc

View File

@ -303,6 +303,14 @@ function times_disjoint($host1, $host2) {
return false;
}
function os_compatible($host1, $host2) {
if (strstr($host1->os_name, "Windows") && strstr($host2->os_name, "Windows")) return true;
if (strstr($host1->os_name, "Linux") && strstr($host2->os_name, "Linux")) return true;
if (strstr($host1->os_name, "Darwin") && strstr($host2->os_name, "Darwin")) return true;
if (strstr($host1->os_name, "SunOS") && strstr($host2->os_name, "SunOS")) return true;
return false;
}
// Return true if it's possible that the two host records
// correspond to the same host
// NOTE: the cheat-proofing comes from checking
@ -313,10 +321,19 @@ function hosts_compatible($host1, $host2) {
// skip disjoint-time check if one host or other has no credit
//
if ($host1->total_credit && $host->total_credit) {
if (!times_disjoint($host1, $host2)) return false;
if (!times_disjoint($host1, $host2)) {
//echo "<br>h2 $host2->create_time $host2->rpc_time";
return false;
}
}
if (!os_compatible($host1, $host2)) {
//echo "<br>$host1->id $host2->id: name\n";
return false;
}
if (!cpus_compatible($host1, $host2)) {
//echo "<br>$host1->id $host2->id: cpu\n";
return false;
}
if ($host2->os_name != $host1->os_name) return false;
if (!cpus_compatible($host1, $host2)) return false;
return true;
}