vincent Thu Aug 19 05:29:26 2004 EDT
Modified files: /phpdoc/scripts notes_stats.php Log: Some readability fixes # I should have comitted this sooner, but forgot http://cvs.php.net/diff.php/phpdoc/scripts/notes_stats.php?r1=1.5&r2=1.6&ty=u Index: phpdoc/scripts/notes_stats.php diff -u phpdoc/scripts/notes_stats.php:1.5 phpdoc/scripts/notes_stats.php:1.6 --- phpdoc/scripts/notes_stats.php:1.5 Sun Jul 18 16:42:08 2004 +++ phpdoc/scripts/notes_stats.php Thu Aug 19 05:29:25 2004 @@ -17,10 +17,12 @@ | Vincent Gevers <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: notes_stats.php,v 1.5 2004/07/18 20:42:08 kennyt Exp $ + $Id: notes_stats.php,v 1.6 2004/08/19 09:29:25 vincent Exp $ */ /* + * Warning: This script uses a lot of memory + * * Usage: * $ php notes_stats.php [mbox-file] > notes.php */ @@ -39,17 +41,26 @@ $inputs = array(); // pair subjects w/ dates from multiple sources +$time_start = getmicrotime(); + if (isset($argv[1]) && file_exists($argv[1])) { // from file - $lines = file($argv[1]); - $count = count($lines); - for ($i = 0; $i < $count; ++$i) { - list($time, $subj) = explode(' ', $lines[$i], 2); - $inputs[] = array($time, substr($subj, 12)); - } + + $lines = file($argv[1]); + $count = count($lines); + + for ($i = 0; $i < $count; ++$i) { + list($time, $subj) = explode(' ', $lines[$i], 2); + + $inputs[] = array($time, substr($subj, 12)); + } + } elseif (isset($argv[1])) { - echo "File doesn't exist!"; - exit(1); + + echo "File doesn't exist!"; + exit(1); + } else { // from nntp + $s = nntp_connect("news.php.net") or die("failed to connect to news server"); @@ -60,19 +71,19 @@ $first = 1; $last = $new[0]; - //$first = 69000; + //$first = 69900; //$last = 70000; - $time_start = getmicrotime(); - $res = nntp_cmd($s,"XOVER $first-$last", 224) or die("failed to XOVER the new items"); for ($i = $first; $i < $last; $i++) { - $line = fgets($s, 4096); - list($n,$subj,$author,$odate,$messageid,$references,$bytes,$lines,$extra)= explode("\t", $line, 9); - $inputs[] = array($odate, $subj); + + $line = fgets($s, 4096); + list($n,$subj,$author,$odate,$messageid,$references,$bytes,$lines,$extra)= explode("\t", $line, 9); + $inputs[] = array($odate, $subj); } + } $files = $team = $tmp = array(); @@ -119,7 +130,7 @@ @$team[$d[4]][$d[2]]++; @$tmp[$d[4]]++; @$files[$d[3]]++; - + } // end if(preg_match } // end while(each