Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File extension may contain spaces by using gettext_strftime() #506

Merged
merged 2 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion default/web_tt2/viewlogs.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@
[%# Reset button will be inserted here. ~%]
</form>

<em>[%|loc%]Search period: [%END%]<strong>[%|locdt(date_from_formated)%]%d %b %Y %H:%M:%S[%END%]</strong> [%|loc%]to[%END%] <strong>[%|locdt(date_to_formated)%]%d %b %Y %H:%M:%S[%END%]</strong></em><br />
<em>[%|loc%]Search period: [%END%]
<strong>[% date_from_formated | optdesc('unixtime') %]</strong>
[%|loc%]to[%END%]
<strong>[% date_to_formated | optdesc('unixtime') %]</strong>
</em><br />
[% IF total_results %]
<em>[%|loc(list)%]Research was carried out in list <strong>%1</strong>.[%END%]</em><br />
<br />
Expand Down
8 changes: 3 additions & 5 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -16196,11 +16196,9 @@ sub do_viewlogs {

$param->{'total_results'} = 0;

my @date = $log->get_log_date();
$param->{'date_from_formated'} =
$language->gettext_strftime("%Y-%m-%d-%H-%M-%S", localtime($date[0]));
$param->{'date_to_formated'} =
$language->gettext_strftime("%Y-%m-%d-%H-%M-%S", localtime($date[1]));
my @dates = $log->get_log_date;
($param->{'date_from_formated'}, $param->{'date_to_formated'}) = @dates
if @dates;

# Display and search parameters preparation.
my $select = {
Expand Down
22 changes: 10 additions & 12 deletions src/lib/Sympa/Upgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use warnings;
use Encode qw();
use English qw(-no_match_vars);
use MIME::Base64 qw();
use POSIX qw();
use Time::Local qw();

use Sympa;
Expand Down Expand Up @@ -934,7 +933,7 @@ sub upgrade {
my $fh;
my %migrated = ();
my @newconf = ();
my $date;
my ($date, $human_date);

## Some sympa.conf parameters were overridden by wwsympa.conf.
## Others prefer sympa.conf.
Expand Down Expand Up @@ -978,8 +977,9 @@ sub upgrade {

## Set language of new file content
$language->push_lang($Conf::Conf{'lang'});
$date =
$language->gettext_strftime("%d.%b.%Y-%H.%M.%S", localtime time);
$date = time;
$human_date = $language->gettext_strftime('%d %b %Y at %H:%M:%S',
localtime $date);

if (-r $wwsympa_conf) {
## load only sympa.conf
Expand Down Expand Up @@ -1077,7 +1077,7 @@ sub upgrade {
. ('#' x 76) . "\n" . '#### '
. $language->gettext("Migration from wwsympa.conf") . "\n"
. '#### '
. $date . "\n"
. $human_date . "\n"
. ('#' x 76) . "\n\n";

foreach my $type (qw(duplicate add obsolete unknown)) {
Expand Down Expand Up @@ -1989,8 +1989,8 @@ sub to_utf8 {

next unless $modified;

my $date = POSIX::strftime("%Y.%m.%d-%H.%M.%S", localtime(time));
unless (rename $file, $file . '@' . $date) {
my $date = time;
unless (rename $file, $file . '.' . $date) {
$log->syslog('err', "Cannot rename old template %s", $file);
next;
}
Expand All @@ -2013,7 +2013,7 @@ sub to_utf8 {
next;
}
$log->syslog('notice', 'Modified file %s; original file kept as %s',
$file, $file . '@' . $date);
$file, $file . '.' . $date);

$total++;
}
Expand Down Expand Up @@ -2099,8 +2099,7 @@ sub fix_colors {
$new_conf .= "$line\n";
}
# Save previous config file
my $date =
$language->gettext_strftime("%d.%b.%Y-%H.%M.%S", localtime time);
my $date = time;
unless (rename($file, "$file.upgrade$date")) {
$log->syslog(
'err',
Expand Down Expand Up @@ -2143,8 +2142,7 @@ sub save_web_tt2 {
);
return 0;
}
my $date =
$language->gettext_strftime("%d.%b.%Y-%H.%M.%S", localtime time);
my $date = time;
unless (rename($dir, "$dir.upgrade$date")) {
$log->syslog(
'err',
Expand Down
5 changes: 3 additions & 2 deletions src/sbin/sympa_wizard.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ if ($modfail) {
? Sympa::Tools::Text::pad($language->gettext($_[0]), $_[1])
: $language->gettext($_[0]);
};
*gettext_strftime = sub { $language->gettext_strftime(@_) };

my $lang = $ENV{'LANGUAGE'} || $ENV{'LC_ALL'} || $ENV{'LANG'};
$lang =~ s/\..*// if $lang;
Expand Down Expand Up @@ -400,7 +399,9 @@ sub edit_configuration {
}

if ($somechange) {
my $date = gettext_strftime("%d.%b.%Y-%H.%M.%S", localtime(time));
my @time = localtime time;
my $date = sprintf '%d%02d%02d%02d%02d%02d',
$time[5] + 1900, $time[4] + 1, @time[3, 2, 1, 0];

## Keep old config file
unless (rename $sympa_conf, $sympa_conf . '.' . $date) {
Expand Down