| 1 | #!/usr/bin/php5 |
| 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:p:hfr:'); |
| 14 | |
| 15 | if(isset($opt['h'])) { |
| 16 | echo <<<EOF |
| 17 | usage: spoolgen.php [-h] [-f] [ -u user ] [ -p pass ] [ -P port ] [ -r spool_root ] |
| 18 | create all spools, using user user and pass pass |
| 19 | if -f is set, also refresh the RSS feed |
| 20 | EOF; |
| 21 | exit; |
| 22 | } |
| 23 | |
| 24 | if (!isset($opt['P'])) { |
| 25 | $opt['P'] = '119'; |
| 26 | } |
| 27 | |
| 28 | Banana::$nntp_host = "news://{$opt['u']}:{$opt['p']}@localhost:{$opt['P']}/\n"; |
| 29 | if (isset($opt['r'])) { |
| 30 | Banana::$spool_root = $opt['r']; |
| 31 | } |
| 32 | if (isset($opt['f'])) { |
| 33 | Banana::createAllSpool(array('NNTP')); |
| 34 | } else { |
| 35 | Banana::refreshAllFeeds(array('NNTP')); |
| 36 | } |
| 37 | // vim:set et sw=4 sts=4 ts=4 |
| 38 | ?> |