use strict; use vars qw(%conf); $conf{log_dir} = "$SYSTEM_CONF{'SITE-DIR'}/logs"; $conf{site_active} = $SYSTEM_CONF{'OPERATING-SYSTEM'} =~ /win|dos|nt/i ? "perl $SYSTEM_CONF{'CGI-DIR'}/site_active.pl" : "$SYSTEM_CONF{'CGI-DIR'}/site_active.pl"; sub new { my ($class, %params) = @_; my $self = \%params; bless $self, $class; } sub init { [ { 'FUNCTION' => 'data_news', 'MAX_RUNTIME' => 120, 'EXEC_TIME' => 0, 'PRIORITY' => 25 } ] } sub data_news { my ($self, $container, $log) = @_; return 1 unless ref $container->{msgs}; # no messages my @Jobs; for my $url (@{$container->{msgs}}) { $url =~ /^(\/.+)\/([^\/]+)$/i; my $directory = $1; my $filename = $2; my $country_code; if ($directory =~ m:/data/about/news/pr/([a-z]+)/article:) { $country_code = $1; } else { $country_code = 'special'; } next unless ($directory =~ m:/data/about/news/pr/$country_code/article: || $directory =~ m:/special/about/news/pr/article:); my $job = "TEMPLATE=/siteactive/data/templates/template_data_news_snippet.htms:SAVEPAGE=/data/news/ssi/news_$country_code.ssi:country_code=$country_code"; push(@Jobs,$job); } for my $job (@Jobs) { $log->("$SYSTEM_CONF{'OPERATING-SYSTEM'} MODE: $conf{site_active} $job"); system "$conf{site_active} $job >$conf{log_dir}/SiteActive.lastrun"; } return 1; } 1;