Okay Bok here is one for you - just an idea outline
Psuedo Psychotic Coding:
say you grab stats from http://www.xyz.com/stats/tarball.z or what ever
$filename="http://www.xyz.com/stats/tarball.z"
if (!(file_exists($filename)))
{ error('### tarball fails - file not available'); }
else
{ if (filesize($filename) ==0)
{ error('### tarball fails size = 0') }
else
{delete(old_stats) // delete old stats i.e. generate 2x Hrs ago
rename (current_stats,old_stats) // copy last known good stats to backup file
$filestream=open($filename,"r")
read($filestream to current_stats)
compare (current_stats,old_stats)
if (old_stats are better)
{ delete (current_stats)
copy (old_stats, current_stats)
}
}
}
// it's safe to render page as it will have working stats