Message ID | 20211115202333.2664-1-stefan.schantl@ipfire.org |
---|---|
State | Accepted |
Commit | b4c9d299712dfa9f3d4afed2196283e0a0ba2310 |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4HtLHj28TMz3wcw for <patchwork@web04.haj.ipfire.org>; Mon, 15 Nov 2021 20:23:45 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4HtLHg6J6WzN6; Mon, 15 Nov 2021 20:23:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4HtLHg0v53z2yTq; Mon, 15 Nov 2021 20:23:43 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4HtLHd3bM7z2xYj for <development@lists.ipfire.org>; Mon, 15 Nov 2021 20:23:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4HtLHc63NmzN6; Mon, 15 Nov 2021 20:23:40 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1637007821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3Rm7LLkaw0v8Eo5s+6AyT9s3tdNu88Gxfw+TP3+Kh+0=; b=hntCijaboULqWM7PPGpToF6bi6i8q2p/KbiSjhVsK8M3Tge8MTKeBs02qExAyqCrm4BsJk A2Xh4DMmvOvRHeCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1637007821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3Rm7LLkaw0v8Eo5s+6AyT9s3tdNu88Gxfw+TP3+Kh+0=; b=TVmevWxkrYGZ1XFTNuuU6Rz4pJdV4pfWu2BDcpf5JwU3Q7kNW7IwHj8WHEF7gXImUwNjyT uZuzvh1OWpGFrn4eR3b1ho7MD0wa78xENwiSVBnCLJaxSEjJFQz+s2J0UDfaOwgCE+8Ebv fewheL0Dvi1HMYcd+xlNI5u9FH9yhNnO7vyFCSr7M/alUzyGjC04T3Hb1dWXucHZ/foETx Dmm0NhyYqW9JVyh0SYtzovLF7Aybp/tj60l5w1EDyPVmVoiTnTupKbZdk78ZiiOPUMJkpT KAOCeUD4TtvtYmtvQeG5qvt19Gw+9VyzurAweqnu0KxCNUp8dTGBgAal8qq4nA== From: Stefan Schantl <stefan.schantl@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH] pakfire.cgi: Bring back old logic for log displaying Date: Mon, 15 Nov 2021 21:23:33 +0100 Message-Id: <20211115202333.2664-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
pakfire.cgi: Bring back old logic for log displaying
|
|
Commit Message
Stefan Schantl
Nov. 15, 2021, 8:23 p.m. UTC
Trying to get rid of the system backpipe check if a pakfire is running
does not work very well. It simply makes the code more complex and
only introduced some new problems.
This commit switches back to the old logic which worked well in the
past.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
html/cgi-bin/pakfire.cgi | 57 +++++++---------------------------------
1 file changed, 10 insertions(+), 47 deletions(-)
Comments
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> Okay, the old behaviour is reinstalled. Remains the problem with the page reload. Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > Trying to get rid of the system backpipe check if a pakfire is running > does not work very well. It simply makes the code more complex and > only introduced some new problems. > > This commit switches back to the old logic which worked well in the > past. > > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> > --- > html/cgi-bin/pakfire.cgi | 57 +++++++--------------------------------- > 1 file changed, 10 insertions(+), 47 deletions(-) > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi > index f2381f031..4d6eee284 100644 > --- a/html/cgi-bin/pakfire.cgi > +++ b/html/cgi-bin/pakfire.cgi > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; > $cgiparams{'INSPAKS'} = ''; > $cgiparams{'DELPAKS'} = ''; > > -my $page_lock; > - > sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();} > > &Header::getcgihash(\%cgiparams); > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont > if (($cgiparams{'ACTION'} eq 'install') && (! -e $Pakfire::lockfile)) { > my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); > if ("$cgiparams{'FORCE'}" eq "on") { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "install", "--non-interactive", "--no-colors", @pkgs); > + sleep(1); > } else { > &Header::openbox("100%", "center", $Lang::tr{'request'}); > my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); > @@ -98,9 +95,8 @@ END > } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e $Pakfire::lockfile)) { > my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); > if ("$cgiparams{'FORCE'}" eq "on") { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "remove", "--non-interactive", "--no-colors", @pkgs); > + sleep(1); > } else { > &Header::openbox("100%", "center", $Lang::tr{'request'}); > my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); > @@ -136,13 +132,11 @@ END > } > > } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) { > - # Set variable to lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); > + sleep(1); > } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "upgrade", "-y", "--no-colors"); > + sleep(1); > } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; > > @@ -156,6 +150,7 @@ END > > # Update lists > &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); > + sleep(1); > } > } > > @@ -177,44 +172,12 @@ if ($errormessage) { > &Header::closebox(); > } > > -# Check if a page lock is required. > -if ($page_lock) { > - &Header::openbox('Waiting', 1, ,); > - print <<END; > - <table> > - <tr> > - <td> > - <img src='/images/indicator.gif' alt='$Lang::tr{'active'}' title='$Lang::tr{'active'}'> > - </td> > - > - <td> > - $Lang::tr{'pakfire working'} > - </td> > - </tr> > - </table> > -END > - &Header::closebox(); > - > - # Infinite loop to lock the page until pakfire lockfile is present. > - while($page_lock) { > - unless (-e $Pakfire::lockfile) { > - sleep(1); > - } else { > - # Release page lock. > - undef($page_lock); > - > - # Break loop. > - last; > - } > - } > - > - # Perform page reload. > - print "<meta http-equiv='refresh' content='1;'>\n"; > - exit; > -} > +# Check if pakfire is already running. > +# > +# The system backpipe command is safe, because no user input is computed. > +my $pid = `pidof pakfire`; > > -# Check if pakfire is already running. In this case a lockfile is present. > -if (-e $Pakfire::lockfile) { > +if ($pid) { > &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" ); > print <<END; > <table> >
Hello Bernhard, thanks for testing and your feedback. > Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> > Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> > > Okay, the old behaviour is reinstalled. Remains the problem with the > page reload. I'm sorry I do not exactly understand which problem do you mean here - please provide some more details. A big thanks in advance, -Stefan > > Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > > Trying to get rid of the system backpipe check if a pakfire is > > running > > does not work very well. It simply makes the code more complex and > > only introduced some new problems. > > > > This commit switches back to the old logic which worked well in the > > past. > > > > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> > > --- > > html/cgi-bin/pakfire.cgi | 57 +++++++---------------------------- > > ----- > > 1 file changed, 10 insertions(+), 47 deletions(-) > > > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi > > index f2381f031..4d6eee284 100644 > > --- a/html/cgi-bin/pakfire.cgi > > +++ b/html/cgi-bin/pakfire.cgi > > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; > > $cgiparams{'INSPAKS'} = ''; > > $cgiparams{'DELPAKS'} = ''; > > > > -my $page_lock; > > - > > sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- > > equiv='refresh' content='1;'>" );print "<center><img > > src='/images/clock.gif' alt='' /><br/><font > > color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::clos > > ebox();} > > > > &Header::getcgihash(\%cgiparams); > > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, > > "<meta http-equiv='refresh' cont > > if (($cgiparams{'ACTION'} eq 'install') && (! -e > > $Pakfire::lockfile)) { > > my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); > > if ("$cgiparams{'FORCE'}" eq "on") { > > - # Lock the page. > > - $page_lock = "1"; > > &General::system_background("/usr/local/bin/pakfire > > ", "install", "--non-interactive", "--no-colors", @pkgs); > > + sleep(1); > > } else { > > &Header::openbox("100%", "center", > > $Lang::tr{'request'}); > > my @output = > > &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- > > -no-colors", @pkgs); > > @@ -98,9 +95,8 @@ END > > } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e > > $Pakfire::lockfile)) { > > my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); > > if ("$cgiparams{'FORCE'}" eq "on") { > > - # Lock the page. > > - $page_lock = "1"; > > &General::system_background("/usr/local/bin/pakfire > > ", "remove", "--non-interactive", "--no-colors", @pkgs); > > + sleep(1); > > } else { > > &Header::openbox("100%", "center", > > $Lang::tr{'request'}); > > my @output = > > &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- > > -no-colors", @pkgs); > > @@ -136,13 +132,11 @@ END > > } > > > > } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e > > $Pakfire::lockfile)) { > > - # Set variable to lock the page. > > - $page_lock = "1"; > > &General::system_background("/usr/local/bin/pakfire", > > "update", "--force", "--no-colors"); > > + sleep(1); > > } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e > > $Pakfire::lockfile)) { > > - # Lock the page. > > - $page_lock = "1"; > > &General::system_background("/usr/local/bin/pakfire", > > "upgrade", "-y", "--no-colors"); > > + sleep(1); > > } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > > $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; > > > > @@ -156,6 +150,7 @@ END > > > > # Update lists > > &General::system_background("/usr/local/bin/pakfire > > ", "update", "--force", "--no-colors"); > > + sleep(1); > > } > > } > > > > @@ -177,44 +172,12 @@ if ($errormessage) { > > &Header::closebox(); > > } > > > > -# Check if a page lock is required. > > -if ($page_lock) { > > - &Header::openbox('Waiting', 1, ,); > > - print <<END; > > - <table> > > - <tr> > > - <td> > > - <img > > src='/images/indicator.gif' alt='$Lang::tr{'active'}' > > title='$Lang::tr{'active'}'> > > - </td> > > - > > - <td> > > - $Lang::tr{'pakfire > > working'} > > - </td> > > - </tr> > > - </table> > > -END > > - &Header::closebox(); > > - > > - # Infinite loop to lock the page until pakfire lockfile is > > present. > > - while($page_lock) { > > - unless (-e $Pakfire::lockfile) { > > - sleep(1); > > - } else { > > - # Release page lock. > > - undef($page_lock); > > - > > - # Break loop. > > - last; > > - } > > - } > > - > > - # Perform page reload. > > - print "<meta http-equiv='refresh' content='1;'>\n"; > > - exit; > > -} > > +# Check if pakfire is already running. > > +# > > +# The system backpipe command is safe, because no user input is > > computed. > > +my $pid = `pidof pakfire`; > > > > -# Check if pakfire is already running. In this case a lockfile is > > present. > > -if (-e $Pakfire::lockfile) { > > +if ($pid) { > > &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' > > content='10;'>" ); > > print <<END; > > <table> > >
Hello Stefan, the logs are only displayed once ( the last 20 lines ). The aim of the change was a refreshing of this log to show the progress of the pakfire function, if I remember right. I tried to implement this, but with no success. :( - Bernhard Am 16.11.2021 um 05:47 schrieb Stefan Schantl: > Hello Bernhard, > > thanks for testing and your feedback. >> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >> >> Okay, the old behaviour is reinstalled. Remains the problem with the >> page reload. > > I'm sorry I do not exactly understand which problem do you mean here - > please provide some more details. > > A big thanks in advance, > > -Stefan > >> >> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>> Trying to get rid of the system backpipe check if a pakfire is >>> running >>> does not work very well. It simply makes the code more complex and >>> only introduced some new problems. >>> >>> This commit switches back to the old logic which worked well in the >>> past. >>> >>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>> --- >>> html/cgi-bin/pakfire.cgi | 57 +++++++---------------------------- >>> ----- >>> 1 file changed, 10 insertions(+), 47 deletions(-) >>> >>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi >>> index f2381f031..4d6eee284 100644 >>> --- a/html/cgi-bin/pakfire.cgi >>> +++ b/html/cgi-bin/pakfire.cgi >>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>> $cgiparams{'INSPAKS'} = ''; >>> $cgiparams{'DELPAKS'} = ''; >>> >>> -my $page_lock; >>> - >>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>> equiv='refresh' content='1;'>" );print "<center><img >>> src='/images/clock.gif' alt='' /><br/><font >>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::clos >>> ebox();} >>> >>> &Header::getcgihash(\%cgiparams); >>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, >>> "<meta http-equiv='refresh' cont >>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>> $Pakfire::lockfile)) { >>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>> if ("$cgiparams{'FORCE'}" eq "on") { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire >>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>> + sleep(1); >>> } else { >>> &Header::openbox("100%", "center", >>> $Lang::tr{'request'}); >>> my @output = >>> &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- >>> -no-colors", @pkgs); >>> @@ -98,9 +95,8 @@ END >>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>> $Pakfire::lockfile)) { >>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>> if ("$cgiparams{'FORCE'}" eq "on") { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire >>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>> + sleep(1); >>> } else { >>> &Header::openbox("100%", "center", >>> $Lang::tr{'request'}); >>> my @output = >>> &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- >>> -no-colors", @pkgs); >>> @@ -136,13 +132,11 @@ END >>> } >>> >>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>> $Pakfire::lockfile)) { >>> - # Set variable to lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire", >>> "update", "--force", "--no-colors"); >>> + sleep(1); >>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>> $Pakfire::lockfile)) { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire", >>> "upgrade", "-y", "--no-colors"); >>> + sleep(1); >>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>> >>> @@ -156,6 +150,7 @@ END >>> >>> # Update lists >>> &General::system_background("/usr/local/bin/pakfire >>> ", "update", "--force", "--no-colors"); >>> + sleep(1); >>> } >>> } >>> >>> @@ -177,44 +172,12 @@ if ($errormessage) { >>> &Header::closebox(); >>> } >>> >>> -# Check if a page lock is required. >>> -if ($page_lock) { >>> - &Header::openbox('Waiting', 1, ,); >>> - print <<END; >>> - <table> >>> - <tr> >>> - <td> >>> - <img >>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>> title='$Lang::tr{'active'}'> >>> - </td> >>> - >>> - <td> >>> - $Lang::tr{'pakfire >>> working'} >>> - </td> >>> - </tr> >>> - </table> >>> -END >>> - &Header::closebox(); >>> - >>> - # Infinite loop to lock the page until pakfire lockfile is >>> present. >>> - while($page_lock) { >>> - unless (-e $Pakfire::lockfile) { >>> - sleep(1); >>> - } else { >>> - # Release page lock. >>> - undef($page_lock); >>> - >>> - # Break loop. >>> - last; >>> - } >>> - } >>> - >>> - # Perform page reload. >>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>> - exit; >>> -} >>> +# Check if pakfire is already running. >>> +# >>> +# The system backpipe command is safe, because no user input is >>> computed. >>> +my $pid = `pidof pakfire`; >>> >>> -# Check if pakfire is already running. In this case a lockfile is >>> present. >>> -if (-e $Pakfire::lockfile) { >>> +if ($pid) { >>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' >>> content='10;'>" ); >>> print <<END; >>> <table> >>> >
Hello Bernhard, thanks for pointing this out. The "page refresh" is defined and performed by the following line: >> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" ); << This kind of refresh logic is untouched and worked well since many years. The "http-equiv" tells the browser to do a refresh of the page and the content contains the amount in seconds to wait. (See more here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) I didn't noticed any problems with Firefox as browser on various linux distros. A very easy test would be to decrease the time interval (minimum is "1") to force more periodic page reloads and check if the log output go further. If everything works well we may need to think about a new interval value because 10 seconds nowadays may be to long for the high speed hardware out there. Best regards, -Stefan > Hello Stefan, > > the logs are only displayed once ( the last 20 lines ). > The aim of the change was a refreshing of this log to show the > progress > of the pakfire function, if I remember right. > I tried to implement this, but with no success. :( > > - Bernhard > > Am 16.11.2021 um 05:47 schrieb Stefan Schantl: > > Hello Bernhard, > > > > thanks for testing and your feedback. > > > Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> > > > Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> > > > > > > Okay, the old behaviour is reinstalled. Remains the problem with > > > the > > > page reload. > > > > I'm sorry I do not exactly understand which problem do you mean > > here - > > please provide some more details. > > > > A big thanks in advance, > > > > -Stefan > > > > > > > > Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > > > > Trying to get rid of the system backpipe check if a pakfire is > > > > running > > > > does not work very well. It simply makes the code more complex > > > > and > > > > only introduced some new problems. > > > > > > > > This commit switches back to the old logic which worked well in > > > > the > > > > past. > > > > > > > > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> > > > > --- > > > > html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- > > > > ----- > > > > ----- > > > > 1 file changed, 10 insertions(+), 47 deletions(-) > > > > > > > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- > > > > bin/pakfire.cgi > > > > index f2381f031..4d6eee284 100644 > > > > --- a/html/cgi-bin/pakfire.cgi > > > > +++ b/html/cgi-bin/pakfire.cgi > > > > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; > > > > $cgiparams{'INSPAKS'} = ''; > > > > $cgiparams{'DELPAKS'} = ''; > > > > > > > > -my $page_lock; > > > > - > > > > sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- > > > > equiv='refresh' content='1;'>" );print "<center><img > > > > src='/images/clock.gif' alt='' /><br/><font > > > > color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: > > > > clos > > > > ebox();} > > > > > > > > &Header::getcgihash(\%cgiparams); > > > > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', > > > > 1, > > > > "<meta http-equiv='refresh' cont > > > > if (($cgiparams{'ACTION'} eq 'install') && (! -e > > > > $Pakfire::lockfile)) { > > > > my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); > > > > if ("$cgiparams{'FORCE'}" eq "on") { > > > > - # Lock the page. > > > > - $page_lock = "1"; > > > > &General::system_background("/usr/local/bin/pa > > > > kfire > > > > ", "install", "--non-interactive", "--no-colors", @pkgs); > > > > + sleep(1); > > > > } else { > > > > &Header::openbox("100%", "center", > > > > $Lang::tr{'request'}); > > > > my @output = > > > > &General::system_output("/usr/local/bin/pakfire", > > > > "resolvedeps", "- > > > > -no-colors", @pkgs); > > > > @@ -98,9 +95,8 @@ END > > > > } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e > > > > $Pakfire::lockfile)) { > > > > my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); > > > > if ("$cgiparams{'FORCE'}" eq "on") { > > > > - # Lock the page. > > > > - $page_lock = "1"; > > > > &General::system_background("/usr/local/bin/pa > > > > kfire > > > > ", "remove", "--non-interactive", "--no-colors", @pkgs); > > > > + sleep(1); > > > > } else { > > > > &Header::openbox("100%", "center", > > > > $Lang::tr{'request'}); > > > > my @output = > > > > &General::system_output("/usr/local/bin/pakfire", > > > > "resolvedeps", "- > > > > -no-colors", @pkgs); > > > > @@ -136,13 +132,11 @@ END > > > > } > > > > > > > > } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e > > > > $Pakfire::lockfile)) { > > > > - # Set variable to lock the page. > > > > - $page_lock = "1"; > > > > &General::system_background("/usr/local/bin/pakfire", > > > > "update", "--force", "--no-colors"); > > > > + sleep(1); > > > > } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e > > > > $Pakfire::lockfile)) { > > > > - # Lock the page. > > > > - $page_lock = "1"; > > > > &General::system_background("/usr/local/bin/pakfire", > > > > "upgrade", "-y", "--no-colors"); > > > > + sleep(1); > > > > } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > > > > $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; > > > > > > > > @@ -156,6 +150,7 @@ END > > > > > > > > # Update lists > > > > &General::system_background("/usr/local/bin/pa > > > > kfire > > > > ", "update", "--force", "--no-colors"); > > > > + sleep(1); > > > > } > > > > } > > > > > > > > @@ -177,44 +172,12 @@ if ($errormessage) { > > > > &Header::closebox(); > > > > } > > > > > > > > -# Check if a page lock is required. > > > > -if ($page_lock) { > > > > - &Header::openbox('Waiting', 1, ,); > > > > - print <<END; > > > > - <table> > > > > - <tr> > > > > - <td> > > > > - <img > > > > src='/images/indicator.gif' alt='$Lang::tr{'active'}' > > > > title='$Lang::tr{'active'}'> > > > > - </td> > > > > - > > > > - <td> > > > > - $Lang::tr{'pakfire > > > > working'} > > > > - </td> > > > > - </tr> > > > > - </table> > > > > -END > > > > - &Header::closebox(); > > > > - > > > > - # Infinite loop to lock the page until pakfire lockfile > > > > is > > > > present. > > > > - while($page_lock) { > > > > - unless (-e $Pakfire::lockfile) { > > > > - sleep(1); > > > > - } else { > > > > - # Release page lock. > > > > - undef($page_lock); > > > > - > > > > - # Break loop. > > > > - last; > > > > - } > > > > - } > > > > - > > > > - # Perform page reload. > > > > - print "<meta http-equiv='refresh' content='1;'>\n"; > > > > - exit; > > > > -} > > > > +# Check if pakfire is already running. > > > > +# > > > > +# The system backpipe command is safe, because no user input > > > > is > > > > computed. > > > > +my $pid = `pidof pakfire`; > > > > > > > > -# Check if pakfire is already running. In this case a lockfile > > > > is > > > > present. > > > > -if (-e $Pakfire::lockfile) { > > > > +if ($pid) { > > > > &Header::openbox( 'Waiting', 1, "<meta http- > > > > equiv='refresh' > > > > content='10;'>" ); > > > > print <<END; > > > > <table> > > > > > >
Should the semicolon in content be outside ? <meta http-equiv="refresh" content="30"> On Tue, Nov 16, 2021 at 11:36 AM Stefan Schantl <stefan.schantl@ipfire.org> wrote: > Hello Bernhard, > > thanks for pointing this out. > > The "page refresh" is defined and performed by the following line: > > >> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' > content='10;'>" ); << > > This kind of refresh logic is untouched and worked well since many > years. The "http-equiv" tells the browser to do a refresh of the page > and the content contains the amount in seconds to wait. (See more > here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) > > I didn't noticed any problems with Firefox as browser on various > linux distros. > > A very easy test would be to decrease the time interval (minimum is > "1") to force more periodic page reloads and check if the log output go > further. > > If everything works well we may need to think about a new interval > value because 10 seconds nowadays may be to long for the high speed > hardware out there. > > Best regards, > > -Stefan > > Hello Stefan, > > > > the logs are only displayed once ( the last 20 lines ). > > The aim of the change was a refreshing of this log to show the > > progress > > of the pakfire function, if I remember right. > > I tried to implement this, but with no success. :( > > > > - Bernhard > > > > Am 16.11.2021 um 05:47 schrieb Stefan Schantl: > > > Hello Bernhard, > > > > > > thanks for testing and your feedback. > > > > Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> > > > > Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> > > > > > > > > Okay, the old behaviour is reinstalled. Remains the problem with > > > > the > > > > page reload. > > > > > > I'm sorry I do not exactly understand which problem do you mean > > > here - > > > please provide some more details. > > > > > > A big thanks in advance, > > > > > > -Stefan > > > > > > > > > > > Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > > > > > Trying to get rid of the system backpipe check if a pakfire is > > > > > running > > > > > does not work very well. It simply makes the code more complex > > > > > and > > > > > only introduced some new problems. > > > > > > > > > > This commit switches back to the old logic which worked well in > > > > > the > > > > > past. > > > > > > > > > > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> > > > > > --- > > > > > html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- > > > > > ----- > > > > > ----- > > > > > 1 file changed, 10 insertions(+), 47 deletions(-) > > > > > > > > > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- > > > > > bin/pakfire.cgi > > > > > index f2381f031..4d6eee284 100644 > > > > > --- a/html/cgi-bin/pakfire.cgi > > > > > +++ b/html/cgi-bin/pakfire.cgi > > > > > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; > > > > > $cgiparams{'INSPAKS'} = ''; > > > > > $cgiparams{'DELPAKS'} = ''; > > > > > > > > > > -my $page_lock; > > > > > - > > > > > sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- > > > > > equiv='refresh' content='1;'>" );print "<center><img > > > > > src='/images/clock.gif' alt='' /><br/><font > > > > > color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: > > > > > clos > > > > > ebox();} > > > > > > > > > > &Header::getcgihash(\%cgiparams); > > > > > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', > > > > > 1, > > > > > "<meta http-equiv='refresh' cont > > > > > if (($cgiparams{'ACTION'} eq 'install') && (! -e > > > > > $Pakfire::lockfile)) { > > > > > my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); > > > > > if ("$cgiparams{'FORCE'}" eq "on") { > > > > > - # Lock the page. > > > > > - $page_lock = "1"; > > > > > &General::system_background("/usr/local/bin/pa > > > > > kfire > > > > > ", "install", "--non-interactive", "--no-colors", @pkgs); > > > > > + sleep(1); > > > > > } else { > > > > > &Header::openbox("100%", "center", > > > > > $Lang::tr{'request'}); > > > > > my @output = > > > > > &General::system_output("/usr/local/bin/pakfire", > > > > > "resolvedeps", "- > > > > > -no-colors", @pkgs); > > > > > @@ -98,9 +95,8 @@ END > > > > > } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e > > > > > $Pakfire::lockfile)) { > > > > > my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); > > > > > if ("$cgiparams{'FORCE'}" eq "on") { > > > > > - # Lock the page. > > > > > - $page_lock = "1"; > > > > > &General::system_background("/usr/local/bin/pa > > > > > kfire > > > > > ", "remove", "--non-interactive", "--no-colors", @pkgs); > > > > > + sleep(1); > > > > > } else { > > > > > &Header::openbox("100%", "center", > > > > > $Lang::tr{'request'}); > > > > > my @output = > > > > > &General::system_output("/usr/local/bin/pakfire", > > > > > "resolvedeps", "- > > > > > -no-colors", @pkgs); > > > > > @@ -136,13 +132,11 @@ END > > > > > } > > > > > > > > > > } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e > > > > > $Pakfire::lockfile)) { > > > > > - # Set variable to lock the page. > > > > > - $page_lock = "1"; > > > > > &General::system_background("/usr/local/bin/pakfire", > > > > > "update", "--force", "--no-colors"); > > > > > + sleep(1); > > > > > } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e > > > > > $Pakfire::lockfile)) { > > > > > - # Lock the page. > > > > > - $page_lock = "1"; > > > > > &General::system_background("/usr/local/bin/pakfire", > > > > > "upgrade", "-y", "--no-colors"); > > > > > + sleep(1); > > > > > } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > > > > > $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; > > > > > > > > > > @@ -156,6 +150,7 @@ END > > > > > > > > > > # Update lists > > > > > &General::system_background("/usr/local/bin/pa > > > > > kfire > > > > > ", "update", "--force", "--no-colors"); > > > > > + sleep(1); > > > > > } > > > > > } > > > > > > > > > > @@ -177,44 +172,12 @@ if ($errormessage) { > > > > > &Header::closebox(); > > > > > } > > > > > > > > > > -# Check if a page lock is required. > > > > > -if ($page_lock) { > > > > > - &Header::openbox('Waiting', 1, ,); > > > > > - print <<END; > > > > > - <table> > > > > > - <tr> > > > > > - <td> > > > > > - <img > > > > > src='/images/indicator.gif' alt='$Lang::tr{'active'}' > > > > > title='$Lang::tr{'active'}'> > > > > > - </td> > > > > > - > > > > > - <td> > > > > > - $Lang::tr{'pakfire > > > > > working'} > > > > > - </td> > > > > > - </tr> > > > > > - </table> > > > > > -END > > > > > - &Header::closebox(); > > > > > - > > > > > - # Infinite loop to lock the page until pakfire lockfile > > > > > is > > > > > present. > > > > > - while($page_lock) { > > > > > - unless (-e $Pakfire::lockfile) { > > > > > - sleep(1); > > > > > - } else { > > > > > - # Release page lock. > > > > > - undef($page_lock); > > > > > - > > > > > - # Break loop. > > > > > - last; > > > > > - } > > > > > - } > > > > > - > > > > > - # Perform page reload. > > > > > - print "<meta http-equiv='refresh' content='1;'>\n"; > > > > > - exit; > > > > > -} > > > > > +# Check if pakfire is already running. > > > > > +# > > > > > +# The system backpipe command is safe, because no user input > > > > > is > > > > > computed. > > > > > +my $pid = `pidof pakfire`; > > > > > > > > > > -# Check if pakfire is already running. In this case a lockfile > > > > > is > > > > > present. > > > > > -if (-e $Pakfire::lockfile) { > > > > > +if ($pid) { > > > > > &Header::openbox( 'Waiting', 1, "<meta http- > > > > > equiv='refresh' > > > > > content='10;'>" ); > > > > > print <<END; > > > > > <table> > > > > > > > > > >
Shouldn't the meta attribute be placed into head section to be active? Am 16.11.2021 um 19:36 schrieb Stefan Schantl: > Hello Bernhard, > > thanks for pointing this out. > > The "page refresh" is defined and performed by the following line: > >>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' > content='10;'>" ); << > > This kind of refresh logic is untouched and worked well since many > years. The "http-equiv" tells the browser to do a refresh of the page > and the content contains the amount in seconds to wait. (See more > here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) > > I didn't noticed any problems with Firefox as browser on various > linux distros. > > A very easy test would be to decrease the time interval (minimum is > "1") to force more periodic page reloads and check if the log output go > further. > > If everything works well we may need to think about a new interval > value because 10 seconds nowadays may be to long for the high speed > hardware out there. > > Best regards, > > -Stefan >> Hello Stefan, >> >> the logs are only displayed once ( the last 20 lines ). >> The aim of the change was a refreshing of this log to show the >> progress >> of the pakfire function, if I remember right. >> I tried to implement this, but with no success. :( >> >> - Bernhard >> >> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >>> Hello Bernhard, >>> >>> thanks for testing and your feedback. >>>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>> >>>> Okay, the old behaviour is reinstalled. Remains the problem with >>>> the >>>> page reload. >>> >>> I'm sorry I do not exactly understand which problem do you mean >>> here - >>> please provide some more details. >>> >>> A big thanks in advance, >>> >>> -Stefan >>> >>>> >>>> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>>>> Trying to get rid of the system backpipe check if a pakfire is >>>>> running >>>>> does not work very well. It simply makes the code more complex >>>>> and >>>>> only introduced some new problems. >>>>> >>>>> This commit switches back to the old logic which worked well in >>>>> the >>>>> past. >>>>> >>>>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>>>> --- >>>>> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >>>>> ----- >>>>> ----- >>>>> 1 file changed, 10 insertions(+), 47 deletions(-) >>>>> >>>>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >>>>> bin/pakfire.cgi >>>>> index f2381f031..4d6eee284 100644 >>>>> --- a/html/cgi-bin/pakfire.cgi >>>>> +++ b/html/cgi-bin/pakfire.cgi >>>>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>>>> $cgiparams{'INSPAKS'} = ''; >>>>> $cgiparams{'DELPAKS'} = ''; >>>>> >>>>> -my $page_lock; >>>>> - >>>>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>>>> equiv='refresh' content='1;'>" );print "<center><img >>>>> src='/images/clock.gif' alt='' /><br/><font >>>>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >>>>> clos >>>>> ebox();} >>>>> >>>>> &Header::getcgihash(\%cgiparams); >>>>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >>>>> 1, >>>>> "<meta http-equiv='refresh' cont >>>>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>>>> + sleep(1); >>>>> } else { >>>>> &Header::openbox("100%", "center", >>>>> $Lang::tr{'request'}); >>>>> my @output = >>>>> &General::system_output("/usr/local/bin/pakfire", >>>>> "resolvedeps", "- >>>>> -no-colors", @pkgs); >>>>> @@ -98,9 +95,8 @@ END >>>>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>>>> + sleep(1); >>>>> } else { >>>>> &Header::openbox("100%", "center", >>>>> $Lang::tr{'request'}); >>>>> my @output = >>>>> &General::system_output("/usr/local/bin/pakfire", >>>>> "resolvedeps", "- >>>>> -no-colors", @pkgs); >>>>> @@ -136,13 +132,11 @@ END >>>>> } >>>>> >>>>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> - # Set variable to lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pakfire", >>>>> "update", "--force", "--no-colors"); >>>>> + sleep(1); >>>>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>>>> $Pakfire::lockfile)) { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pakfire", >>>>> "upgrade", "-y", "--no-colors"); >>>>> + sleep(1); >>>>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>>>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>>>> >>>>> @@ -156,6 +150,7 @@ END >>>>> >>>>> # Update lists >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "update", "--force", "--no-colors"); >>>>> + sleep(1); >>>>> } >>>>> } >>>>> >>>>> @@ -177,44 +172,12 @@ if ($errormessage) { >>>>> &Header::closebox(); >>>>> } >>>>> >>>>> -# Check if a page lock is required. >>>>> -if ($page_lock) { >>>>> - &Header::openbox('Waiting', 1, ,); >>>>> - print <<END; >>>>> - <table> >>>>> - <tr> >>>>> - <td> >>>>> - <img >>>>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>>>> title='$Lang::tr{'active'}'> >>>>> - </td> >>>>> - >>>>> - <td> >>>>> - $Lang::tr{'pakfire >>>>> working'} >>>>> - </td> >>>>> - </tr> >>>>> - </table> >>>>> -END >>>>> - &Header::closebox(); >>>>> - >>>>> - # Infinite loop to lock the page until pakfire lockfile >>>>> is >>>>> present. >>>>> - while($page_lock) { >>>>> - unless (-e $Pakfire::lockfile) { >>>>> - sleep(1); >>>>> - } else { >>>>> - # Release page lock. >>>>> - undef($page_lock); >>>>> - >>>>> - # Break loop. >>>>> - last; >>>>> - } >>>>> - } >>>>> - >>>>> - # Perform page reload. >>>>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>>>> - exit; >>>>> -} >>>>> +# Check if pakfire is already running. >>>>> +# >>>>> +# The system backpipe command is safe, because no user input >>>>> is >>>>> computed. >>>>> +my $pid = `pidof pakfire`; >>>>> >>>>> -# Check if pakfire is already running. In this case a lockfile >>>>> is >>>>> present. >>>>> -if (-e $Pakfire::lockfile) { >>>>> +if ($pid) { >>>>> &Header::openbox( 'Waiting', 1, "<meta http- >>>>> equiv='refresh' >>>>> content='10;'>" ); >>>>> print <<END; >>>>> <table> >>>>> >>> >
Hello, > On 15 Nov 2021, at 20:23, Stefan Schantl <stefan.schantl@ipfire.org> wrote: > > Trying to get rid of the system backpipe check if a pakfire is running > does not work very well. It simply makes the code more complex and > only introduced some new problems. > > This commit switches back to the old logic which worked well in the > past. > > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> > --- > html/cgi-bin/pakfire.cgi | 57 +++++++--------------------------------- > 1 file changed, 10 insertions(+), 47 deletions(-) > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi > index f2381f031..4d6eee284 100644 > --- a/html/cgi-bin/pakfire.cgi > +++ b/html/cgi-bin/pakfire.cgi > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; > $cgiparams{'INSPAKS'} = ''; > $cgiparams{'DELPAKS'} = ''; > > -my $page_lock; > - > sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();} > > &Header::getcgihash(\%cgiparams); > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont > if (($cgiparams{'ACTION'} eq 'install') && (! -e $Pakfire::lockfile)) { > my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); > if ("$cgiparams{'FORCE'}" eq "on") { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "install", "--non-interactive", "--no-colors", @pkgs); > + sleep(1); > } else { > &Header::openbox("100%", "center", $Lang::tr{'request'}); > my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); > @@ -98,9 +95,8 @@ END > } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e $Pakfire::lockfile)) { > my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); > if ("$cgiparams{'FORCE'}" eq "on") { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "remove", "--non-interactive", "--no-colors", @pkgs); > + sleep(1); > } else { > &Header::openbox("100%", "center", $Lang::tr{'request'}); > my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); > @@ -136,13 +132,11 @@ END > } > > } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) { > - # Set variable to lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); > + sleep(1); > } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) { > - # Lock the page. > - $page_lock = "1"; > &General::system_background("/usr/local/bin/pakfire", "upgrade", "-y", "--no-colors"); > + sleep(1); > } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; > > @@ -156,6 +150,7 @@ END > > # Update lists > &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); > + sleep(1); > } > } > > @@ -177,44 +172,12 @@ if ($errormessage) { > &Header::closebox(); > } > > -# Check if a page lock is required. > -if ($page_lock) { > - &Header::openbox('Waiting', 1, ,); > - print <<END; > - <table> > - <tr> > - <td> > - <img src='/images/indicator.gif' alt='$Lang::tr{'active'}' title='$Lang::tr{'active'}'> > - </td> > - > - <td> > - $Lang::tr{'pakfire working'} > - </td> > - </tr> > - </table> > -END > - &Header::closebox(); > - > - # Infinite loop to lock the page until pakfire lockfile is present. > - while($page_lock) { > - unless (-e $Pakfire::lockfile) { > - sleep(1); > - } else { > - # Release page lock. > - undef($page_lock); > - > - # Break loop. > - last; > - } > - } > - > - # Perform page reload. > - print "<meta http-equiv='refresh' content='1;'>\n"; There should indeed be no semi-colon here. > - exit; > -} > +# Check if pakfire is already running. > +# > +# The system backpipe command is safe, because no user input is computed. > +my $pid = `pidof pakfire`; > > -# Check if pakfire is already running. In this case a lockfile is present. > -if (-e $Pakfire::lockfile) { > +if ($pid) { > &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" ); Likewise. And yes, it should be in the header, too. However, since the entire file does not have any functions, it is impossible to go back to this. Since this is already a very ugly solution (but one that works), I would say we leave it like this and hope for the best. We have bigger fish to fry. -Michael > print <<END; > <table> > -- > 2.30.2 >
Hi, It is possible to refresh the log output frequently without reloading the entire page, by using Javascript/Ajax: https://www.w3schools.com/js/js_ajax_intro.asp I'm pretty sure we could create a nice log output with Javascript. If you like, I can try to implement this :) Best regards, Leo Am 16.11.2021 um 19:36 schrieb Stefan Schantl: > Hello Bernhard, > > thanks for pointing this out. > > The "page refresh" is defined and performed by the following line: > >>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' > content='10;'>" ); << > > This kind of refresh logic is untouched and worked well since many > years. The "http-equiv" tells the browser to do a refresh of the page > and the content contains the amount in seconds to wait. (See more > here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) > > I didn't noticed any problems with Firefox as browser on various > linux distros. > > A very easy test would be to decrease the time interval (minimum is > "1") to force more periodic page reloads and check if the log output go > further. > > If everything works well we may need to think about a new interval > value because 10 seconds nowadays may be to long for the high speed > hardware out there. > > Best regards, > > -Stefan >> Hello Stefan, >> >> the logs are only displayed once ( the last 20 lines ). >> The aim of the change was a refreshing of this log to show the >> progress >> of the pakfire function, if I remember right. >> I tried to implement this, but with no success. :( >> >> - Bernhard >> >> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >>> Hello Bernhard, >>> >>> thanks for testing and your feedback. >>>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>> >>>> Okay, the old behaviour is reinstalled. Remains the problem with >>>> the >>>> page reload. >>> I'm sorry I do not exactly understand which problem do you mean >>> here - >>> please provide some more details. >>> >>> A big thanks in advance, >>> >>> -Stefan >>> >>>> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>>>> Trying to get rid of the system backpipe check if a pakfire is >>>>> running >>>>> does not work very well. It simply makes the code more complex >>>>> and >>>>> only introduced some new problems. >>>>> >>>>> This commit switches back to the old logic which worked well in >>>>> the >>>>> past. >>>>> >>>>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>>>> --- >>>>> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >>>>> ----- >>>>> ----- >>>>> 1 file changed, 10 insertions(+), 47 deletions(-) >>>>> >>>>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >>>>> bin/pakfire.cgi >>>>> index f2381f031..4d6eee284 100644 >>>>> --- a/html/cgi-bin/pakfire.cgi >>>>> +++ b/html/cgi-bin/pakfire.cgi >>>>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>>>> $cgiparams{'INSPAKS'} = ''; >>>>> $cgiparams{'DELPAKS'} = ''; >>>>> >>>>> -my $page_lock; >>>>> - >>>>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>>>> equiv='refresh' content='1;'>" );print "<center><img >>>>> src='/images/clock.gif' alt='' /><br/><font >>>>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >>>>> clos >>>>> ebox();} >>>>> >>>>> &Header::getcgihash(\%cgiparams); >>>>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >>>>> 1, >>>>> "<meta http-equiv='refresh' cont >>>>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>>>> + sleep(1); >>>>> } else { >>>>> &Header::openbox("100%", "center", >>>>> $Lang::tr{'request'}); >>>>> my @output = >>>>> &General::system_output("/usr/local/bin/pakfire", >>>>> "resolvedeps", "- >>>>> -no-colors", @pkgs); >>>>> @@ -98,9 +95,8 @@ END >>>>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>>>> + sleep(1); >>>>> } else { >>>>> &Header::openbox("100%", "center", >>>>> $Lang::tr{'request'}); >>>>> my @output = >>>>> &General::system_output("/usr/local/bin/pakfire", >>>>> "resolvedeps", "- >>>>> -no-colors", @pkgs); >>>>> @@ -136,13 +132,11 @@ END >>>>> } >>>>> >>>>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>>>> $Pakfire::lockfile)) { >>>>> - # Set variable to lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pakfire", >>>>> "update", "--force", "--no-colors"); >>>>> + sleep(1); >>>>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>>>> $Pakfire::lockfile)) { >>>>> - # Lock the page. >>>>> - $page_lock = "1"; >>>>> &General::system_background("/usr/local/bin/pakfire", >>>>> "upgrade", "-y", "--no-colors"); >>>>> + sleep(1); >>>>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>>>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>>>> >>>>> @@ -156,6 +150,7 @@ END >>>>> >>>>> # Update lists >>>>> &General::system_background("/usr/local/bin/pa >>>>> kfire >>>>> ", "update", "--force", "--no-colors"); >>>>> + sleep(1); >>>>> } >>>>> } >>>>> >>>>> @@ -177,44 +172,12 @@ if ($errormessage) { >>>>> &Header::closebox(); >>>>> } >>>>> >>>>> -# Check if a page lock is required. >>>>> -if ($page_lock) { >>>>> - &Header::openbox('Waiting', 1, ,); >>>>> - print <<END; >>>>> - <table> >>>>> - <tr> >>>>> - <td> >>>>> - <img >>>>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>>>> title='$Lang::tr{'active'}'> >>>>> - </td> >>>>> - >>>>> - <td> >>>>> - $Lang::tr{'pakfire >>>>> working'} >>>>> - </td> >>>>> - </tr> >>>>> - </table> >>>>> -END >>>>> - &Header::closebox(); >>>>> - >>>>> - # Infinite loop to lock the page until pakfire lockfile >>>>> is >>>>> present. >>>>> - while($page_lock) { >>>>> - unless (-e $Pakfire::lockfile) { >>>>> - sleep(1); >>>>> - } else { >>>>> - # Release page lock. >>>>> - undef($page_lock); >>>>> - >>>>> - # Break loop. >>>>> - last; >>>>> - } >>>>> - } >>>>> - >>>>> - # Perform page reload. >>>>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>>>> - exit; >>>>> -} >>>>> +# Check if pakfire is already running. >>>>> +# >>>>> +# The system backpipe command is safe, because no user input >>>>> is >>>>> computed. >>>>> +my $pid = `pidof pakfire`; >>>>> >>>>> -# Check if pakfire is already running. In this case a lockfile >>>>> is >>>>> present. >>>>> -if (-e $Pakfire::lockfile) { >>>>> +if ($pid) { >>>>> &Header::openbox( 'Waiting', 1, "<meta http- >>>>> equiv='refresh' >>>>> content='10;'>" ); >>>>> print <<END; >>>>> <table> >>>>>
I’ll speak up! YES! I would like! Jon > On Nov 18, 2021, at 6:03 AM, Leo Hofmann <hofmann@leo-andres.de> wrote: > > Hi, > > It is possible to refresh the log output frequently without reloading the entire page, by using Javascript/Ajax: > https://www.w3schools.com/js/js_ajax_intro.asp > > I'm pretty sure we could create a nice log output with Javascript. If you like, I can try to implement this :) > > Best regards, > Leo > > Am 16.11.2021 um 19:36 schrieb Stefan Schantl: >> Hello Bernhard, >> >> thanks for pointing this out. >> >> The "page refresh" is defined and performed by the following line: >> >>>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' >> content='10;'>" ); << >> >> This kind of refresh logic is untouched and worked well since many >> years. The "http-equiv" tells the browser to do a refresh of the page >> and the content contains the amount in seconds to wait. (See more >> here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) >> >> I didn't noticed any problems with Firefox as browser on various >> linux distros. >> >> A very easy test would be to decrease the time interval (minimum is >> "1") to force more periodic page reloads and check if the log output go >> further. >> >> If everything works well we may need to think about a new interval >> value because 10 seconds nowadays may be to long for the high speed >> hardware out there. >> >> Best regards, >> >> -Stefan >>> Hello Stefan, >>> >>> the logs are only displayed once ( the last 20 lines ). >>> The aim of the change was a refreshing of this log to show the >>> progress >>> of the pakfire function, if I remember right. >>> I tried to implement this, but with no success. :( >>> >>> - Bernhard >>> >>> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >>>> Hello Bernhard, >>>> >>>> thanks for testing and your feedback. >>>>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>>> >>>>> Okay, the old behaviour is reinstalled. Remains the problem with >>>>> the >>>>> page reload. >>>> I'm sorry I do not exactly understand which problem do you mean >>>> here - >>>> please provide some more details. >>>> >>>> A big thanks in advance, >>>> >>>> -Stefan >>>> >>>>> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>>>>> Trying to get rid of the system backpipe check if a pakfire is >>>>>> running >>>>>> does not work very well. It simply makes the code more complex >>>>>> and >>>>>> only introduced some new problems. >>>>>> >>>>>> This commit switches back to the old logic which worked well in >>>>>> the >>>>>> past. >>>>>> >>>>>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>>>>> --- >>>>>> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >>>>>> ----- >>>>>> ----- >>>>>> 1 file changed, 10 insertions(+), 47 deletions(-) >>>>>> >>>>>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >>>>>> bin/pakfire.cgi >>>>>> index f2381f031..4d6eee284 100644 >>>>>> --- a/html/cgi-bin/pakfire.cgi >>>>>> +++ b/html/cgi-bin/pakfire.cgi >>>>>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>>>>> $cgiparams{'INSPAKS'} = ''; >>>>>> $cgiparams{'DELPAKS'} = ''; >>>>>> -my $page_lock; >>>>>> - >>>>>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>>>>> equiv='refresh' content='1;'>" );print "<center><img >>>>>> src='/images/clock.gif' alt='' /><br/><font >>>>>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >>>>>> clos >>>>>> ebox();} >>>>>> &Header::getcgihash(\%cgiparams); >>>>>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >>>>>> 1, >>>>>> "<meta http-equiv='refresh' cont >>>>>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>>>>> + sleep(1); >>>>>> } else { >>>>>> &Header::openbox("100%", "center", >>>>>> $Lang::tr{'request'}); >>>>>> my @output = >>>>>> &General::system_output("/usr/local/bin/pakfire", >>>>>> "resolvedeps", "- >>>>>> -no-colors", @pkgs); >>>>>> @@ -98,9 +95,8 @@ END >>>>>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>>>>> + sleep(1); >>>>>> } else { >>>>>> &Header::openbox("100%", "center", >>>>>> $Lang::tr{'request'}); >>>>>> my @output = >>>>>> &General::system_output("/usr/local/bin/pakfire", >>>>>> "resolvedeps", "- >>>>>> -no-colors", @pkgs); >>>>>> @@ -136,13 +132,11 @@ END >>>>>> } >>>>>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> - # Set variable to lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pakfire", >>>>>> "update", "--force", "--no-colors"); >>>>>> + sleep(1); >>>>>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>>>>> $Pakfire::lockfile)) { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pakfire", >>>>>> "upgrade", "-y", "--no-colors"); >>>>>> + sleep(1); >>>>>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>>>>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>>>>> @@ -156,6 +150,7 @@ END >>>>>> # Update lists >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "update", "--force", "--no-colors"); >>>>>> + sleep(1); >>>>>> } >>>>>> } >>>>>> @@ -177,44 +172,12 @@ if ($errormessage) { >>>>>> &Header::closebox(); >>>>>> } >>>>>> -# Check if a page lock is required. >>>>>> -if ($page_lock) { >>>>>> - &Header::openbox('Waiting', 1, ,); >>>>>> - print <<END; >>>>>> - <table> >>>>>> - <tr> >>>>>> - <td> >>>>>> - <img >>>>>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>>>>> title='$Lang::tr{'active'}'> >>>>>> - </td> >>>>>> - >>>>>> - <td> >>>>>> - $Lang::tr{'pakfire >>>>>> working'} >>>>>> - </td> >>>>>> - </tr> >>>>>> - </table> >>>>>> -END >>>>>> - &Header::closebox(); >>>>>> - >>>>>> - # Infinite loop to lock the page until pakfire lockfile >>>>>> is >>>>>> present. >>>>>> - while($page_lock) { >>>>>> - unless (-e $Pakfire::lockfile) { >>>>>> - sleep(1); >>>>>> - } else { >>>>>> - # Release page lock. >>>>>> - undef($page_lock); >>>>>> - >>>>>> - # Break loop. >>>>>> - last; >>>>>> - } >>>>>> - } >>>>>> - >>>>>> - # Perform page reload. >>>>>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>>>>> - exit; >>>>>> -} >>>>>> +# Check if pakfire is already running. >>>>>> +# >>>>>> +# The system backpipe command is safe, because no user input >>>>>> is >>>>>> computed. >>>>>> +my $pid = `pidof pakfire`; >>>>>> -# Check if pakfire is already running. In this case a lockfile >>>>>> is >>>>>> present. >>>>>> -if (-e $Pakfire::lockfile) { >>>>>> +if ($pid) { >>>>>> &Header::openbox( 'Waiting', 1, "<meta http- >>>>>> equiv='refresh' >>>>>> content='10;'>" ); >>>>>> print <<END; >>>>>> <table> >>>>>>
Hello, > On 18 Nov 2021, at 12:03, Leo Hofmann <hofmann@leo-andres.de> wrote: > > Hi, > > It is possible to refresh the log output frequently without reloading the entire page, by using Javascript/Ajax: > https://www.w3schools.com/js/js_ajax_intro.asp > > I'm pretty sure we could create a nice log output with Javascript. If you like, I can try to implement this :) Generally I am absolutely for this, because this would much nicer. The ultimate solution would be use web sockets and have the log streamed to the browser without any polling. However, I am not sure whether this is the biggest priority right now. Depending on how much work this is and if we can “fit it in” I wouldn’t object. -Michael > > Best regards, > Leo > > Am 16.11.2021 um 19:36 schrieb Stefan Schantl: >> Hello Bernhard, >> >> thanks for pointing this out. >> >> The "page refresh" is defined and performed by the following line: >> >>>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' >> content='10;'>" ); << >> >> This kind of refresh logic is untouched and worked well since many >> years. The "http-equiv" tells the browser to do a refresh of the page >> and the content contains the amount in seconds to wait. (See more >> here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) >> >> I didn't noticed any problems with Firefox as browser on various >> linux distros. >> >> A very easy test would be to decrease the time interval (minimum is >> "1") to force more periodic page reloads and check if the log output go >> further. >> >> If everything works well we may need to think about a new interval >> value because 10 seconds nowadays may be to long for the high speed >> hardware out there. >> >> Best regards, >> >> -Stefan >>> Hello Stefan, >>> >>> the logs are only displayed once ( the last 20 lines ). >>> The aim of the change was a refreshing of this log to show the >>> progress >>> of the pakfire function, if I remember right. >>> I tried to implement this, but with no success. :( >>> >>> - Bernhard >>> >>> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >>>> Hello Bernhard, >>>> >>>> thanks for testing and your feedback. >>>>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >>>>> >>>>> Okay, the old behaviour is reinstalled. Remains the problem with >>>>> the >>>>> page reload. >>>> I'm sorry I do not exactly understand which problem do you mean >>>> here - >>>> please provide some more details. >>>> >>>> A big thanks in advance, >>>> >>>> -Stefan >>>> >>>>> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>>>>> Trying to get rid of the system backpipe check if a pakfire is >>>>>> running >>>>>> does not work very well. It simply makes the code more complex >>>>>> and >>>>>> only introduced some new problems. >>>>>> >>>>>> This commit switches back to the old logic which worked well in >>>>>> the >>>>>> past. >>>>>> >>>>>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>>>>> --- >>>>>> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >>>>>> ----- >>>>>> ----- >>>>>> 1 file changed, 10 insertions(+), 47 deletions(-) >>>>>> >>>>>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >>>>>> bin/pakfire.cgi >>>>>> index f2381f031..4d6eee284 100644 >>>>>> --- a/html/cgi-bin/pakfire.cgi >>>>>> +++ b/html/cgi-bin/pakfire.cgi >>>>>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>>>>> $cgiparams{'INSPAKS'} = ''; >>>>>> $cgiparams{'DELPAKS'} = ''; >>>>>> -my $page_lock; >>>>>> - >>>>>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>>>>> equiv='refresh' content='1;'>" );print "<center><img >>>>>> src='/images/clock.gif' alt='' /><br/><font >>>>>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >>>>>> clos >>>>>> ebox();} >>>>>> &Header::getcgihash(\%cgiparams); >>>>>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >>>>>> 1, >>>>>> "<meta http-equiv='refresh' cont >>>>>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>>>>> + sleep(1); >>>>>> } else { >>>>>> &Header::openbox("100%", "center", >>>>>> $Lang::tr{'request'}); >>>>>> my @output = >>>>>> &General::system_output("/usr/local/bin/pakfire", >>>>>> "resolvedeps", "- >>>>>> -no-colors", @pkgs); >>>>>> @@ -98,9 +95,8 @@ END >>>>>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>>>>> if ("$cgiparams{'FORCE'}" eq "on") { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>>>>> + sleep(1); >>>>>> } else { >>>>>> &Header::openbox("100%", "center", >>>>>> $Lang::tr{'request'}); >>>>>> my @output = >>>>>> &General::system_output("/usr/local/bin/pakfire", >>>>>> "resolvedeps", "- >>>>>> -no-colors", @pkgs); >>>>>> @@ -136,13 +132,11 @@ END >>>>>> } >>>>>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>>>>> $Pakfire::lockfile)) { >>>>>> - # Set variable to lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pakfire", >>>>>> "update", "--force", "--no-colors"); >>>>>> + sleep(1); >>>>>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>>>>> $Pakfire::lockfile)) { >>>>>> - # Lock the page. >>>>>> - $page_lock = "1"; >>>>>> &General::system_background("/usr/local/bin/pakfire", >>>>>> "upgrade", "-y", "--no-colors"); >>>>>> + sleep(1); >>>>>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>>>>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>>>>> @@ -156,6 +150,7 @@ END >>>>>> # Update lists >>>>>> &General::system_background("/usr/local/bin/pa >>>>>> kfire >>>>>> ", "update", "--force", "--no-colors"); >>>>>> + sleep(1); >>>>>> } >>>>>> } >>>>>> @@ -177,44 +172,12 @@ if ($errormessage) { >>>>>> &Header::closebox(); >>>>>> } >>>>>> -# Check if a page lock is required. >>>>>> -if ($page_lock) { >>>>>> - &Header::openbox('Waiting', 1, ,); >>>>>> - print <<END; >>>>>> - <table> >>>>>> - <tr> >>>>>> - <td> >>>>>> - <img >>>>>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>>>>> title='$Lang::tr{'active'}'> >>>>>> - </td> >>>>>> - >>>>>> - <td> >>>>>> - $Lang::tr{'pakfire >>>>>> working'} >>>>>> - </td> >>>>>> - </tr> >>>>>> - </table> >>>>>> -END >>>>>> - &Header::closebox(); >>>>>> - >>>>>> - # Infinite loop to lock the page until pakfire lockfile >>>>>> is >>>>>> present. >>>>>> - while($page_lock) { >>>>>> - unless (-e $Pakfire::lockfile) { >>>>>> - sleep(1); >>>>>> - } else { >>>>>> - # Release page lock. >>>>>> - undef($page_lock); >>>>>> - >>>>>> - # Break loop. >>>>>> - last; >>>>>> - } >>>>>> - } >>>>>> - >>>>>> - # Perform page reload. >>>>>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>>>>> - exit; >>>>>> -} >>>>>> +# Check if pakfire is already running. >>>>>> +# >>>>>> +# The system backpipe command is safe, because no user input >>>>>> is >>>>>> computed. >>>>>> +my $pid = `pidof pakfire`; >>>>>> -# Check if pakfire is already running. In this case a lockfile >>>>>> is >>>>>> present. >>>>>> -if (-e $Pakfire::lockfile) { >>>>>> +if ($pid) { >>>>>> &Header::openbox( 'Waiting', 1, "<meta http- >>>>>> equiv='refresh' >>>>>> content='10;'>" ); >>>>>> print <<END; >>>>>> <table> >>>>>>
Hi Michael, 19. November 2021 12:04, "Michael Tremer" <michael.tremer@ipfire.org> schrieb: > Hello, > >> On 18 Nov 2021, at 12:03, Leo Hofmann <hofmann@leo-andres.de> wrote: >> >> Hi, >> >> It is possible to refresh the log output frequently without reloading the entire page, by using >> Javascript/Ajax: >> https://www.w3schools.com/js/js_ajax_intro.asp >> >> I'm pretty sure we could create a nice log output with Javascript. If you like, I can try to >> implement this :) > > Generally I am absolutely for this, because this would much nicer. The ultimate solution would be > use web sockets and have the log streamed to the browser without any polling. I've thought about that too, but I think websockets are too complex on the existing CGI side. This would probably require new Perl modules. > However, I am not sure whether this is the biggest priority right now. Depending on how much work > this is and if we can “fit it in” I wouldn’t object. I guess that depends on you maintainers? If you're busy, I'd better not submit any more work. Regards, Leo > -Michael > >> Best regards, >> Leo >> >> Am 16.11.2021 um 19:36 schrieb Stefan Schantl: > > Hello Bernhard, > > thanks for pointing this out. > > The "page refresh" is defined and performed by the following line: >> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' > > content='10;'>" ); << > > This kind of refresh logic is untouched and worked well since many > years. The "http-equiv" tells the browser to do a refresh of the page > and the content contains the amount in seconds to wait. (See more > here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) > > I didn't noticed any problems with Firefox as browser on various > linux distros. > > A very easy test would be to decrease the time interval (minimum is > "1") to force more periodic page reloads and check if the log output go > further. > > If everything works well we may need to think about a new interval > value because 10 seconds nowadays may be to long for the high speed > hardware out there. > > Best regards, > > -Stefan >> Hello Stefan, >> >> the logs are only displayed once ( the last 20 lines ). >> The aim of the change was a refreshing of this log to show the >> progress >> of the pakfire function, if I remember right. >> I tried to implement this, but with no success. :( >> >> - Bernhard >> >> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >> Hello Bernhard, >> >> thanks for testing and your feedback. >> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >> >> Okay, the old behaviour is reinstalled. Remains the problem with >> the >> page reload. >> I'm sorry I do not exactly understand which problem do you mean >> here - >> please provide some more details. >> >> A big thanks in advance, >> >> -Stefan >> >> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >> Trying to get rid of the system backpipe check if a pakfire is >> running >> does not work very well. It simply makes the code more complex >> and >> only introduced some new problems. >> >> This commit switches back to the old logic which worked well in >> the >> past. >> >> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >> --- >> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >> ----- >> ----- >> 1 file changed, 10 insertions(+), 47 deletions(-) >> >> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >> bin/pakfire.cgi >> index f2381f031..4d6eee284 100644 >> --- a/html/cgi-bin/pakfire.cgi >> +++ b/html/cgi-bin/pakfire.cgi >> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >> $cgiparams{'INSPAKS'} = ''; >> $cgiparams{'DELPAKS'} = ''; >> -my $page_lock; >> - >> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >> equiv='refresh' content='1;'>" );print "<center><img >> src='/images/clock.gif' alt='' /><br/><font >> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >> clos >> ebox();} >> &Header::getcgihash(\%cgiparams); >> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >> 1, >> "<meta http-equiv='refresh' cont >> if (($cgiparams{'ACTION'} eq 'install') && (! -e >> $Pakfire::lockfile)) { >> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >> if ("$cgiparams{'FORCE'}" eq "on") { >> - # Lock the page. >> - $page_lock = "1"; >> &General::system_background("/usr/local/bin/pa >> kfire >> ", "install", "--non-interactive", "--no-colors", @pkgs); >> + sleep(1); >> } else { >> &Header::openbox("100%", "center", >> $Lang::tr{'request'}); >> my @output = >> &General::system_output("/usr/local/bin/pakfire", >> "resolvedeps", "- >> -no-colors", @pkgs); >> @@ -98,9 +95,8 @@ END >> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >> $Pakfire::lockfile)) { >> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >> if ("$cgiparams{'FORCE'}" eq "on") { >> - # Lock the page. >> - $page_lock = "1"; >> &General::system_background("/usr/local/bin/pa >> kfire >> ", "remove", "--non-interactive", "--no-colors", @pkgs); >> + sleep(1); >> } else { >> &Header::openbox("100%", "center", >> $Lang::tr{'request'}); >> my @output = >> &General::system_output("/usr/local/bin/pakfire", >> "resolvedeps", "- >> -no-colors", @pkgs); >> @@ -136,13 +132,11 @@ END >> } >> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >> $Pakfire::lockfile)) { >> - # Set variable to lock the page. >> - $page_lock = "1"; >> &General::system_background("/usr/local/bin/pakfire", >> "update", "--force", "--no-colors"); >> + sleep(1); >> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >> $Pakfire::lockfile)) { >> - # Lock the page. >> - $page_lock = "1"; >> &General::system_background("/usr/local/bin/pakfire", >> "upgrade", "-y", "--no-colors"); >> + sleep(1); >> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >> @@ -156,6 +150,7 @@ END >> # Update lists >> &General::system_background("/usr/local/bin/pa >> kfire >> ", "update", "--force", "--no-colors"); >> + sleep(1); >> } >> } >> @@ -177,44 +172,12 @@ if ($errormessage) { >> &Header::closebox(); >> } >> -# Check if a page lock is required. >> -if ($page_lock) { >> - &Header::openbox('Waiting', 1, ,); >> - print <<END; >> - <table> >> - <tr> >> - <td> >> - <img >> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >> title='$Lang::tr{'active'}'> >> - </td> >> - >> - <td> >> - $Lang::tr{'pakfire >> working'} >> - </td> >> - </tr> >> - </table> >> -END >> - &Header::closebox(); >> - >> - # Infinite loop to lock the page until pakfire lockfile >> is >> present. >> - while($page_lock) { >> - unless (-e $Pakfire::lockfile) { >> - sleep(1); >> - } else { >> - # Release page lock. >> - undef($page_lock); >> - >> - # Break loop. >> - last; >> - } >> - } >> - >> - # Perform page reload. >> - print "<meta http-equiv='refresh' content='1;'>\n"; >> - exit; >> -} >> +# Check if pakfire is already running. >> +# >> +# The system backpipe command is safe, because no user input >> is >> computed. >> +my $pid = `pidof pakfire`; >> -# Check if pakfire is already running. In this case a lockfile >> is >> present. >> -if (-e $Pakfire::lockfile) { >> +if ($pid) { >> &Header::openbox( 'Waiting', 1, "<meta http- >> equiv='refresh' >> content='10;'>" ); >> print <<END; >> <table>
Hello, > On 20 Nov 2021, at 08:03, hofmann@leo-andres.de wrote: > > Hi Michael, > > 19. November 2021 12:04, "Michael Tremer" <michael.tremer@ipfire.org> schrieb: > >> Hello, >> >>>> On 18 Nov 2021, at 12:03, Leo Hofmann <hofmann@leo-andres.de> wrote: >>> >>> Hi, >>> >>> It is possible to refresh the log output frequently without reloading the entire page, by using >>> Javascript/Ajax: >>> https://www.w3schools.com/js/js_ajax_intro.asp >>> >>> I'm pretty sure we could create a nice log output with Javascript. If you like, I can try to >>> implement this :) >> >> Generally I am absolutely for this, because this would much nicer. The ultimate solution would be >> use web sockets and have the log streamed to the browser without any polling. > > I've thought about that too, but I think websockets are too complex on the existing CGI side. This would > probably require new Perl modules. Okay. I have never done this with regular CGI scripts either. > >> However, I am not sure whether this is the biggest priority right now. Depending on how much work >> this is and if we can “fit it in” I wouldn’t object. > > I guess that depends on you maintainers? If you're busy, I'd better not submit any more work. Oh no. Quite the opposite. Anything we can spread over more shoulders is good. I am sure we will cope on here with reviewing, testing and getting it into a release if we are all working together. So please don’t stop :) -Michael > > Regards, > Leo > >> -Michael >> >>> Best regards, >>> Leo >>> >>> Am 16.11.2021 um 19:36 schrieb Stefan Schantl: >> >> Hello Bernhard, >> >> thanks for pointing this out. >> >> The "page refresh" is defined and performed by the following line: >>> &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' >> >> content='10;'>" ); << >> >> This kind of refresh logic is untouched and worked well since many >> years. The "http-equiv" tells the browser to do a refresh of the page >> and the content contains the amount in seconds to wait. (See more >> here: https://www.w3schools.com/tags/att_meta_http_equiv.asp) >> >> I didn't noticed any problems with Firefox as browser on various >> linux distros. >> >> A very easy test would be to decrease the time interval (minimum is >> "1") to force more periodic page reloads and check if the log output go >> further. >> >> If everything works well we may need to think about a new interval >> value because 10 seconds nowadays may be to long for the high speed >> hardware out there. >> >> Best regards, >> >> -Stefan >>> Hello Stefan, >>> >>> the logs are only displayed once ( the last 20 lines ). >>> The aim of the change was a refreshing of this log to show the >>> progress >>> of the pakfire function, if I remember right. >>> I tried to implement this, but with no success. :( >>> >>> - Bernhard >>> >>>> Am 16.11.2021 um 05:47 schrieb Stefan Schantl: >>> Hello Bernhard, >>> >>> thanks for testing and your feedback. >>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> >>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> >>> >>> Okay, the old behaviour is reinstalled. Remains the problem with >>> the >>> page reload. >>> I'm sorry I do not exactly understand which problem do you mean >>> here - >>> please provide some more details. >>> >>> A big thanks in advance, >>> >>> -Stefan >>> >>>> Am 15.11.2021 um 21:23 schrieb Stefan Schantl: >>> Trying to get rid of the system backpipe check if a pakfire is >>> running >>> does not work very well. It simply makes the code more complex >>> and >>> only introduced some new problems. >>> >>> This commit switches back to the old logic which worked well in >>> the >>> past. >>> >>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> >>> --- >>> html/cgi-bin/pakfire.cgi | 57 +++++++----------------------- >>> ----- >>> ----- >>> 1 file changed, 10 insertions(+), 47 deletions(-) >>> >>> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi- >>> bin/pakfire.cgi >>> index f2381f031..4d6eee284 100644 >>> --- a/html/cgi-bin/pakfire.cgi >>> +++ b/html/cgi-bin/pakfire.cgi >>> @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; >>> $cgiparams{'INSPAKS'} = ''; >>> $cgiparams{'DELPAKS'} = ''; >>> -my $page_lock; >>> - >>> sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http- >>> equiv='refresh' content='1;'>" );print "<center><img >>> src='/images/clock.gif' alt='' /><br/><font >>> color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header:: >>> clos >>> ebox();} >>> &Header::getcgihash(\%cgiparams); >>> @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', >>> 1, >>> "<meta http-equiv='refresh' cont >>> if (($cgiparams{'ACTION'} eq 'install') && (! -e >>> $Pakfire::lockfile)) { >>> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); >>> if ("$cgiparams{'FORCE'}" eq "on") { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pa >>> kfire >>> ", "install", "--non-interactive", "--no-colors", @pkgs); >>> + sleep(1); >>> } else { >>> &Header::openbox("100%", "center", >>> $Lang::tr{'request'}); >>> my @output = >>> &General::system_output("/usr/local/bin/pakfire", >>> "resolvedeps", "- >>> -no-colors", @pkgs); >>> @@ -98,9 +95,8 @@ END >>> } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e >>> $Pakfire::lockfile)) { >>> my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); >>> if ("$cgiparams{'FORCE'}" eq "on") { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pa >>> kfire >>> ", "remove", "--non-interactive", "--no-colors", @pkgs); >>> + sleep(1); >>> } else { >>> &Header::openbox("100%", "center", >>> $Lang::tr{'request'}); >>> my @output = >>> &General::system_output("/usr/local/bin/pakfire", >>> "resolvedeps", "- >>> -no-colors", @pkgs); >>> @@ -136,13 +132,11 @@ END >>> } >>> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e >>> $Pakfire::lockfile)) { >>> - # Set variable to lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire", >>> "update", "--force", "--no-colors"); >>> + sleep(1); >>> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e >>> $Pakfire::lockfile)) { >>> - # Lock the page. >>> - $page_lock = "1"; >>> &General::system_background("/usr/local/bin/pakfire", >>> "upgrade", "-y", "--no-colors"); >>> + sleep(1); >>> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >>> $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; >>> @@ -156,6 +150,7 @@ END >>> # Update lists >>> &General::system_background("/usr/local/bin/pa >>> kfire >>> ", "update", "--force", "--no-colors"); >>> + sleep(1); >>> } >>> } >>> @@ -177,44 +172,12 @@ if ($errormessage) { >>> &Header::closebox(); >>> } >>> -# Check if a page lock is required. >>> -if ($page_lock) { >>> - &Header::openbox('Waiting', 1, ,); >>> - print <<END; >>> - <table> >>> - <tr> >>> - <td> >>> - <img >>> src='/images/indicator.gif' alt='$Lang::tr{'active'}' >>> title='$Lang::tr{'active'}'> >>> - </td> >>> - >>> - <td> >>> - $Lang::tr{'pakfire >>> working'} >>> - </td> >>> - </tr> >>> - </table> >>> -END >>> - &Header::closebox(); >>> - >>> - # Infinite loop to lock the page until pakfire lockfile >>> is >>> present. >>> - while($page_lock) { >>> - unless (-e $Pakfire::lockfile) { >>> - sleep(1); >>> - } else { >>> - # Release page lock. >>> - undef($page_lock); >>> - >>> - # Break loop. >>> - last; >>> - } >>> - } >>> - >>> - # Perform page reload. >>> - print "<meta http-equiv='refresh' content='1;'>\n"; >>> - exit; >>> -} >>> +# Check if pakfire is already running. >>> +# >>> +# The system backpipe command is safe, because no user input >>> is >>> computed. >>> +my $pid = `pidof pakfire`; >>> -# Check if pakfire is already running. In this case a lockfile >>> is >>> present. >>> -if (-e $Pakfire::lockfile) { >>> +if ($pid) { >>> &Header::openbox( 'Waiting', 1, "<meta http- >>> equiv='refresh' >>> content='10;'>" ); >>> print <<END; >>> <table>
diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index f2381f031..4d6eee284 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; $cgiparams{'INSPAKS'} = ''; $cgiparams{'DELPAKS'} = ''; -my $page_lock; - sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();} &Header::getcgihash(\%cgiparams); @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont if (($cgiparams{'ACTION'} eq 'install') && (! -e $Pakfire::lockfile)) { my @pkgs = split(/\|/, $cgiparams{'INSPAKS'}); if ("$cgiparams{'FORCE'}" eq "on") { - # Lock the page. - $page_lock = "1"; &General::system_background("/usr/local/bin/pakfire", "install", "--non-interactive", "--no-colors", @pkgs); + sleep(1); } else { &Header::openbox("100%", "center", $Lang::tr{'request'}); my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); @@ -98,9 +95,8 @@ END } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e $Pakfire::lockfile)) { my @pkgs = split(/\|/, $cgiparams{'DELPAKS'}); if ("$cgiparams{'FORCE'}" eq "on") { - # Lock the page. - $page_lock = "1"; &General::system_background("/usr/local/bin/pakfire", "remove", "--non-interactive", "--no-colors", @pkgs); + sleep(1); } else { &Header::openbox("100%", "center", $Lang::tr{'request'}); my @output = &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "--no-colors", @pkgs); @@ -136,13 +132,11 @@ END } } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) { - # Set variable to lock the page. - $page_lock = "1"; &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); + sleep(1); } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) { - # Lock the page. - $page_lock = "1"; &General::system_background("/usr/local/bin/pakfire", "upgrade", "-y", "--no-colors"); + sleep(1); } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { $pakfiresettings{"TREE"} = $cgiparams{"TREE"}; @@ -156,6 +150,7 @@ END # Update lists &General::system_background("/usr/local/bin/pakfire", "update", "--force", "--no-colors"); + sleep(1); } } @@ -177,44 +172,12 @@ if ($errormessage) { &Header::closebox(); } -# Check if a page lock is required. -if ($page_lock) { - &Header::openbox('Waiting', 1, ,); - print <<END; - <table> - <tr> - <td> - <img src='/images/indicator.gif' alt='$Lang::tr{'active'}' title='$Lang::tr{'active'}'> - </td> - - <td> - $Lang::tr{'pakfire working'} - </td> - </tr> - </table> -END - &Header::closebox(); - - # Infinite loop to lock the page until pakfire lockfile is present. - while($page_lock) { - unless (-e $Pakfire::lockfile) { - sleep(1); - } else { - # Release page lock. - undef($page_lock); - - # Break loop. - last; - } - } - - # Perform page reload. - print "<meta http-equiv='refresh' content='1;'>\n"; - exit; -} +# Check if pakfire is already running. +# +# The system backpipe command is safe, because no user input is computed. +my $pid = `pidof pakfire`; -# Check if pakfire is already running. In this case a lockfile is present. -if (-e $Pakfire::lockfile) { +if ($pid) { &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" ); print <<END; <table>