From 5760f76b15cb4b6eb2a24e0a310281ccc12888d5 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 15 Jan 2007 11:08:14 +0000 Subject: [PATCH] Adapt spoolgen git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1340 839d8a87-29fc-0310-9880-83ba4fa771e5 --- bin/banana.spoolgen.php | 33 +++------------------------------ bin/connect.db.inc.php | 2 +- include/banana/ml.inc.php | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/bin/banana.spoolgen.php b/bin/banana.spoolgen.php index ce5d27c..7c05f62 100755 --- a/bin/banana.spoolgen.php +++ b/bin/banana.spoolgen.php @@ -9,36 +9,9 @@ ********************************************************************************/ require_once 'connect.db.inc.php'; -require_once dirname(__FILE__).'/../modules/banana/banana.inc.php'; +require_once dirname(__FILE__).'/../include/banana/ml.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(); +Banana::$nntp_host = "news://{$globals->banana->web_user}:{$globals->banana->web_pass}@{$globals->banana->server}:{$globals->banana->port}/"; +Banana::createAllSpool(array('NNTP', 'MLArchive')); system("chown -R www-data:www-data /var/spool/banana"); ?> diff --git a/bin/connect.db.inc.php b/bin/connect.db.inc.php index d8059e3..0fc5ac6 100644 --- a/bin/connect.db.inc.php +++ b/bin/connect.db.inc.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -ini_set('include_path','/usr/share/php:'.dirname(__FILE__).'/../include'); +ini_set('include_path',dirname(__FILE__).'/../include:/usr/share/php'); require_once('xorg.inc.php'); require_once('xorg.misc.inc.php'); diff --git a/include/banana/ml.inc.php b/include/banana/ml.inc.php index 2ae418b..97e43aa 100644 --- a/include/banana/ml.inc.php +++ b/include/banana/ml.inc.php @@ -78,16 +78,47 @@ class BananaMLArchive extends BananaMBox return 'MLArchives'; } + public function getBoxList($mode = Banana::BOXES_ALL, $since = 0, $withstats = false) + { + global $globals; + $spool = $globals->lists->spool . '/'; + $list = glob($spool . '*.mbox', GLOB_ONLYDIR); + if ($list === false) { + return array(); + } + $groups = array(); + foreach ($list as $path) { + $path = substr($path, strlen($spool)); + $path = substr($path, 0, -5); + list($domain, $listname) = explode($globals->lists->vhost_sep, $path, 2); + $group = $listname . '@' . $domain; + $groups[$group] = array('desc' => null, 'msgnum' => null, 'unread' => null); + } + return $groups; + } + public function filename() { - return MLBanana::$domain . '_' . MLBanana::$listname; + if (MLBanana::$listname) { + $listname = MLBanana::$listname; + $domain = MLBanana::$domain; + } else { + list($listname, $domain) = explode('@', Banana::$group); + } + return $domain . '_' . $listname; } protected function getFileName() { global $globals; $base = $globals->lists->spool; - $file = MLBanana::$domain . $globals->lists->vhost_sep . MLBanana::$listname . '.mbox'; + if (MLBanana::$listname) { + $listname = MLBanana::$listname; + $domain = MLBanana::$domain; + } else { + list($listname, $domain) = explode('@', Banana::$group); + } + $file = $domain . $globals->lists->vhost_sep . $listname . '.mbox'; return "$base/$file/$file"; } } -- 2.1.4