2006-09-28 18:51:52 +00:00
|
|
|
#!/usr/bin/env php
|
2003-07-30 00:54:22 +00:00
|
|
|
<?php
|
|
|
|
|
2008-03-28 03:05:19 +00:00
|
|
|
require_once("../inc/forum_db.inc");
|
2003-07-30 20:06:18 +00:00
|
|
|
|
|
|
|
define('MAX_REWARD', 4096);
|
2003-08-01 20:27:03 +00:00
|
|
|
define('SCALAR', 0.9);
|
2005-04-20 22:46:47 +00:00
|
|
|
set_time_limit(0);
|
2003-07-30 00:54:22 +00:00
|
|
|
|
2007-04-23 16:14:47 +00:00
|
|
|
echo date(DATE_RFC822), ": Starting\n";
|
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
$now = time();
|
2008-03-28 03:05:19 +00:00
|
|
|
$threads = BoincThread::enum();
|
|
|
|
foreach ($threads as $thread) {
|
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
|
|
|
$category = BoincCategory::lookup_id($forum->category);
|
2003-12-21 05:55:48 +00:00
|
|
|
if ($category->is_helpdesk) {
|
|
|
|
$diff = ($now - $thread->create_time)/86400;
|
|
|
|
$activity = ($thread->sufferers+1)/$diff;
|
|
|
|
echo "help $diff $activity\n";
|
2003-08-01 20:27:03 +00:00
|
|
|
} else {
|
2008-03-28 03:05:19 +00:00
|
|
|
$posts = BoincPost::enum("thread=$thread->id");
|
2003-12-21 05:55:48 +00:00
|
|
|
$activity = 0;
|
2003-08-01 20:27:03 +00:00
|
|
|
|
2008-03-28 03:05:19 +00:00
|
|
|
foreach ($posts as $post) {
|
2003-12-21 05:55:48 +00:00
|
|
|
$diff = $now - $post->timestamp;
|
|
|
|
$diff /= 7*86400;
|
|
|
|
$activity += pow(2, -$diff);
|
2003-08-01 20:27:03 +00:00
|
|
|
}
|
2003-12-21 05:55:48 +00:00
|
|
|
echo "forum $activity\n";
|
2003-07-30 20:06:18 +00:00
|
|
|
}
|
2008-03-28 03:05:19 +00:00
|
|
|
$thread->update("activity=$activity");
|
2003-08-01 20:27:03 +00:00
|
|
|
|
2003-07-30 20:06:18 +00:00
|
|
|
}
|
2003-07-30 00:54:22 +00:00
|
|
|
|
2007-04-23 16:14:47 +00:00
|
|
|
echo date(DATE_RFC822), ": Finished\n";
|
2003-07-30 00:54:22 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
?>
|