PDA

View Full Version : v3Arcade Score Pruning php code question


Mark.B
05-23-2006, 06:43 PM
I am trying to see if it is possible to adapt some code that used to be in v3Arcade's cron file, this code used to run hourly and remove any scores in the database that were over a certain age.

I know the database tables have changed, I can alter that ok, but I am unsure what part of the current code needs to be changed syntax-wise to make it work, or even whether this is remotely possible. I know bits of this code need to be amended to work in vB 3.5 but I don't know which bits or what to.

The old code is like this:

$serializedsettings = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "datastore WHERE title='scoresettings'");
$scoresettings = unserialize($serializedsettings['data']);
$maxage = mktime()-($scoresettings['maxscoreage']*24*60*60);
$newusers = $DB_site->query("UPDATE " . TABLE_PREFIX . "gamesessions SET valid=0 WHERE finish<$maxage");
$newusers = $DB_site->query("DELETE FROM " . TABLE_PREFIX . "gamechallenges WHERE datestamp<$maxage");

First off, what needs to be changed in this code to kmake it vB-3.5 compatible in a general way, and then beyond that will the same general principal actually work?