diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/createlinks smeserver-ezmlm-www-2.0.0/createlinks --- smeserver-ezmlm-www-2.0.0.old/createlinks 2022-03-15 16:53:00.000000000 -0400 +++ smeserver-ezmlm-www-2.0.0/createlinks 2022-03-16 00:25:48.158000000 -0400 @@ -5,5 +5,31 @@ my $event="smeserver-ezmlm-www-update"; templates2events("/etc/httpd/conf/httpd.conf", $event); +templates2events("/opt/mailinglist/search/ez_indexer.pl", $event); +templates2events("/opt/mailinglist/config.pm", $event); safe_symlink("restart","root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); +templates2events("/opt/mailinglist/search/ez_indexer.pl", qw( + bootstrap-console-save + console-save + email-update + mailinglist-create + mailinglist-update + mailinglist-assign + )); +templates2events("/opt/mailinglist/config.pm", qw( + bootstrap-console-save + console-save + email-update + mailinglist-create + mailinglist-update + mailinglist-assign + )); +#foreach (qw( +# smeserver-ezmlm-www-update +# mailinglist-create +# mailinglist-update +# mailinglist-assign +# )) { +#event_link("ezw-search-create", $_, "50"); +#} diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/root/etc/cron.hourly/ezw-search smeserver-ezmlm-www-2.0.0/root/etc/cron.hourly/ezw-search --- smeserver-ezmlm-www-2.0.0.old/root/etc/cron.hourly/ezw-search 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-ezmlm-www-2.0.0/root/etc/cron.hourly/ezw-search 2022-03-16 00:19:01.108000000 -0400 @@ -0,0 +1,3 @@ +#!/bin/bash +cd /opt/mailinglist/search +./ez_indexer.pl --update diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/events/actions/ezw-search-create smeserver-ezmlm-www-2.0.0/root/etc/e-smith/events/actions/ezw-search-create --- smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/events/actions/ezw-search-create 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-ezmlm-www-2.0.0/root/etc/e-smith/events/actions/ezw-search-create 2022-03-16 00:22:45.486000000 -0400 @@ -0,0 +1,3 @@ +#!/bin/bash +cd /opt/mailinglist/search +/opt/mailinglist/search/ez_indexer.pl --create --verbose diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates/opt/mailinglist/config.pm smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates/opt/mailinglist/config.pm --- smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates/opt/mailinglist/config.pm 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates/opt/mailinglist/config.pm 2022-03-16 00:13:17.308000000 -0400 @@ -0,0 +1,99 @@ +#--------------------------------------------------------------------------- +# ezmlm-www (configuration file - see README) +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +#-- Mailing list configuration goes here: +{ + use esmith::AccountsDB; + my $adb = esmith::AccountsDB->open_ro(); + $OUT = ""; + my @sortings=('thread' , 'date' , 'subject' ); + foreach my $list ($adb->get_all_by_prop(type => 'mailinglist')) + { + next if (($list->prop('DisplayArchives') || 'disabled') ne 'enabled'); + my $key= $list->key; + my $dompart=$list->prop('Domain'); + my $name = "$key\@$dompart" ; + my $conceal_senders = ( ( $list->prop('conceal_senders') || 'enabled' ) eq 'enabled')? 1 : 0; + my $Description = $list->prop('Description') || "no description"; + my $default_sorting = ( $list->prop('default_sorting') ~~ @sortings ) ? $list->prop('default_sorting') : 'thread'; + my $show_html = (( $list->prop('show_html') || 'enabled') eq 'enabled')? 1 : 0; + my $highlight = (( $list->prop('highlight') ||'enabled') eq 'enabled')? 1 : 0; + my $show_inline_images = (( $list->prop('show_inline_images') || 'enabled') eq 'enabled')? 1 : 0; + my $subscription_info = (( $list->prop('subscription_info') || 'disabled') eq 'enabled') ? 1 : 0; + my $descending_by_default = (( $list->prop('descending_by_default') || 'enabled') eq 'enabled')? 1 : 0; + + $OUT.=<<"END_TXT"; +push \@\$lists, { + name => '$name', + local_part => '$key', + host_part => '$dompart', + description => '$Description', + archive => Mail::Ezmlm::Archive->new('/home/e-smith/files/ezmlm/lists/$key'), + conceal_senders => $conceal_senders, + subscription_info => $subscription_info , + descending_by_default => 1, + default_sorting => '$default_sorting', #may be 'thread', 'date' or 'subject' + show_html => $show_html, + highlight => $highlight, + show_inline_images => $show_inline_images +}; +END_TXT + } + +} + +#--------------------------------------------------------------------------- +#-- This option specifies the language used for localized strings: + +$lang = '{ +my @langs = ('bg', 'de', 'en', 'es' , 'fr', 'it', 'no', 'pt' , 'tr', 'zh'); +my $syslang = (( substr($sysconfig{'Language'}, 0, 2) || 'unknown' ) ~~ @langs ) ? substr($sysconfig{'Language'}, 0, 2) : 'en' ; +my $langu = (( $ezmlm{'lang'} || 'unknown') ~~ @langs) ? $ezmlm{'lang'} : $syslang; +return $langu; +}'; + +#--------------------------------------------------------------------------- +#-- To enable vpopmail support just uncomment the following line: +#-- (this will disable the configuration done with the "push @$lists" +#-- syntax above, as all information will be taken from vpopmail local +#-- database and the %Config defaults below.) + +#use vpopmail; + + +#--------------------------------------------------------------------------- +#--Additional configuration options: +{ + my $ListServerName = $ezmlm{'ListServerName'} || $DomainName ; + $OUT.=<<"END_TXT"; +%Config = ( + ListServerName => '$ListServerName', + + #--These settings will be used for vpopmail-based mailing lists: + # NOT IN USE WITH SME # + DefaultVpopmailSettings => { + conceal_senders => 1, + subscription_info => 1, + descending_by_default => 1, + default_sorting => 'thread', #may be 'thread', 'date' or 'subject' + show_html => 1, + highlight => 1 + }, + VpopmailAccess => { + default_policy => 'allow', + allow_lists => [], + deny_lists => [], + allow_domains => [], + deny_domains => [] + }, + + #--CSS web path: + CSSPath => 'style.css' +); +END_TXT + +} + +1; diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates/opt/mailinglist/search/ez_indexer.pl smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates/opt/mailinglist/search/ez_indexer.pl --- smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates/opt/mailinglist/search/ez_indexer.pl 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates/opt/mailinglist/search/ez_indexer.pl 2022-03-16 00:12:49.235000000 -0400 @@ -0,0 +1,230 @@ +#!/usr/bin/perl -w +# =========================================================================== +# ez_indexer.pl +# +# Author: Alessandro Ranellucci +# Copyright (c) 2005-06. +# +# see http://ezmlm-www.sourceforge.net +#----------------------------------------------------------------------- +# + +use strict; +use warnings; +our $VERSION = 1.2.1; + +use Date::Parse 'str2time'; +use Email::Simple; +use Getopt::Long; +use Mail::Ezmlm::Archive; +our @Lists = (); + +#--------------------------------------------------------- +#-- CONFIGURATION +#-- +#-- Choose here your search engine. This can be 'kinosearch' +#-- or 'plucene'. +our $Engine = '{ +my @langs = ('kinosearch', 'plucene'); +my $langu = (( $ezmlm{'Engine'} || 'unknown') ~~ @langs) ? $ezmlm{'Engine'} : 'kinosearch'; +return $langu; +}'; +#-- Repeat the following block for each list you want to +#-- index. +#-- +{ + use esmith::AccountsDB; + my $adb = esmith::AccountsDB->open_ro(); + $OUT = ""; + my @sortings=('thread' , 'date' , 'subject' ); + foreach my $list ($adb->get_all_by_prop(type => 'mailinglist')) + { + #next if (($list->prop('DisplayArchives') || 'disabled') ne 'enabled'); + my $key= $list->key; + $OUT .= <<"END_TEXT"; +push \@Lists, { + list_dir => '/home/e-smith/files/ezmlm/lists/$key', + index_dir => '/opt/mailinglist/search/indexes/$key' +}; +END_TEXT + } +} +#-- +#-- END CONFIGURATION +#--------------------------------------------------------- + +{ +$OUT= <<'END_TEXT'; +# DO NOT TOUCH ANYTHING BELOW THIS LINE +my %opt = (); +usage(1) unless GetOptions( \%opt, qw/verbose|v create|c update|u help|h/ ); +usage(0) if $opt{help}; +usage(1) unless ($opt{create} or $opt{update}); +sub usage { + my $rv = shift; + print STDERR <{index_dir}/kinostats") { + eval q{ + use Search::Kinosearch::Kindexer; + }; + $kinosearch_version = 'old'; + } else { + eval q{ + use KinoSearch1::InvIndexer; + use KinoSearch1::Analysis::PolyAnalyzer; + }; + $kinosearch_version = 'new'; + } + } + + my $archive = Mail::Ezmlm::Archive->new($list->{list_dir}) + or die "Failed to load list archive at $list->{list_dir}\n"; + + my $writer; + if ($Engine eq 'kinosearch' && $kinosearch_version eq 'old') { + $writer = Search::Kinosearch::Kindexer->new( + -mainpath => $list->{index_dir}, + -enable_datetime => 1, + -mode => ($opt{create} ? 'overwrite' : 'update') + #-temp_directory => '/tmp', + ); + if ($opt{create}) { + for my $field (qw/subject author/) { + $writer->define_field( + -name => $field, + -lowercase => 1, + -tokenize => 1 + ); + } + $writer->define_field( + -name => 'message', + -lowercase => 1, + -tokenize => 1, + -store => 0 + ); + $writer->define_field( + -name => 'date', + -lowercase => 1, + -tokenize => 0 + ); + } + } elsif ($Engine eq 'kinosearch' && $kinosearch_version eq 'new') { + my $analyzer = KinoSearch1::Analysis::PolyAnalyzer->new( language => 'en' ); + $writer = KinoSearch1::InvIndexer->new( + invindex => $list->{index_dir}, + create => $opt{create} ? 1 : 0, + analyzer => $analyzer, + ); + $writer->spec_field( name => 'msg_id' ); + $writer->spec_field( name => 'subject', boost => 3 ); + $writer->spec_field( name => 'message', stored => 0 ); + $writer->spec_field( name => 'author' ); + $writer->spec_field( name => 'date' ); + } elsif ($Engine eq 'plucene') { + my $analyzer = Plucene::Analysis::SimpleAnalyzer->new(); + $writer = Plucene::Index::Writer->new($list->{index_dir}, $analyzer, 1); + } + + # get first message to index + my $msg_id = 1; + if ($opt{update} && -e "$list->{index_dir}/_ez_offset") { + open COUNTER, "<$list->{index_dir}/_ez_offset"; + $msg_id = ; + close COUNTER; + } + + # get last message to index + open MAX, "<$list->{list_dir}/archnum"; + my $max_id = ; + chomp $max_id; + close MAX; + + if ($max_id-$msg_id >= 0) { + print "Indexing messages #$msg_id-#$max_id\n" if $opt{verbose}; + } else { + print "No new messages\n" if $opt{verbose}; + next LIST; + } + + for (; $msg_id <= $max_id; $msg_id++) { + my $msg = $archive->getmessage($msg_id) or next; + my $message = Email::Simple->new($msg->{text}); + print "Processing message #$msg_id\n" if $opt{verbose}; + + if ($Engine eq 'kinosearch' && $kinosearch_version eq 'old') { + my $doc = $writer->new_doc("$msg_id"); + $doc->set_field(message => $message->body); + $doc->set_field(subject => $message->header("Subject")); + $doc->set_field(author => $message->header("From")); + $doc->set_field(date => $message->header("Date")); + my @t = localtime(str2time($message->header("Date"))); + $doc->set_datetime( 1900+$t[5], 1+$t[4], @t[3,2,1,0] ); + $writer->add_doc($doc); + } elsif ($Engine eq 'kinosearch' && $kinosearch_version eq 'new') { + my $doc = $writer->new_doc; + $doc->set_value( msg_id => $msg_id ); + $doc->set_value( message => $message->body ); + $doc->set_value( subject => $message->header("Subject") ); + $doc->set_value( author => $message->header("From") ); + $doc->set_value( date => $message->header("Date") ); + $writer->add_doc($doc); + } elsif ($Engine eq 'plucene') { + my $doc = Plucene::Document->new; + $doc->add(Plucene::Document::Field->Keyword(id => "$msg_id")); + $doc->add(Plucene::Document::Field->Text(message => $message->body)); + $doc->add(Plucene::Document::Field->Text(subject => $message->header("Subject"))); + $doc->add(Plucene::Document::Field->Text(author => $message->header("From"))); + my $t = Plucene::Document::DateSerializer::_to_base_36( str2time($message->header("Date"))*1000 ); + $doc->add(Plucene::Document::Field->Text(date => $t)); + $writer->add_document($doc); + } + } + + print "Finishing (this may take some time)..." if $opt{verbose}; + if ($Engine eq 'kinosearch' && $kinosearch_version eq 'old') { + $writer->generate; + $writer->write_kindex; + } elsif ($Engine eq 'kinosearch' && $kinosearch_version eq 'new') { + $writer->finish; + } elsif ($Engine eq 'plucene') { + $writer->optimize; + } + print "Done.\n" if $opt{verbose}; + + + open COUNTER, ">$list->{index_dir}/_ez_offset"; + print COUNTER $msg_id; + close COUNTER; +} +END_TEXT +} +1; diff -Nur --no-dereference smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates.metadata/opt/mailinglist/search/ez_indexer.pl smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates.metadata/opt/mailinglist/search/ez_indexer.pl --- smeserver-ezmlm-www-2.0.0.old/root/etc/e-smith/templates.metadata/opt/mailinglist/search/ez_indexer.pl 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-ezmlm-www-2.0.0/root/etc/e-smith/templates.metadata/opt/mailinglist/search/ez_indexer.pl 2022-03-18 23:27:43.740000000 -0400 @@ -0,0 +1 @@ +PERMS=0755