From 0d66c4b5d972e6e439bec0a3028c8de70e137db8 Mon Sep 17 00:00:00 2001 From: Andreas Brachold Date: Mon, 6 Oct 2008 09:00:44 +0000 Subject: * TIMER/tlist: display used recorder * CONFIG: Remove double reconfigure * CONFIG: Remove unusable command write configuation * Base: remove command restart --- bin/xxvd | 48 ---------------------------------------- html/help.tmpl | 3 +-- html/tlist.tmpl | 6 +++++ lib/XXV/MODULES/CONFIG.pm | 53 ++++++++++++++++----------------------------- lib/XXV/MODULES/EVENTS.pm | 3 +-- lib/XXV/MODULES/TIMERS.pm | 15 ++++++++----- lib/XXV/OUTPUT/NEWS/MAIL.pm | 4 ++-- 7 files changed, 39 insertions(+), 93 deletions(-) diff --git a/bin/xxvd b/bin/xxvd index 7c4ac5c..7de3b3f 100755 --- a/bin/xxvd +++ b/bin/xxvd @@ -5,7 +5,6 @@ use strict; use FindBin qw($RealBin); my $TEMPLMOD; -my $START = time; # Test on Template Modul in normale Path BEGIN { @@ -181,8 +180,6 @@ $MODULES->{'XXV::MODULES::General'}->{MOD} = &module; &docu; -my $starttime = time - $START; - while(Event::loop(1)) {}; # THE MAIN PROGRAM --------------------------------- END @@ -392,14 +389,6 @@ sub getGeneralConfig { return $Config->{General}; } - -# ------------------ -sub getStartTime { -# ------------------ - return $START; -} - - # ------------------ sub getVersion { # ------------------ @@ -512,27 +501,6 @@ sub more { } } -# ------------------ -sub restart { -# ------------------ - my $watcher = shift; - my $console = shift; - - if(-x $Config->{General}->{initscript}) { - my $msg = sprintf(gettext("The xxv system will restart now. Please try to re-login in %d seconds."), $starttime); - $console->message($msg); - debug $msg; - $console->redirect({url => '/', wait => $starttime, parent => 'top'}) - if($console->typ eq 'HTML'); - my $initscript = $Config->{General}->{initscript}; - my $run = sprintf('echo "%s restart" | at now', $initscript); - - my $erg = `$run`; - } else { - $console->err(gettext("Couldn't restart the xxv system! Script for initialization couldn't be executed.")); - } -} - # ------------------ sub getDBVersion { # ------------------ @@ -734,12 +702,6 @@ sub module { } }, }, - initscript => { - description => gettext('Initialization script to restart xxv'), - default => '/etc/init.d/xxvd', - type => 'file', - required => gettext("This is required!"), - }, }, Commands => { doc => { @@ -756,16 +718,6 @@ sub module { }, }, }; - # Only as superuser - if(0 == $<) - { - $args->{'Commands'}->{'restart'} = { - description => gettext('Call initialization script to restart the xxv system.'), - short => 'restart', - callback => sub{ restart(@_) }, - Level => 'admin', - }; - } return $args; } diff --git a/html/help.tmpl b/html/help.tmpl index b03f955..d7a8c72 100644 --- a/html/help.tmpl +++ b/html/help.tmpl @@ -107,14 +107,13 @@ logger.add(new WebFXTreeItem("", "?cmd=logger&data=m logger.add(new WebFXTreeItem("", "?cmd=logger&data=syslog")); - + var admin = new WebFXTreeItem("",0,tree); admin.add(new WebFXTreeItem("", "?cmd=vl")); admin.add(new WebFXTreeItem("", "?cmd=cl")); admin.add(new WebFXTreeItem("","?cmd=ul")); admin.add(new WebFXTreeItem("","?cmd=uprefs")); admin.add(new WebFXTreeItem("","?cmd=rel")); -admin.add(new WebFXTreeItem("","?cmd=restart")); diff --git a/html/tlist.tmpl b/html/tlist.tmpl index 0b0ef33..9485bf1 100644 --- a/html/tlist.tmpl +++ b/html/tlist.tmpl @@ -47,6 +47,9 @@ + 1 %?> + + @@ -127,6 +130,9 @@ + 1 %?> +
+ diff --git a/lib/XXV/MODULES/CONFIG.pm b/lib/XXV/MODULES/CONFIG.pm index ff9de48..b1277b6 100644 --- a/lib/XXV/MODULES/CONFIG.pm +++ b/lib/XXV/MODULES/CONFIG.pm @@ -26,24 +26,12 @@ sub module { callback => sub{ $obj->edit(@_) }, Level => 'admin', }, - configwrite => { - description => gettext('Saves the configuration.'), - short => 'cw', - callback => sub{ $obj->write(@_) }, - Level => 'admin', - }, configget => { description => gettext("Get configuration from 'modname'"), short => 'cg', callback => sub{ $obj->get(@_) }, Level => 'admin', }, - reconfigure => { - description => gettext('Edit all processes'), - short => 'cr', - callback => sub{ $obj->reconfigure(@_) }, - Level => 'admin', - }, help => { description => gettext("This will display all commands or description of module 'name'."), short => 'h', @@ -133,14 +121,6 @@ sub menu { link => "?cmd=configedit&data=$name", }; } - $ret->{links}->{'reconfigure'} = { - text => gettext("Save configuration"), - link => "?cmd=reconfigure", - }; - $ret->{links}->{'write'} = { - text => gettext("Saves the configuration."), - link => "?cmd=configwrite", - }; return $console->littlemenu($ret); } @@ -194,12 +174,12 @@ sub edit { if(ref $cfg eq 'HASH') { $obj->{config}->{$sector} = $cfg; - $obj->reconfigure(); - $obj->write(); - con_msg($console, sprintf(gettext("Section: '%s' saving ... please wait."), $sector)); - $console->redirect({url => sprintf('?cmd=configedit&data=%s',$sector), wait => 1}) - if($console->typ eq 'HTML'); + my $success = $obj->write($watcher, $console); + + $console->redirect({url => '?cmd=configedit', wait => 1}) + if($success eq 'ok' + && $console->typ eq 'HTML'); } } @@ -210,15 +190,16 @@ sub write { my $watcher = shift; my $console = shift; - $obj->reconfigure($watcher, $console); + my $success = $obj->reconfigure($watcher, $console); my $configfile = main::getUsrConfigFile; - $obj->{config}->write( $configfile ) - or return con_err($console, sprintf ("Couldn't write '%s': %s", $configfile , $! )); + if($success eq 'ok' + && !$obj->{config}->write( $configfile )) { + con_err($console, sprintf ("Couldn't write '%s': %s", $configfile , $! )); + return 'failed'; + } con_msg($console, sprintf(gettext("Configuration written to '%s'."), $configfile)); - - $console->redirect({url => '?cmd=configedit', wait => 2}) - if(ref $console and $console->typ eq 'HTML'); + return $success; } # ------------------ @@ -253,6 +234,8 @@ sub reconfigure { my $watcher = shift; my $console = shift; + my $success = 'ok'; + my $cfg = $obj->{config}; foreach my $moduleName (keys %$cfg) { if($moduleName eq 'General') { @@ -273,20 +256,22 @@ sub reconfigure { unless($ok || not $err) { my $message = sprintf("Config -> %s -> %s: %s %s", $moduleName, $parameter, $mod->{$parameter}, $err); con_err($console, $message); + $success = 'failed'; } } } } else { con_err($console, sprintf(gettext("Couldn't find %s in %s!"), $parameter, $moduleName)); + $success = 'failed'; } } } } - $obj->menu( $watcher, $console ) - if(ref $console and $console->{TYP} eq 'HTML'); - con_msg($console, gettext('Edit successful!')); + con_msg($console, gettext('Edit successful!')) + if($success eq 'ok'); + return $success; } # ------------------ diff --git a/lib/XXV/MODULES/EVENTS.pm b/lib/XXV/MODULES/EVENTS.pm index b848d5b..77ffbc4 100644 --- a/lib/XXV/MODULES/EVENTS.pm +++ b/lib/XXV/MODULES/EVENTS.pm @@ -172,10 +172,9 @@ sub _init { $self->callEvent(@_); }; - my $start = main::getStartTime; $self->news( sprintf(gettext('XXVD System %s started'), main::getVersion), - sprintf(gettext('Start time: %s'), datum($start)), + sprintf(gettext('Start time: %s'), datum()), undef, undef, 'harmless' diff --git a/lib/XXV/MODULES/TIMERS.pm b/lib/XXV/MODULES/TIMERS.pm index 9a0cfec..f99a741 100644 --- a/lib/XXV/MODULES/TIMERS.pm +++ b/lib/XXV/MODULES/TIMERS.pm @@ -1026,7 +1026,7 @@ sub _insert { q|REPLACE INTO TIMERS VALUES (?,?,?,?,?,?,?,?,?,?,?,?,FROM_UNIXTIME(?), FROM_UNIXTIME(?),0,?,?,?,?,0,NOW()) |); - my $id = md5_hex($timer->{vid} . $timer->{channel} . $nexttime->{start} . $nexttime->{stop} ); + my $id = md5_hex($timer->{vid} . $timer->{channel} . $nexttime->{start} . $nexttime->{stop} . $timer->{file} ); $sth->execute( $id, $timer->{vid}, @@ -1213,7 +1213,6 @@ sub _list { my $search = shift || ''; my $term = shift; my $params = shift; - my $table = shift || ''; my %f = ( 'id' => gettext('Service'), @@ -1245,15 +1244,17 @@ SELECT SQL_CACHE FROM EPG as e WHERE t.eventid = e.eventid LIMIT 1) as __description, - NOW() between starttime and stoptime AND (flags & 1) as __running + NOW() between starttime and stoptime AND (flags & 1) as __running, + r.host as __host FROM TIMERS as t, - CHANNELS as c - $table + CHANNELS as c, + RECORDER as r WHERE t.stoptime > NOW() AND t.channel = c.id AND t.vid = c.vid + AND t.vid = r.id $search ORDER BY t.starttime @@ -1307,9 +1308,13 @@ ORDER BY unshift(@$erg, $fields); } + # More then one host defined + my $hostlist = $self->{svdrp}->list_hosts(); + $console->setCall('tlist'); $console->table($erg, { capacity => main::getModule('RECORDS')->{CapacityFree}, + recorder => scalar @$hostlist, keywords => $keywords, keywordsmax => $keywordmax, keywordsmin => $keywordmin, diff --git a/lib/XXV/OUTPUT/NEWS/MAIL.pm b/lib/XXV/OUTPUT/NEWS/MAIL.pm index 60ae109..7b5be0b 100644 --- a/lib/XXV/OUTPUT/NEWS/MAIL.pm +++ b/lib/XXV/OUTPUT/NEWS/MAIL.pm @@ -198,7 +198,7 @@ sub init { my $self = shift || return error('No object defined!'); $self->{INITE} = 1; - $self->{LastReportTime} = main::getStartTime(); + $self->{LastReportTime} = time; # Interval to send the next mail $self->{TIMER} = Event->timer( @@ -262,7 +262,7 @@ sub parseHeader { my $vars = { msgnr => $self->{COUNT}, - date => datum(time), + date => datum(), anzahl=> $newscnt, }; -- cgit v1.2.3