Unverified Commit 9a37302c authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #506 from ikedas/unuseful_gettext_strftime by ikedas

File extension may contain spaces by using gettext_strftime()
parents 51ab24f7 4f80d9d3
......@@ -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 />
......
......@@ -16125,11 +16125,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 = {
......
......@@ -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;
......@@ -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.
......@@ -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
......@@ -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)) {
......@@ -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;
}
......@@ -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++;
}
......@@ -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',
......@@ -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',
......
......@@ -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;
......@@ -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) {
......
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