From: x99bachelart Date: Fri, 19 Sep 2003 12:40:05 +0000 (+0000) Subject: spool generation script X-Git-Tag: 1.8~404 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=14f1a075b869737288a9588cbb69e410152c572a;p=banana.git spool generation script --- diff --git a/include/spool.inc.php b/include/spool.inc.php index 3d54680..7201164 100644 --- a/include/spool.inc.php +++ b/include/spool.inc.php @@ -70,12 +70,13 @@ class spool { function spool(&$_nntp,$_group,$_display=0,$_since=""){ global $news; + $prefix_path=(preg_match("/\/scripts\/?$/",getcwd())?"..":"."); $groupinfo = $_nntp->group($_group); if (!$groupinfo) { $this = false; return false; } - $spoolfile=realpath("./spool/spool-$_group.dat"); + $spoolfile=realpath("$prefix_path/spool/spool-$_group.dat"); if (file_exists($spoolfile)) { $f = fopen($spoolfile,"r"); $this = unserialize(fread($f,filesize($spoolfile))); @@ -143,7 +144,7 @@ class spool { $this->overview[$id] = $msg; } uasort($this->overview,"spoolcompare"); - $f = fopen("spool/spool-$_group.dat","w"); + $f = fopen("$prefix_path/spool/spool-$_group.dat","w"); fputs($f,serialize($this)); fclose($f); } @@ -240,7 +241,7 @@ class spool { $ids = array_flip($this->ids); unset($ids[$_id]); $this->ids = array_flip($ids); - $f = fopen("spool/spool-{$this->group}.dat","w"); + $f = fopen("$prefix_path/spool/spool-{$this->group}.dat","w"); fputs($f,serialize($this)); fclose($f); } diff --git a/scripts/spoolgen.php b/scripts/spoolgen.php new file mode 100644 index 0000000..1b22d44 --- /dev/null +++ b/scripts/spoolgen.php @@ -0,0 +1,47 @@ +authinfo($news["user"],$news["pass"]); + if (!$result) { + print "authentication error\n"; + exit; + } +} +unset($result); + +$groups = new groups($nntp,2); +$list = array_keys($groups->overview); +unset($groups); +foreach ($list as $g) { + print "Generating spool for $g : "; + $spool = new spool($nntp,$g); + print "done.\n"; + unset($spool); +} +$nntp->quit(); +?>