Commit 0a9bd041 authored by sympa-authors's avatar sympa-authors
Browse files

New feature: Migrate templates to TT2 and rebuild web archives


git-svn-id: https://subversion.renater.fr/sympa/trunk@2492 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 899a3b32
......@@ -276,7 +276,7 @@ installsrc:
$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' SYMPA_VERSION='${SYMPA_VERSION}' \
DIR='${DIR}' BINDIR='${BINDIR}' SBINDIR='${SBINDIR}' LIBDIR='${LIBDIR}' WWSBINDIR='${WWSBINDIR}' \
DESTDIR='${DESTDIR}' MAILERPROGDIR='${MAILERPROGDIR}' EXPL_DIR='${EXPL_DIR}' LIBEXECDIR='${LIBEXECDIR}' \
PIDDIR='${PIDDIR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' LOCALEDIR='${LOCALEDIR}' \
PIDDIR='${PIDDIR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' LOCALEDIR='${LOCALEDIR}' SCRIPTDIR='${SCRIPTDIR}' \
ETCBINDIR='${ETCBINDIR}' ETCDIR='${ETCDIR}' SENDMAIL_ALIASES='${SENDMAIL_ALIASES}' \
VIRTUAL_ALIASES='${VIRTUAL_ALIASES}' HOST='${HOST}' COOKIE='${COOKIE}' \
SPOOLDIR='${SPOOLDIR}' LOG_SOCKET_TYPE='${LOG_SOCKET_TYPE}' \
......
......@@ -524,7 +524,7 @@ installsrc:
$(MAKE) SH='${SH}' CC='${CC}' CFLAGS='${CFLAGS}' PERL='${PERL}' SYMPA_VERSION='${SYMPA_VERSION}' \
DIR='${DIR}' BINDIR='${BINDIR}' SBINDIR='${SBINDIR}' LIBDIR='${LIBDIR}' WWSBINDIR='${WWSBINDIR}' \
DESTDIR='${DESTDIR}' MAILERPROGDIR='${MAILERPROGDIR}' EXPL_DIR='${EXPL_DIR}' LIBEXECDIR='${LIBEXECDIR}' \
PIDDIR='${PIDDIR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' LOCALEDIR='${LOCALEDIR}' \
PIDDIR='${PIDDIR}' CONFIG='${CONFIG}' WWSCONFIG='${WWSCONFIG}' LOCALEDIR='${LOCALEDIR}' SCRIPTDIR='${SCRIPTDIR}' \
ETCBINDIR='${ETCBINDIR}' ETCDIR='${ETCDIR}' SENDMAIL_ALIASES='${SENDMAIL_ALIASES}' \
VIRTUAL_ALIASES='${VIRTUAL_ALIASES}' HOST='${HOST}' COOKIE='${COOKIE}' \
SPOOLDIR='${SPOOLDIR}' LOG_SOCKET_TYPE='${LOG_SOCKET_TYPE}' \
......
......@@ -7238,6 +7238,31 @@ sub maintenance {
}
&do_log('notice','%d rows have been updated', $rows);
}
## Migration to tt2
unless (&tools::higher_version($previous_version, '4.2b')) {
&do_log('notice','Migrating templates to TT2 format...');
unless (open EXEC, '--SCRIPTDIR--/tpl2tt2.pl|') {
&do_log('err','Unable to run --SCRIPTDIR--/tpl2tt2.pl');
return undef;
}
close EXEC;
&do_log('notice','Rebuilding web archives...');
foreach my $l ( &List::get_lists('*') ) {
my $list = new List ($l);
next unless (defined $list->{'admin'}{'web_archive'});
my $file = "$Conf{'queueoutgoing'}/.rebuild.$list->{'name'}\@$list->{'admin'}{'host'}";
unless (open REBUILD, ">$file") {
&do_log('err','Cannot create %s', $file);
next;
}
print REBUILD ' ';
close REBUILD;
}
}
## Saving current version
unless (open VFILE, ">$version_file") {
......
......@@ -225,6 +225,7 @@ subst:
DESTDIR=$(DESTDIR); export DESTDIR;\
PIDDIR=$(PIDDIR); export PIDDIR;\
INSTALLDIR=$(LIBDIR); export INSTALLDIR;\
SCRIPTDIR=$(SCRIPTDIR); export SCRIPTDIR;\
SBINDIR=$(SBINDIR); export SBINDIR;\
LIBDIR=$(LIBDIR); export LIBDIR;\
ETCBINDIR=$(ETCBINDIR); export ETCBINDIR;\
......
......@@ -38,11 +38,11 @@ my $pinfo = &List::_apply_defaults();
$| = 1;
## Check UID
unless (getlogin() eq '--USER--') {
print "You should run this script as user \"sympa\", ignore ? (y/CR)";
my $s = <STDIN>;
die unless ($s =~ /^y$/i);
}
#unless (getlogin() eq '--USER--') {
# print "You should run this script as user \"sympa\", ignore ? (y/CR)";
# my $s = <STDIN>;
# die unless ($s =~ /^y$/i);
#}
my $wwsconf = {};
......@@ -122,7 +122,11 @@ foreach my $d (@directories) {
}
foreach my $tpl (sort grep(/\.tpl$/,readdir DIR)) {
push @templates, "$d/$tpl";
if ($tpl =~ /^([\w\-]+)\.(\w+)\.tpl$/) {
printf "Skipping localized template %s\n", "$d/$tpl";
}else {
push @templates, "$d/$tpl";
}
}
closedir DIR;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment