cookutils rev 1068

modules/compressor: compress_gif(): resulting file may be absent even if $?=0; lighttpd/index.cgi: avoid "flickering", show previous webstat values before updating
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jun 06 13:32:26 2018 +0300 (2018-06-06)
parents 9c90eaa721d2
children a40d41d389d3
files lighttpd/index.cgi modules/compressor
line diff
     1.1 --- a/lighttpd/index.cgi	Wed Jun 06 01:42:12 2018 +0300
     1.2 +++ b/lighttpd/index.cgi	Wed Jun 06 13:32:26 2018 +0300
     1.3 @@ -880,7 +880,8 @@
     1.4  		case $1 in
     1.5  			webstat)
     1.6  				echo -n "<div id='$1'>"
     1.7 -				show_note i 'Please wait while statistics are being collected.'
     1.8 +				# Show previous webstat, it will be updated seamless then
     1.9 +				nojs=1; part webstat noupdate
    1.10  				echo "</div><script>getPart('$1')</script>"
    1.11  				;;
    1.12  			*)
    1.13 @@ -915,7 +916,7 @@
    1.14  			;;
    1.15  		webstat)
    1.16  			# Do we need to update the statistics?
    1.17 -			[ "$webstat" -nt "$activity" ] || update_webstat
    1.18 +			[ -z "$2" -a "$webstat" -nt "$activity" ] || update_webstat
    1.19  			. $webstat
    1.20  
    1.21  			pct=0; [ "$rtotal" -gt 0 ] && pct=$(( ($rcooked * 100) / $rtotal ))
     2.1 --- a/modules/compressor	Wed Jun 06 01:42:12 2018 +0300
     2.2 +++ b/modules/compressor	Wed Jun 06 13:32:26 2018 +0300
     2.3 @@ -403,7 +403,7 @@
     2.4  			unset IFS
     2.5  			# use intermediate file, if all well ($?=0), then substitute the original
     2.6  			if gifsicle -O3 "$i" -o "$i.$$" >> "$the_log" 2>&1; then
     2.7 -				mv "$i.$$" "$i"
     2.8 +				if [ -s "$i.$$" ]; then mv "$i.$$" "$i"; fi
     2.9  			else
    2.10  				rm "$i.$$"
    2.11  			fi