#!/usr/bin/php $lists) { foreach($lists as $list) { $listpath = $prefix.$domain.'/'.$list; if (file_exists($listpath.'/control/webarchiveindex')) { $lastindex = trim(file_get_contents($listpath.'/control/webarchiveindex')); } else { $lastindex = 1; } $lastmessage = 0; $tmp = scandir($listpath.'/archive'); foreach($tmp as $t) { if(($t != '.') && ($t != '..') && ($t > $lastmessage)) { $lastmessage = $t; } } if($lastindex >= $lastmessage) { print("\tNo new messages to process. ($lastindex/$lastmessage)\n"); break; } print("\tProcessing messages ".$lastindex.' - '.$lastmessage.' for '.$list.'@'.$domain."\n"); for($msg=$lastindex+1; $msg<=$lastmessage;$msg++) { if(file_exists($listpath.'/archive/'.$msg)) { print("\t\tArchiving message ".$msg.' of '.$list.'@'.$domain."\n"); $command = $hm.' -u -M -l '.$list.' -L en -c '.$listpath.'/control/webarchive -i <'.$listpath.'/archive/'.$msg; exec($command); $lastindex = $msg; } else { print("\t\tNo message ".$msg.' in archive of '.$list.'@'.$domain."\n"); } } file_put_contents($listpath.'/control/webarchiveindex', $lastindex); } } ?>