[4/7] pakfire.cgi: Notify user if Pakfire is already performing a task
Commit Message
Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
---
html/cgi-bin/pakfire.cgi | 6 ++++--
langs/de/cgi-bin/de.pl | 1 +
langs/en/cgi-bin/en.pl | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
Comments
Acked-by: Peter Müller <peter.muelle@ipfire.org>
> Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
> ---
> html/cgi-bin/pakfire.cgi | 6 ++++--
> langs/de/cgi-bin/de.pl | 1 +
> langs/en/cgi-bin/en.pl | 1 +
> 3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi
> index daa82e34c..ec3ee2cc6 100644
> --- a/html/cgi-bin/pakfire.cgi
> +++ b/html/cgi-bin/pakfire.cgi
> @@ -96,8 +96,10 @@ if($cgiparams{'ACTION'} eq 'json-getstatus') {
> }
>
> ### Process Pakfire install/update commands ###
> -if(($cgiparams{'ACTION'} ne '') && (! &_is_pakfire_busy())) {
> - if(($cgiparams{'ACTION'} eq 'install') && ($cgiparams{'FORCE'} eq 'on')) {
> +if($cgiparams{'ACTION'} ne '') {
> + if(&_is_pakfire_busy()) {
> + $errormessage = $Lang::tr{'pakfire already busy'};
> + } elsif(($cgiparams{'ACTION'} eq 'install') && ($cgiparams{'FORCE'} eq 'on')) {
> my @pkgs = split(/\|/, $cgiparams{'INSPAKS'});
> &General::system_background("/usr/local/bin/pakfire", "install", "--non-interactive", "--no-colors", @pkgs);
> } elsif(($cgiparams{'ACTION'} eq 'remove') && ($cgiparams{'FORCE'} eq 'on')) {
> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
> index a841b39f9..7a39e233b 100644
> --- a/langs/de/cgi-bin/de.pl
> +++ b/langs/de/cgi-bin/de.pl
> @@ -1990,6 +1990,7 @@
> 'pagerefresh' => 'Seite wird aktualisiert. Bitte warten.',
> 'pakfire accept all' => 'Möchten Sie der Installation aller Pakete zustimmen?',
> 'pakfire ago' => 'her.',
> +'pakfire already busy' => 'Pakfire führt bereits eine Aufgabe aus. Bitte versuchen Sie es später erneut.',
> 'pakfire available addons' => 'Verfügbare Addons:',
> 'pakfire configuration' => 'Pakfire Konfiguration',
> 'pakfire core update auto' => 'Core- und Addon-Updates automatisch installieren:',
> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
> index e30ee4f69..f90e3103b 100644
> --- a/langs/en/cgi-bin/en.pl
> +++ b/langs/en/cgi-bin/en.pl
> @@ -2041,6 +2041,7 @@
> 'pagerefresh' => 'Page is beeing refreshed, please wait.',
> 'pakfire accept all' => 'Do you want to install all packages?',
> 'pakfire ago' => 'ago.',
> +'pakfire already busy' => 'Pakfire is already performing a task. Please try again later.',
> 'pakfire available addons' => 'Available Addons:',
> 'pakfire configuration' => 'Pakfire Configuration',
> 'pakfire core update auto' => 'Install core and addon updates automatically:',
@@ -96,8 +96,10 @@ if($cgiparams{'ACTION'} eq 'json-getstatus') {
}
### Process Pakfire install/update commands ###
-if(($cgiparams{'ACTION'} ne '') && (! &_is_pakfire_busy())) {
- if(($cgiparams{'ACTION'} eq 'install') && ($cgiparams{'FORCE'} eq 'on')) {
+if($cgiparams{'ACTION'} ne '') {
+ if(&_is_pakfire_busy()) {
+ $errormessage = $Lang::tr{'pakfire already busy'};
+ } elsif(($cgiparams{'ACTION'} eq 'install') && ($cgiparams{'FORCE'} eq 'on')) {
my @pkgs = split(/\|/, $cgiparams{'INSPAKS'});
&General::system_background("/usr/local/bin/pakfire", "install", "--non-interactive", "--no-colors", @pkgs);
} elsif(($cgiparams{'ACTION'} eq 'remove') && ($cgiparams{'FORCE'} eq 'on')) {
@@ -1990,6 +1990,7 @@
'pagerefresh' => 'Seite wird aktualisiert. Bitte warten.',
'pakfire accept all' => 'Möchten Sie der Installation aller Pakete zustimmen?',
'pakfire ago' => 'her.',
+'pakfire already busy' => 'Pakfire führt bereits eine Aufgabe aus. Bitte versuchen Sie es später erneut.',
'pakfire available addons' => 'Verfügbare Addons:',
'pakfire configuration' => 'Pakfire Konfiguration',
'pakfire core update auto' => 'Core- und Addon-Updates automatisch installieren:',
@@ -2041,6 +2041,7 @@
'pagerefresh' => 'Page is beeing refreshed, please wait.',
'pakfire accept all' => 'Do you want to install all packages?',
'pakfire ago' => 'ago.',
+'pakfire already busy' => 'Pakfire is already performing a task. Please try again later.',
'pakfire available addons' => 'Available Addons:',
'pakfire configuration' => 'Pakfire Configuration',
'pakfire core update auto' => 'Install core and addon updates automatically:',