diff options
author | Yorhel <git@yorhel.nl> | 2019-09-12 17:07:46 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-09-12 17:54:50 +0200 |
commit | adc906096f4644788b970e5ed936ca3e70bde2e8 (patch) | |
tree | 8d2aacf12b008820a5a331e648f915a67987cdfb /lib/Multi/Maintenance.pm | |
parent | 752bc1724968a1f15b17ba9e607f2163997b4efa (diff) |
Add VNDB::Config module and unified conf.pl config file
This gets rid of global.pl, config.pl and config3.pl and uses the
cleaner config3.pl format for the config file. The config is easily
accessible from anywhere by importing the new VNDB::Config module; The
global $VNDB::S,O,M,ROOT variables have been removed.
Sorry for all the churn...
Diffstat (limited to 'lib/Multi/Maintenance.pm')
-rw-r--r-- | lib/Multi/Maintenance.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm index 3739af1f..4281ff67 100644 --- a/lib/Multi/Maintenance.pm +++ b/lib/Multi/Maintenance.pm @@ -10,6 +10,7 @@ use warnings; use Multi::Core; use PerlIO::gzip; use VNDBUtil 'normalize_titles'; +use VNDB::Config; my $monthly; @@ -134,20 +135,20 @@ my %monthlies = ( sub logrotate { - my $dir = sprintf '%s/old', $VNDB::M{log_dir}; + my $dir = sprintf '%s/old', config->{Multi}{Core}{log_dir}; mkdir $dir if !-d $dir; - for (glob sprintf '%s/*', $VNDB::M{log_dir}) { + for (glob sprintf '%s/*', config->{Multi}{Core}{log_dir}) { next if /^\./ || /~$/ || !-f; my $f = /([^\/]+)$/ ? $1 : $_; my $n = sprintf '%s/%s.%04d-%02d-%02d.gz', $dir, $f, (localtime)[5]+1900, (localtime)[4]+1, (localtime)[3]; return if -f $n; - open my $I, '<', sprintf '%s/%s', $VNDB::M{log_dir}, $f; + open my $I, '<', sprintf '%s/%s', config->{Multi}{Core}{log_dir}, $f; open my $O, '>:gzip', $n; print $O $_ while <$I>; close $O; close $I; - open $I, '>', sprintf '%s/%s', $VNDB::M{log_dir}, $f; + open $I, '>', sprintf '%s/%s', config->{Multi}{Core}{log_dir}, $f; close $I; } AE::log info => 'Logs rotated.'; |