Skip to content

Commit

Permalink
Bumped Makefile.PL and manitou-mgr to version 1.2.1
Browse files Browse the repository at this point in the history
Implement import of mailboxes uploaded by the client app
Log import time for every incoming message from the spool
Flush word vectors when importing a mailbox
Reinstate the 'widx' job_type to handle non-flushed word index entries following manitou-mdx unclean termination.
Avoid word-indexing huge destructured bounced messages from mailer-daemon
Suppress warnings for unbalances parentheses in addresses
  • Loading branch information
manitou-mail committed Aug 20, 2012
1 parent f3c8fe9 commit 54c33ee
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ my %opts = (
AUTHOR => 'Daniel Verite (daniel@manitou-mail.org)', AUTHOR => 'Daniel Verite (daniel@manitou-mail.org)',
ABSTRACT => 'Perl mail-database exchanger for the Manitou-Mail software', ABSTRACT => 'Perl mail-database exchanger for the Manitou-Mail software',
NAME => 'manitou-mdx', NAME => 'manitou-mdx',
VERSION => '1.2.0', VERSION => '1.2.1',
EXE_FILES => [ qw(script/manitou-mdx script/manitou-mgr script/manitou-spool) ], EXE_FILES => [ qw(script/manitou-mdx script/manitou-mgr script/manitou-spool) ],
PREREQ_PM => { 'Getopt::Long' => 2.00, PREREQ_PM => { 'Getopt::Long' => 2.00,
'IO' => 0, 'IO' => 0,
Expand Down
3 changes: 2 additions & 1 deletion lib/Manitou/Database.pm
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2004-2011 Daniel Verite # Copyright (C) 2004-2012 Daniel Verite


# This file is part of Manitou-Mail (see http://www.manitou-mail.org) # This file is part of Manitou-Mail (see http://www.manitou-mail.org)


Expand Down Expand Up @@ -45,6 +45,7 @@ sub db_connect {


Manitou::Encoding::get_db_encoding($dbh); Manitou::Encoding::get_db_encoding($dbh);
$dbh->do("SET client_encoding=UTF8"); $dbh->do("SET client_encoding=UTF8");
$dbh->do("LISTEN job_request");


my @init = getconf("init_sql"); my @init = getconf("init_sql");
foreach (@init) { foreach (@init) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Manitou/Jobs.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ my %active_pids;


sub process_jobs_queue { sub process_jobs_queue {
my $dbh=shift; my $dbh=shift;
my $sth=$dbh->prepare("SELECT job_id,job_type,job_args FROM jobs_queue"); my $sth=$dbh->prepare("SELECT job_id,job_type,job_args FROM jobs_queue WHERE job_type='mailing'");
$sth->execute; $sth->execute;
while (my $row=$sth->fetchrow_hashref) { while (my $row=$sth->fetchrow_hashref) {
next if (defined $active_pids{$row->{job_id}}); # already running next if (defined $active_pids{$row->{job_id}}); # already running
Expand Down
31 changes: 28 additions & 3 deletions lib/Manitou/Schema.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ CREATE TABLE jobs_queue (
job_id serial, job_id serial,
mail_id int, mail_id int,
job_type varchar(100), job_type varchar(100),
job_args text job_args text,
status smallint
); );
CREATE UNIQUE INDEX jobs_pk_idx ON jobs_queue(job_id); CREATE UNIQUE INDEX jobs_pk_idx ON jobs_queue(job_id);
Expand Down Expand Up @@ -321,11 +322,35 @@ CREATE TABLE mail_template (
creation_date timestamptz default now() creation_date timestamptz default now()
) )
EOT EOT
,"import_mbox" => <<'EOT'
CREATE TABLE import_mbox (
import_id serial PRIMARY KEY,
tag_id int,
mail_status smallint,
apply_filters character,
completion real,
status smallint,
filename text,
auto_purge character
)
EOT
,"import_message" => <<'EOT'
CREATE TABLE import_message (
import_id integer,
mail_number integer,
encoded_mail bytea,
status smallint,
mail_id int
)
EOT
); );


my %object_comments=( my %object_comments=(
"mailing_run.status" => "0=not started, 1=running, 2=stopped, 3=finished", "mailing_run.status" => "0=not started, 1=running, 2=stopped, 3=finished",
"mail_addresses.addr_type" => "1=from, 2=to, 3=cc, 4=reply-to, 5=bcc" "mail_addresses.addr_type" => "1=from, 2=to, 3=cc, 4=reply-to, 5=bcc",
"import_message.status" => "0=new, 1=imported, 2=cancelled",
"import_mbox.status" => "0=not started, 1=running, 2=aborted, 3=finished",
"import_mbox.auto_purge" => "Delete the row in this table when the import has successfully completed",
); );


my %functions=("insert_mail" => <<'EOFUNCTION' my %functions=("insert_mail" => <<'EOFUNCTION'
Expand Down Expand Up @@ -680,7 +705,7 @@ sub extract_statements {


sub create_table_statements { sub create_table_statements {
my @stmt=extract_statements($create_script); my @stmt=extract_statements($create_script);
for my $t qw(mailing_definition mailing_run mailing_data mail_template) { for my $t qw(mailing_definition mailing_run mailing_data mail_template import_mbox import_message) {
push @stmt, $tables{$t}; push @stmt, $tables{$t};
} }
foreach my $c (keys %object_comments) { foreach my $c (keys %object_comments) {
Expand Down
4 changes: 4 additions & 0 deletions lib/Manitou/Words.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ sub flush_word_vectors {
delete $vecs{$wid}->{$part}->{dirty}; delete $vecs{$wid}->{$part}->{dirty};
} }
} }
my $sthd=$dbh->prepare("DELETE FROM jobs_queue WHERE mail_id=? AND job_type='widx'");
foreach (@flush_queue) {
$sthd->execute($_);
}
@flush_queue=(); @flush_queue=();
$last_flush_time=time; $last_flush_time=time;
notice_log(sprintf("Index vectors flush: %d inserted, %d updated in %0.2fs",$vec_cnt_insert, $vec_cnt_update, tv_interval($t0))); notice_log(sprintf("Index vectors flush: %d inserted, %d updated in %0.2fs",$vec_cnt_insert, $vec_cnt_update, tv_interval($t0)));
Expand Down
Loading

0 comments on commit 54c33ee

Please sign in to comment.