tazbug rev 96

Fix ID incrementation (bug folders can be removed)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Feb 09 18:08:31 2017 +0100 (2017-02-09)
parents c228980c50a1
children 8c3d1f530e15
files web/bugs.cgi
line diff
     1.1 --- a/web/bugs.cgi	Mon Jan 16 09:38:26 2017 +0200
     1.2 +++ b/web/bugs.cgi	Thu Feb 09 18:08:31 2017 +0100
     1.3 @@ -373,9 +373,10 @@
     1.4  	rm -f $bugdir/$id/msg.$count.tmp
     1.5  }
     1.6  
     1.7 -# Create a new Bug. ID is set by counting dirs in bug/ including bug/0
     1.8 +# Create a new Bug. ID is set by counting dirs in bug/ + 1
     1.9  new_bug() {
    1.10 -	count=$(ls $bugdir | wc -l)
    1.11 +	count=$(ls $bugdir | sort -g | tail -n 1)
    1.12 +	count=$(($count +1))
    1.13  	date=$(date "+%Y-%m-%d %H:%M")
    1.14  	# Sanity check, JS may be disabled.
    1.15  	[ ! "$(GET bug)" ] && echo "Missing bug title" && exit 1