********************************************************************************/
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");
?>
* 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');
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";
}
}