listpurgegroupsID();
$i=0;
foreach($gl as $value){
$sql->purgegroup($value['group']);
$sql->UPDATEAFTERPURGE($value['groupid']);
$i++;
}//for each group
//update global site stats ONCE.
$sql->updatesitestats();
//update the total NFO files and size
$sql->purgeNFOdir($GLOBALS['CONF_nfo']['folder']);
$log['l'][]=2;
$log['e'][]=$i.' groups purged.';
}
function docron(&$log,&$ns,&$sql){
$fill=new filler;
$fill->live=false;
$fill->sql=&$sql;
$fill->ns=&$ns;
$fill->errorLog=&$log;
$starthdr=0;
//any more than this, do it next time!
if($GLOBALS['CONF_cron']['maxcronheaders']){$numhdr=$GLOBALS['CONF_cron']['maxcronheaders'];}else{$numhdr=40000;}
$allhdr=false;
//get list of groups
$gl=$sql->listcrongroups();
$i=0;
foreach($gl as $value){
$r=$fill->doXOVER($value,$numhdr,$startHdr,$allhdr);
$i++;
}
//add message
$log['l'][]=2;
$log['e'][]=$i.' groups processed.';
//clear out the NFO cache
$fill->processNFOcache();
$ns->closeNNTPconnection();
}
require_once('config.backend.php');
$start_datetime=date('YmdHis');
$sql=new sqladmin;
$sql->db=new Admin_db;
//array that will hold all errors and levels
$log=array();
//purge
dopurge($log,$sql);
//import
$ns=new My_nntp();
if($ns->startNNTPconnection()){
docron($log,$ns,$sql);
}else{
$log['l'][]=1;
$log['e'][]='Error opening connection: '.$ns->errorLog;
}
//loop through logs, echo out and save to message based on set error levels.
foreach($log['e'] as $key=>$value){
if($log['l'][$key]<=$GLOBALS['CONF_cron']['emailerrors']){
echo $value.'
';
}
if($log['l'][$key]<=$GLOBALS['CONF_cron']['logerrors']){
$logmessage.=$value.'
';
}
}
$stop_datetime=date('YmdHis');
if($logmessage){$sql->cronlog($start_datetime,$stop_datetime,$logmessage);}
exit;
?>