spoolgen
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Sat, 8 Jan 2005 10:09:18 +0000 (10:09 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:14 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-236

bin/banana.spoolgen.php [new file with mode: 0755]

diff --git a/bin/banana.spoolgen.php b/bin/banana.spoolgen.php
new file mode 100755 (executable)
index 0000000..16f2004
--- /dev/null
@@ -0,0 +1,44 @@
+#! /usr/bin/php4
+<?php
+/********************************************************************************
+ * spoolgen.php : spool generation
+ * --------------
+ *
+ * This file is part of the banana distribution
+ * Copyright: See COPYING files that comes with this distribution
+ ********************************************************************************/
+
+require_once('connect.db.inc.php');
+require_once('banana/banana.inc.php');
+
+class MyBanana extends Banana
+{
+    function MyBanana()
+    {
+        global $globals;
+        $this->host = "http://{$globals->banana->web_user}:{$globals->banana->web_pass}@{$globals->banana->server}:{$globals->banana->port}/";
+        parent::Banana();
+    }
+
+    function createAllSpool()
+    {
+        $this->_require('groups');
+        $this->_require('spool');
+        $this->_require('misc');
+
+        $groups = new BananaGroups(BANANA_GROUP_ALL);
+
+        foreach (array_keys($groups->overview) as $g) {
+            print "Generating spool for $g : ";
+            $spool = new BananaSpool($g);
+            print "done.\n";
+            unset($spool);
+        }
+        $this->nntp->quit();
+    }
+}
+
+$banana = new MyBanana();
+$banana->createAllSpool();
+system("chown -R www-data:www-data /var/spool/banana");
+?>