Backport
[platal.git] / bin / banana.spoolgen.php
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 'connect.db.inc.php';
12 require_once dirname(__FILE__).'/../modules/banana/banana.inc.php';
13
14 class MyBanana extends Banana
15 {
16 function MyBanana()
17 {
18 global $globals;
19 $this->host = "http://{$globals->banana->web_user}:{$globals->banana->web_pass}@{$globals->banana->server}:{$globals->banana->port}/";
20 parent::Banana();
21 }
22
23 function createAllSpool()
24 {
25 $this->_require('groups');
26 $this->_require('spool');
27 $this->_require('misc');
28
29 $groups = new BananaGroups(BANANA_GROUP_ALL);
30
31 foreach (array_keys($groups->overview) as $g) {
32 print "Generating spool for $g : ";
33 $spool = new BananaSpool($g);
34 print "done.\n";
35 unset($spool);
36 }
37 $this->nntp->quit();
38 }
39 }
40
41 $banana = new MyBanana();
42 $banana->createAllSpool();
43 system("chown -R www-data:www-data /var/spool/banana");
44 ?>