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