Corrige une faute de frappe
[banana.git] / examples / spoolgen.php
1 #! /usr/bin/php4
2 <?php
3 /********************************************************************************
4 * spoolgen.php : spool generation
5 * --------------
6 *
7 * This file is part of the banana distribution
8 * Copyright: See COPYING files that comes with this distribution
9 ********************************************************************************/
10
11 require_once("banana/banana.inc.php");
12
13 $opt = getopt('u:p:h');
14
15 if(isset($opt['h'])) {
16 echo <<<EOF
17 usage: spoolgen.php [ -u user ] [ -p pass ]
18 create all spools, using user user and pass pass
19 EOF;
20 exit;
21 }
22
23 class MyBanana extends Banana
24 {
25 function MyBanana()
26 {
27 global $opt;
28 $this->host = "http://{$opt['u']}:{$opt['p']}@localhost:119/";
29 echo $this->host;
30 parent::Banana();
31 }
32
33 function createAllSpool()
34 {
35 $this->_require('groups');
36 $this->_require('spool');
37 $this->_require('misc');
38
39 $groups = new BananaGroups(BANANA_GROUP_ALL);
40
41 foreach (array_keys($groups->overview) as $g) {
42 print "Generating spool for $g : ";
43 $spool = new BananaSpool($g);
44 print "done.\n";
45 unset($spool);
46 }
47 $this->nntp->quit();
48 }
49 }
50
51
52 $banana = new MyBanana();
53 $banana->createAllSpool();
54 ?>