Fixes vim mode line.
[banana.git] / examples / spoolgen.php
... / ...
CommitLineData
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
11require_once("banana/banana.inc.php");
12
13$opt = getopt('u:P:p:hfr:');
14
15if(isset($opt['h'])) {
16 echo <<<EOF
17usage: 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
20EOF;
21 exit;
22}
23
24if (!isset($opt['P'])) {
25 $opt['P'] = '119';
26}
27
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}
37// vim:set et sw=4 sts=4 ts=4
38?>