#! /usr/bin/env php . // script to decay exponential average per-app credit require_once("../inc/credit.inc"); require_once("../inc/util.inc"); function decay($is_user) { $now = time(); if ($is_user) { $cs = BoincCreditUser::enum(""); } else { $cs = BoincCreditTeam::enum(""); } foreach ($cs as $c) { update_average( $now, 0, 0, $c->expavg, $c->expavg_time ); if ($is_user) { $c->update( "expavg=$c->expavg, expavg_time=$c->expavg_time where userid=$c->userid and appid=$c->appid" ); } else { $c->update( "expavg=$c->expavg, expavg_time=$c->expavg_time where teamid=$c->teamid and appid=$c->appid" ); } } } echo "Starting: ", time_str(time()), "\n"; decay(true); decay(false); echo "Ending: ", time_str(time()), "\n"; ?>