4 # Copyright (c) STMicroelectronics, 2007. All Rights Reserved.
6 # Originally written by Mohamed CHAARI, 2007
8 # This file is a part of codendi.
10 # codendi is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # codendi is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with codendi; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 This script aims at achieving the migration of archives, of all _active_ mailing-lists, to the ForumML database.
28 Only projects that enabled ForumML plugin are concerned by this migration.
32 # Search if there are lists we shouldn't treat
33 print "Script launched";
34 my $conf = '/etc/codendi/plugins/forumml/etc/forumml.inc';
37 # Get the variable defined in forumml.inc
39 open(FORUMML_INC, "<$conf");
40 while (<FORUMML_INC>) {
41 if (m/^\$forumml_excluded_lists[ ]*=[ ]*"(.*)"[ ]*;[ ]*$/) {
42 @exc_lists = split(/[ ]*,[ ]*/, $1);
47 # Test if given list is excluded or not
48 foreach my $list (@exc_lists) {
49 $excluded_list{$list} = 0;
53 # Get PHP_PARAMS variable from php-laucher.sh
55 open(PHP_LAUNCHER, "</usr/share/codendi/src/utils/php-launcher.sh");
56 while (<PHP_LAUNCHER>) {
57 if (m/^[ ]*PHP_PARAMS="(.*)"$/) {
66 require "/usr/share/codendi/src/utils/include.pl";
68 print "Connect to DB";
69 # get all active mailing-lists
70 my $query = "SELECT list_name, group_id FROM mail_group_list WHERE status = 3";
71 my $req = $dbh->prepare($query);
73 while (my ($list_name,$group_id) = $req->fetchrow()) {
74 if(! exists $excluded_list{$list_name}) {
75 print "Processing ".$list_name." mailing-list ... \n";
76 system("/usr/bin/php $PHP_PARAMS /usr/share/codendi/plugins/forumml/bin/mail_2_DB.php $list_name 2");