[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/cronjobs/mail mailaliases.php, 1.6, 1.7 mailing_
From: |
tperdue |
Subject: |
[Gforge-commits] gforge/cronjobs/mail mailaliases.php, 1.6, 1.7 mailing_lists_create.php, 1.11, 1.12 |
Date: |
Mon, 26 Jul 2004 12:49:04 -0500 |
Update of /cvsroot/gforge/gforge/cronjobs/mail
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/cronjobs/mail
Modified Files:
mailaliases.php mailing_lists_create.php
Log Message:
un-breaking mailing_lists_create.php - recommitting gf3.3 version
Index: mailaliases.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/mail/mailaliases.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mailaliases.php 1 Dec 2003 04:03:41 -0000 1.6
+++ mailaliases.php 26 Jul 2004 17:49:02 -0000 1.7
@@ -1,9 +1,39 @@
#! /usr/bin/php4 -f
<?php
+/**
+ * GForge Mail Aliases Facility
+ *
+ * Copyright 2002-2004 GForge, LLC
+ * http://gforge.org/
+ *
+ * @version $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
require ('squal_pre.php');
require ('common/include/cron_utils.php');
+//
+// IMPORTANT - modify this to your correct cron path
+//
+//define("CRON_PATH","/path/to/gforge/cronjobs");
+define("CRON_PATH","/var/www/gforge3/cronjobs");
+
if (!file_exists('/etc/aliases.org')) {
$err .= "CANNOT PROCEED - you must first backup your /etc/aliases file";
exit;
@@ -33,23 +63,43 @@
fclose($h);
//
-// Read in the mailman aliases
+// Set up the forum aliases
//
-$h2 = fopen("/tmp/mailman-aliases","r");
-$mailmancontents = fread($h2,filesize("/tmp/mailman-aliases"));
-$mailmanlines = explode("\n",$mailmancontents);
-for($k = 0; $k < count($mailmanlines); $k++) {
- $mailmanline = explode(":",$mailmanlines[$k]);
- if ($def_aliases[strtolower($mailmanline[0])]) {
- //alias is already taken - perhaps by default
- } else {
- $def_aliases[strtolower($mailmanline[0])]=1;
- fwrite($fp,$mailmanlines[$k]."\n");
+if ($sys_use_forum) {
+ $resforum=db_query("SELECT groups.unix_group_name,lower(fgl.forum_name)
AS forum_name
+ FROM forum_group_list fgl,groups
+ WHERE fgl.group_id=groups.group_id
+ AND groups.status='A'");
+ for ($forres=0; $forres<db_numrows($resforum); $forres++) {
+
$forname=strtolower(db_result($resforum,$forres,'unix_group_name').'-'.strtolower(db_result($resforum,$forres,'forum_name')));
+ if ($def_aliases[$forname]) {
+ //alias is already taken - perhaps by default
+ } else {
+ $def_aliases[$forname]=1;
+ fwrite($fp,"$forname:
|\"".CRON_PATH."/forum_gateway.php
".db_result($resforum,$forres,'unix_group_name')."
".strtolower(db_result($resforum,$forres,'forum_name'))."\"\n");
+ }
}
}
-$err .= "\n$k Mailman Lines";
-fclose($h2);
+if ($sys_use_mail) {
+ //
+ // Read in the mailman aliases
+ //
+ $h2 = fopen("/tmp/mailman-aliases","r");
+ $mailmancontents = fread($h2,filesize("/tmp/mailman-aliases"));
+ $mailmanlines = explode("\n",$mailmancontents);
+ for ($k = 0; $k < count($mailmanlines); $k++) {
+ $mailmanline = explode(":",$mailmanlines[$k]);
+ if ($def_aliases[strtolower($mailmanline[0])]) {
+ //alias is already taken - perhaps by default
+ } else {
+ $def_aliases[strtolower($mailmanline[0])]=1;
+ fwrite($fp,$mailmanlines[$k]."\n");
+ }
+ }
+ $err .= "\n$k Mailman Lines";
+ fclose($h2);
+}
//
// Write out the user aliases
Index: mailing_lists_create.php
===================================================================
RCS file: /cvsroot/gforge/gforge/cronjobs/mail/mailing_lists_create.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mailing_lists_create.php 9 Jul 2004 17:45:19 -0000 1.11
+++ mailing_lists_create.php 26 Jul 2004 17:49:02 -0000 1.12
@@ -6,6 +6,8 @@
// and, finally, create the lists in a /tmp/mailman-aliases file
// The /tmp/mailman-aliases file will then be read by the mailaliases.php
file
//
+
+//
// DEFINE VARS FOR USING THIS SCRIPT
//
define('MAILMAN_DIR','/var/mailman/');
@@ -37,11 +39,9 @@
pclose($fp);
$res=db_query("SELECT users.user_name,email,mail_group_list.list_name,
- mail_group_list.password,mail_group_list.status,
- mail_group_list.group_list_id
- FROM mail_group_list,users
- WHERE mail_group_list.list_admin=users.user_id
- ");
+ mail_group_list.password,mail_group_list.status
+ FROM mail_group_list,users
+ WHERE mail_group_list.list_admin=users.user_id");
$err .= db_error();
$rows=db_numrows($res);
@@ -49,37 +49,21 @@
$h1 = fopen("/tmp/mailman-aliases","w");
-$mailingListIds = array();
-
for ($i=0; $i<$rows; $i++) {
$err .= "Processing row $i\n";
$listadmin = db_result($res,$i,'user_name');
$email = db_result($res,$i,'email');
$listname = strtolower(db_result($res,$i,'list_name'));
$listpassword = db_result($res,$i,'password');
- $grouplistid = db_result($res,$i,'group_list_id');
-
- if (! in_array($listname,$mailing_lists) && db_result($res,$i,'status')
== MAIL__MAILING_LIST_IS_REQUESTED) {
+ if (! in_array($listname,$mailing_lists)) {
$err .= "Creating Mailing List: $listname\n";
- $lcreate_cmd = MAILMAN_DIR."bin/newlist -q address@hidden
$email $listpassword";
+ $lcreate_cmd = MAILMAN_DIR."bin/newlist -q $listname $email
$listpassword";
$err .= "Command to be executed is $lcreate_cmd\n";
$fp = popen($lcreate_cmd,"r");
- pclose($fp);
- $mailingListIds[] = $grouplistid;
}
-
- $list_str =
-$listname.': "|'.MAILMAN_DIR.'mail/mailman post
'.$listname.'"'."\n"
-.$listname.'-admin: "|'.MAILMAN_DIR.'mail/mailman admin
'.$listname.'"'."\n"
-.$listname.'-bounces: "|'.MAILMAN_DIR.'mail/mailman bounces
'.$listname.'"'."\n"
-.$listname.'-confirm: "|'.MAILMAN_DIR.'mail/mailman confirm
'.$listname.'"'."\n"
-.$listname.'-join: "|'.MAILMAN_DIR.'mail/mailman join
'.$listname.'"'."\n"
-.$listname.'-leave: "|'.MAILMAN_DIR.'mail/mailman leave
'.$listname.'"'."\n"
-.$listname.'-owner: "|'.MAILMAN_DIR.'mail/mailman owner
'.$listname.'"'."\n"
-.$listname.'-request: "|'.MAILMAN_DIR.'mail/mailman request
'.$listname.'"'."\n"
-.$listname.'-subscribe: "|'.MAILMAN_DIR.'mail/mailman subscribe
'.$listname.'"'."\n"
-.$listname.'-unsubscribe: "|'.MAILMAN_DIR.'mail/mailman unsubscribe
'.$listname.'"'."\n"
-;
+ $list_str="$listname: \"|/var/mailman/mail/wrapper post
$listname\"
+$listname-admin: \"|/var/mailman/mail/wrapper mailowner $listname\"
+$listname-request: \"|/var/mailman/mail/wrapper mailcmd $listname\"\n";
fwrite($h1,$list_str);
//
@@ -103,11 +87,6 @@
*/
}
-// Update status
-if(!empty($mailingListIds)) {
- db_query('UPDATE mail_group_list set
status='.MAIL__MAILING_LIST_IS_CREATED.' where group_list_id IN('.implode(',',
$mailingListIds).')');
-}
-
fclose($h1);
cron_entry(18,$err);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/cronjobs/mail mailaliases.php, 1.6, 1.7 mailing_lists_create.php, 1.11, 1.12,
tperdue <=