2003-07-30 00:54:22 +00:00
|
|
|
#!/usr/local/bin/php
|
|
|
|
<?php
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/forum.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
|
|
|
|
2004-02-03 21:48:49 +00:00
|
|
|
db_init();
|
2003-07-30 00:54:22 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
$now = time();
|
|
|
|
$result = mysql_query("select * FROM thread");
|
2003-07-30 20:06:18 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
while ($thread = mysql_fetch_object($result)) {
|
|
|
|
$forum = getForum($thread->forum);
|
|
|
|
$category = getCategory($forum->category);
|
|
|
|
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 {
|
2003-12-21 05:55:48 +00:00
|
|
|
$sql = "select * from post where thread=$thread->id";
|
2003-08-01 20:27:03 +00:00
|
|
|
$result2 = mysql_query($sql);
|
2003-12-21 05:55:48 +00:00
|
|
|
$activity = 0;
|
2003-08-01 20:27:03 +00:00
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
while ($post = mysql_fetch_object($result2)) {
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
$sql = "update thread set activity=$activity where id=$thread->id";
|
2003-07-30 20:06:18 +00:00
|
|
|
mysql_query($sql);
|
2003-08-01 20:27:03 +00:00
|
|
|
|
2003-07-30 20:06:18 +00:00
|
|
|
}
|
2003-07-30 00:54:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-12-21 05:55:48 +00:00
|
|
|
?>
|