# HG changeset patch # User Christophe Lincoln # Date 1487771989 -3600 # Node ID f07cd117feedbc83fcb3f82f4225db176702ad9b # Parent a7b3022941ad4cb7791f719ce80bb5cd19f8187b Update all plugins to use new storage paths diff -r a7b3022941ad -r f07cd117feed web/bugs.cgi --- a/web/bugs.cgi Tue Feb 21 21:41:29 2017 +0000 +++ b/web/bugs.cgi Wed Feb 22 14:59:49 2017 +0100 @@ -115,10 +115,10 @@ # Check if user is admin admin_user() { - fgrep -w -q "$user" ${ADMIN_USERS} + grep -w -q "$user" ${ADMIN_USERS} } -# Authenticated or not +# Authenticated or not (login/logout are not translated to keep css width) user_box() { IDLOC="" @@ -131,14 +131,14 @@ cat << EOT
$(get_gravatar $MAIL 20) -$(gettext 'Logout') +Logout
EOT else cat << EOT
[ User ] - $(gettext 'Login') + Login
EOT fi @@ -247,7 +247,7 @@ . ${PEOPLE}/${CREATOR}/account.conf cat << EOT $(get_gravatar "$MAIL" 24) \ -ID $id: $BUG - $DATE +Bug $id: $BUG - $DATE EOT unset CREATOR USER MAIL bugpath } @@ -267,7 +267,7 @@ . ${PEOPLE}/${CREATOR}/account.conf cat << EOT $(get_gravatar "$MAIL" 24) \ -ID $id: $BUG - $DATE +Bug $id: $BUG - $DATE EOT fi unset CREATOR USER MAIL BUG @@ -285,7 +285,7 @@ . ${PEOPLE}/${USER}/account.conf cat << EOT $(get_gravatar "$MAIL" 24) \ -ID: Bug $id by $USER - $DATE +Bug $id: by $USER - $DATE EOT unset CREATOR USER MAIL } @@ -310,9 +310,7 @@ cat << EOT

$(eval_gettext 'Bug $id: $STATUS')

-

- $(get_gravatar $MAIL 32) $BUG -

+

$(get_gravatar $MAIL 32) $BUG

$(gettext "Date:") $DATE - $(gettext "Creator:") $CREATOR - @@ -323,9 +321,16 @@

 $(cat $bugdir/$id/desc.txt | wiki_parser)
 
- -
EOT + if [ "$PKGS" ] && [ -x "$plugins/packages/packages.cgi" ]; then + echo "

" + echo "$(gettext 'Affected package(s):')" + for pkg in $PKGS; do + echo "$pkg" + done + echo "

" + fi + echo '
' if check_auth; then if [ "$STATUS" == "OPEN" ]; then cat << EOT @@ -404,7 +409,7 @@ new_bug() { count=$(ls_bugs | sort -g | tail -n 1) id=$(($count +1)) - date=$(date "+%Y-%m-%d %H:%M") + date=$(date "+%Y-%m-%d") # Sanity check, JS may be disabled. [ ! "$(GET bug)" ] && echo "Missing bug title" && exit 1 [ ! "$(GET desc)" ] && echo "Missing bug description" && exit 1 @@ -793,28 +798,36 @@
+

+ $(gettext 'Search by pattern, package or user') +

EOT - cd $bugdir - for bug in * + if [ ! "$(GET search)" ]; then + html_footer && exit 0 + else + echo "

$(gettext 'Result for:') $(GET search)

" + fi + for id in $(ls_bugs) do - result=$(fgrep -i -h "$(GET search)" $bug/*) + set_bugdir "$id" + result=$(fgrep -i -h "$(GET search)" $bugdir/$id/*) if [ "$result" ]; then found=$(($found + 1)) - id=${bug} - echo "

Bug $id "$(gettext 'Show')"

" + echo "

Bug $id - "$(gettext 'Show')"

