Rework all sources :
[banana.git] / examples / spoolgen.php
CommitLineData
4cc7f778 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
11require_once("banana/banana.inc.php");
12
13$opt = getopt('u:p:h');
14
15if(isset($opt['h'])) {
16 echo <<<EOF
f8af7e38 17usage: spoolgen.php [ -u user ] [ -p pass ]
4cc7f778 18 create all spools, using user user and pass pass
19EOF;
20 exit;
21}
22
23class 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();
d5588318 54
55// vim:set et sw=4 sts=4 ts=4
4cc7f778 56?>