mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3488
This commit is contained in:
parent
7917a0252d
commit
e3026a1ddc
|
@ -12906,7 +12906,27 @@ David May 31 2004
|
|||
diagnostics.C
|
||||
|
||||
David June 1 2004
|
||||
web stuff:
|
||||
- fix bug in merging > 2 hosts
|
||||
- remove references to html/forum in setup script
|
||||
- move host_update_credit() to host.inc
|
||||
and make an ops page for updating a host's credit
|
||||
|
||||
py/Boinc/
|
||||
setup_project.py
|
||||
|
||||
David June 1 2004
|
||||
- small web fixes related to moving forum files
|
||||
html/
|
||||
inc/
|
||||
forum_show.inc
|
||||
host.inc
|
||||
util.inc
|
||||
ops/
|
||||
host_update_credit.php (new)
|
||||
user/
|
||||
forum_edit.php
|
||||
forum_forum.php
|
||||
forum_user_posts.php
|
||||
host_edit_action.php
|
||||
host_update_credit.php
|
||||
|
|
|
@ -115,7 +115,7 @@ function show_forum($category, $forum, $start, $sort_style) {
|
|||
} else {
|
||||
echo "
|
||||
<td>", $thread->replies+1, "</td>
|
||||
<td align=left>", user_links($user, "../"), "</td>
|
||||
<td align=left>", user_links($user), "</td>
|
||||
<td>", $thread->views, "</td>
|
||||
<td style=\"text-align:right\">", $x, "</td>
|
||||
";
|
||||
|
|
|
@ -217,4 +217,39 @@ function hosts_compatible($host1, $host2) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function host_update_credit($hostid) {
|
||||
$t = 0;
|
||||
$avg = 0;
|
||||
$now = time();
|
||||
$avg_time = 0;
|
||||
$half_life = 86400*7;
|
||||
$r = mysql_query("select * from result where hostid=$hostid order by received_time");
|
||||
while ($result = mysql_fetch_object($r)) {
|
||||
if ($result->granted_credit <= 0) continue;
|
||||
$t += $result->granted_credit;
|
||||
|
||||
// the following taken from lib/util.C
|
||||
//
|
||||
if ($avg_time) {
|
||||
$diff = $result->received_time - $avg_time;
|
||||
if ($diff <=0) $diff = 3600;
|
||||
$diff_days = $diff/86400;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
$avg += (1-$weight)*($result->granted_credit/$diff_days);
|
||||
} else {
|
||||
$dd = ($result->received_time - $result->sent_time)/86400;
|
||||
$avg = $result->granted_credit/$dd;
|
||||
}
|
||||
$avg_time = $result->received_time;
|
||||
echo "<br>$avg\n";
|
||||
}
|
||||
mysql_free_result($r);
|
||||
|
||||
$diff = $now - $avg_time;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
mysql_query("update host set total_credit=$t, expavg_credit=$avg where id=$hostid");
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -433,10 +433,10 @@ function project_is_stopped() {
|
|||
return file_exists("../stop_servers");
|
||||
}
|
||||
|
||||
function user_links($user, $dir='') {
|
||||
$x = "<a href=".$dir."show_user.php?userid=$user->id>$user->name</a>";
|
||||
function user_links($user) {
|
||||
$x = "<a href=show_user.php?userid=$user->id>$user->name</a>";
|
||||
if ($user->has_profile) {
|
||||
$x .= " <a href=".$dir."view_profile?userid=$user->id><img border=0 src=".$dir."head_20.png></a>";
|
||||
$x .= " <a href=view_profile?userid=$user->id><img border=0 src=head_20.png></a>";
|
||||
}
|
||||
return $x;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/host.inc");
|
||||
|
||||
host_update_credit(141006);
|
||||
?>
|
|
@ -0,0 +1,12 @@
|
|||
<?
|
||||
|
||||
$project_news = array(
|
||||
array("March 1, 2004",
|
||||
"Sample news item"
|
||||
),
|
||||
array("March 2, 2004",
|
||||
"Another item"
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
|
@ -51,7 +51,7 @@ if ($logged_in_user->id != $post->user) {
|
|||
|
||||
show_forum_title($forum, $thread, $category->is_helpdesk);
|
||||
|
||||
echo "<form action=\"edit.php?id=", $post->id, "\" method=\"POST\">";
|
||||
echo "<form action=forum_edit.php?id=$post->id method=POST>\n";
|
||||
|
||||
start_forum_table(array("Edit Your Post"), array(NULL), 2);
|
||||
if ($post->parent_post==0 and $thread->owner==$logged_in_user->id) {
|
||||
|
|
|
@ -44,7 +44,7 @@ if ($category->is_helpdesk) {
|
|||
}
|
||||
|
||||
echo "
|
||||
<form action=forum.php method=get>
|
||||
<form action=forum_forum.php method=get>
|
||||
<input type=hidden name=id value=", $forum->id, ">
|
||||
<table width=100% cellspacing=0 cellpadding=0>
|
||||
<tr valign=bottom>
|
||||
|
|
|
@ -25,7 +25,7 @@ if ($n == $count) {
|
|||
$offset += $count;
|
||||
echo "
|
||||
<br><br>
|
||||
<a href=user_posts.php?userid=$userid&offset=$offset><b>Next $count posts</b></a>
|
||||
<a href=forum_user_posts.php?userid=$userid&offset=$offset><b>Next $count posts</b></a>
|
||||
";
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@ function merge_hosts($old_host, $new_host) {
|
|||
} else {
|
||||
merge_hosts($host, $latest_host);
|
||||
}
|
||||
// reread latest_host from database since we just
|
||||
// updated its credits
|
||||
//
|
||||
$latest_host = lookup_host($latest_host->id);
|
||||
}
|
||||
echo "
|
||||
<p><a href=hosts_user.php>Return to list of your computers</a>
|
||||
|
|
|
@ -23,40 +23,7 @@ function get_host($hostid, $user) {
|
|||
page_head("Updating computer credit");
|
||||
|
||||
$hostid = $_GET["hostid"];
|
||||
$latest_host = get_host($hostid, $user);
|
||||
$r = mysql_query("select * from result where hostid=$hostid order by received_time");
|
||||
$t = 0;
|
||||
$avg = 0;
|
||||
$hl = 86400*7;
|
||||
$now = time();
|
||||
$avg_time = 0;
|
||||
$half_life = 86400*7;
|
||||
while ($result = mysql_fetch_object($r)) {
|
||||
if ($result->granted_credit <= 0) continue;
|
||||
$t += $result->granted_credit;
|
||||
|
||||
// the following taken from lib/util.C
|
||||
//
|
||||
if ($avg_time) {
|
||||
$diff = $result->received_time - $avg_time;
|
||||
if ($diff <=0) $diff = 3600;
|
||||
$diff_days = $diff/86400;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
$avg += (1-$weight)*($result->granted_credit/$diff_days);
|
||||
} else {
|
||||
$dd = ($result->received_time - $result->sent_time)/86400;
|
||||
$avg = $result->granted_credit/$dd;
|
||||
}
|
||||
$avg_time = $result->received_time;
|
||||
echo "<br>$avg\n";
|
||||
}
|
||||
mysql_free_result($r);
|
||||
|
||||
$diff = $now - $avg_time;
|
||||
$weight = exp(-$diff*M_LN2/$half_life);
|
||||
$avg *= $weight;
|
||||
mysql_query("update host set total_credit=$t, expavg_credit=$avg where id=$hostid");
|
||||
host_update_credit($hostid);
|
||||
echo "<br>Host credit updated";
|
||||
page_tail();
|
||||
|
||||
|
|
Loading…
Reference in New Issue