" echo '
'
-				fgrep -i -h "$(GET search)" $bugdir/$id/* | \
+				echo "$result" | \
 					sed s"/$(GET search)/$(GET search)<\/span>/"g
 				echo '
' fi + bugdir=$(dirname $bugdir) done if [ "$found" == "0" ]; then echo "

$(gettext 'No result found for') : $(GET search)

" else echo "

$found $(gettext 'results found')

" fi - echo '
' - html_footer ;; + echo '
' && html_footer ;; + *) # Default page. bugs=$(ls_bugs | wc -l) diff -r a7b3022941ad -r f07cd117feed web/plugins/dashboard/dashboard.cgi --- a/web/plugins/dashboard/dashboard.cgi Tue Feb 21 21:41:29 2017 +0000 +++ b/web/plugins/dashboard/dashboard.cgi Wed Feb 22 14:59:49 2017 +0100 @@ -12,8 +12,6 @@ gettext "You must be logged in to view the dashboard" exit 0 fi - bugs=$(ls -1 $bugdir | wc -l) - bugsize=$(du -sh $bugdir | awk '{print $1}') # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS ADMIN_TOOLS="" DASHBOARD_TOOLS="" @@ -31,9 +29,9 @@

Dashboard

-Bugs count       : $bugs
-Database size    : $bugsize
-Server uptime    :$(uptime | cut -d "," -f 1-2)
+Bugs count       : $(ls_bugs | wc -l)
+Messages count   : $(find $bugdir -name msg.* | wc -l)
+Database size    : $(du -sh $bugdir | awk '{print $1}')
 
EOT diff -r a7b3022941ad -r f07cd117feed web/plugins/debug/debug.cgi --- a/web/plugins/debug/debug.cgi Tue Feb 21 21:41:29 2017 +0000 +++ b/web/plugins/debug/debug.cgi Wed Feb 22 14:59:49 2017 +0100 @@ -14,6 +14,7 @@ cat << EOT
Dashboard + Recheck

Debug interface

@@ -23,6 +24,7 @@ # Handle ?debug&del request if [ "$(GET del)" ]; then id="$(GET del)" + set_bugdir "$id" if [ -d "${bugdir}/${id}" ]; then echo -n "

Removing bug ID: $id... "
 			rm -rf ${bugdir}/${id}
@@ -32,8 +34,9 @@
 
 	# Check for bug DB consistency
 	echo "

Checking for bug.conf consistency

" - for id in $(ls $bugdir | sort -g) + for id in $(ls_bugs | sort -g) do + set_bugdir "$id" if [ $(cat ${bugdir}/${id}/bug.conf | wc -l) != 8 ]; then echo "
"
 			echo -n "ERROR: bug ID $id"
@@ -65,9 +68,10 @@
 				echo "
" fi fi + bugdir=$(dirname $bugdir) unset miss done - echo "$(ls -1 $bugdir | wc -l) bugs scanned" + echo "$(ls_bugs | wc -l) bugs scanned" # Check for messages consistency echo "

Checking for empty messages

" @@ -76,7 +80,7 @@ if [ "$empty" ]; then echo "
"
 		cd ${bugdir}
-		for msg in */msg.*
+		for msg in */*/msg.*
 		do
 			if [ ! -s "$msg" ]; then
 				# Delete msg ?
diff -r a7b3022941ad -r f07cd117feed web/plugins/packages/packages.cgi
--- a/web/plugins/packages/packages.cgi	Tue Feb 21 21:41:29 2017 +0000
+++ b/web/plugins/packages/packages.cgi	Wed Feb 22 14:59:49 2017 +0100
@@ -12,14 +12,14 @@
 		pkg=$(GET pkg)
 		echo "

Bugs for: $pkg

" echo "
"
-		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
+		for bug in $(fgrep -l "OPEN" $bugdir/open/*/bug.conf)
 		do
 			. ${bug}
 			if echo "$PKGS" | fgrep -q "$pkg"; then
 				dir=$(dirname $bug)
 				id=$(basename $dir)
-				echo "ID: $id $BUG \
-$DATE"
+				echo "Bug $id: $BUG \
+- $DATE"
 			fi
 		done
 		echo "
" @@ -27,14 +27,18 @@ # List all pkgs affected by a bug echo "

Buggy packages

" echo "
"
-		for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf)
+		for bug in $(ls $bugdir/open)
 		do
-			. ${bug}
-			pkgs="$pkgs $PKGS"
+			. $bugdir/open/${bug}/bug.conf
+			for pkg in ${PKGS}; do
+				if ! echo "$pkgs" | grep -q -w "$pkg"; then
+					pkgs="$pkgs $PKGS"
+				fi
 			unset PKGS
+			done
 		done
 		for pkg in $pkgs; do
-			echo "$pkg "
+			echo "Package: $pkg"
 		done
 		echo "
" fi diff -r a7b3022941ad -r f07cd117feed web/plugins/textmode/textmode.cgi --- a/web/plugins/textmode/textmode.cgi Tue Feb 21 21:41:29 2017 +0000 +++ b/web/plugins/textmode/textmode.cgi Wed Feb 22 14:59:49 2017 +0100 @@ -13,12 +13,14 @@ case " $(GET) " in *\ stats\ *) - echo "Bugs count : $(ls $bugdir | wc -l)" + echo "Bugs count : $(ls_bugs | wc -l)" + echo "Messages count : $(find $bugdir -name msg.* | wc -l)" echo "Database size : $(du -sh $bugdir | awk '{print $1}')" ;; *\ search\ *) - for bug in $(ls $bugdir) + for bug in $(ls_bugs) do + set_bugdir "$bug" result=$(fgrep -i -h "$(GET search)" $bugdir/$bug/*) if [ "$result" ]; then found=$(($found + 1)) @@ -35,6 +37,7 @@ *\ id\ *) # Show bug information and description id=$(GET id) + set_bugdir "$id" if [ -f "$bugdir/$id/bug.conf" ]; then . ${bugdir}/${id}/bug.conf cat << EOT diff -r a7b3022941ad -r f07cd117feed web/style.css --- a/web/style.css Tue Feb 21 21:41:29 2017 +0000 +++ b/web/style.css Wed Feb 22 14:59:49 2017 +0100 @@ -46,7 +46,7 @@ float: right; padding: 14px 5px 0; font-size: 12px; - margin-right: 100px; + margin-right: 104px; } #network a, #network span {