tazbug rev 137
Update all plugins to use new storage paths
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 22 14:59:49 2017 +0100 (2017-02-22) |
parents | a7b3022941ad |
children | 2a172aca8228 |
files | web/bugs.cgi web/plugins/dashboard/dashboard.cgi web/plugins/debug/debug.cgi web/plugins/packages/packages.cgi web/plugins/textmode/textmode.cgi web/style.css |
line diff
1.1 --- a/web/bugs.cgi Tue Feb 21 21:41:29 2017 +0000 1.2 +++ b/web/bugs.cgi Wed Feb 22 14:59:49 2017 +0100 1.3 @@ -115,10 +115,10 @@ 1.4 1.5 # Check if user is admin 1.6 admin_user() { 1.7 - fgrep -w -q "$user" ${ADMIN_USERS} 1.8 + grep -w -q "$user" ${ADMIN_USERS} 1.9 } 1.10 1.11 -# Authenticated or not 1.12 +# Authenticated or not (login/logout are not translated to keep css width) 1.13 user_box() { 1.14 1.15 IDLOC="" 1.16 @@ -131,14 +131,14 @@ 1.17 cat << EOT 1.18 <div id="user"> 1.19 <a href="?user=$user">$(get_gravatar $MAIL 20)</a> 1.20 -<a href="?logout">$(gettext 'Logout')</a> 1.21 +<a href="?logout">Logout</a> 1.22 </div> 1.23 EOT 1.24 else 1.25 cat << EOT 1.26 <div id="user"> 1.27 <a href="?login$IDLOC"><img src="images/avatar.png" alt="[ User ]" /></a> 1.28 - <a href="?login$IDLOC">$(gettext 'Login')</a> 1.29 + <a href="?login$IDLOC">Login</a> 1.30 </div> 1.31 EOT 1.32 fi 1.33 @@ -247,7 +247,7 @@ 1.34 . ${PEOPLE}/${CREATOR}/account.conf 1.35 cat << EOT 1.36 <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \ 1.37 -ID $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 1.38 +Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 1.39 EOT 1.40 unset CREATOR USER MAIL bugpath 1.41 } 1.42 @@ -267,7 +267,7 @@ 1.43 . ${PEOPLE}/${CREATOR}/account.conf 1.44 cat << EOT 1.45 <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \ 1.46 -ID $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 1.47 +Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 1.48 EOT 1.49 fi 1.50 unset CREATOR USER MAIL BUG 1.51 @@ -285,7 +285,7 @@ 1.52 . ${PEOPLE}/${USER}/account.conf 1.53 cat << EOT 1.54 <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \ 1.55 -ID: <a href="?id=$id">Bug $id</a> by $USER <span class="date">- $DATE</span> 1.56 +<a href="?id=$id">Bug $id</a>: by $USER <span class="date">- $DATE</span> 1.57 EOT 1.58 unset CREATOR USER MAIL 1.59 } 1.60 @@ -310,9 +310,7 @@ 1.61 cat << EOT 1.62 <h2>$(eval_gettext 'Bug $id: $STATUS')</h2> 1.63 1.64 -<p> 1.65 - $(get_gravatar $MAIL 32) <strong>$BUG</strong> 1.66 -</p> 1.67 +<h3>$(get_gravatar $MAIL 32) $BUG</h3> 1.68 <p> 1.69 $(gettext "Date:") $DATE - 1.70 $(gettext "Creator:") <a href="?user=$CREATOR">$CREATOR</a> - 1.71 @@ -323,9 +321,16 @@ 1.72 <pre> 1.73 $(cat $bugdir/$id/desc.txt | wiki_parser) 1.74 </pre> 1.75 - 1.76 -<div id="tools"> 1.77 EOT 1.78 + if [ "$PKGS" ] && [ -x "$plugins/packages/packages.cgi" ]; then 1.79 + echo "<p>" 1.80 + echo "<strong>$(gettext 'Affected package(s):')</strong>" 1.81 + for pkg in $PKGS; do 1.82 + echo "<a href='?pkg=$pkg'>$pkg</a>" 1.83 + done 1.84 + echo "</p>" 1.85 + fi 1.86 + echo '<div id="tools">' 1.87 if check_auth; then 1.88 if [ "$STATUS" == "OPEN" ]; then 1.89 cat << EOT 1.90 @@ -404,7 +409,7 @@ 1.91 new_bug() { 1.92 count=$(ls_bugs | sort -g | tail -n 1) 1.93 id=$(($count +1)) 1.94 - date=$(date "+%Y-%m-%d %H:%M") 1.95 + date=$(date "+%Y-%m-%d") 1.96 # Sanity check, JS may be disabled. 1.97 [ ! "$(GET bug)" ] && echo "Missing bug title" && exit 1 1.98 [ ! "$(GET desc)" ] && echo "Missing bug description" && exit 1 1.99 @@ -793,28 +798,36 @@ 1.100 <input type="submit" value="$(gettext 'Search')" /> 1.101 </form> 1.102 <div> 1.103 +<p> 1.104 + $(gettext 'Search by pattern, package or user') 1.105 +</p> 1.106 EOT 1.107 - cd $bugdir 1.108 - for bug in * 1.109 + if [ ! "$(GET search)" ]; then 1.110 + html_footer && exit 0 1.111 + else 1.112 + echo "<h3>$(gettext 'Result for:') $(GET search)</h3>" 1.113 + fi 1.114 + for id in $(ls_bugs) 1.115 do 1.116 - result=$(fgrep -i -h "$(GET search)" $bug/*) 1.117 + set_bugdir "$id" 1.118 + result=$(fgrep -i -h "$(GET search)" $bugdir/$id/*) 1.119 if [ "$result" ]; then 1.120 found=$(($found + 1)) 1.121 - id=${bug} 1.122 - echo "<p><strong>Bug $id</strong> <a href=\"?id=$id\">"$(gettext 'Show')"</a></p>" 1.123 + echo "<p><strong>Bug $id</strong> - <a href=\"?id=$id\">"$(gettext 'Show')"</a></p>" 1.124 echo '<pre>' 1.125 - fgrep -i -h "$(GET search)" $bugdir/$id/* | \ 1.126 + echo "$result" | \ 1.127 sed s"/$(GET search)/<span class='ok'>$(GET search)<\/span>/"g 1.128 echo '</pre>' 1.129 fi 1.130 + bugdir=$(dirname $bugdir) 1.131 done 1.132 if [ "$found" == "0" ]; then 1.133 echo "<p>$(gettext 'No result found for') : $(GET search)</p>" 1.134 else 1.135 echo "<p> $found $(gettext 'results found')</p>" 1.136 fi 1.137 - echo '</div>' 1.138 - html_footer ;; 1.139 + echo '</div>' && html_footer ;; 1.140 + 1.141 *) 1.142 # Default page. 1.143 bugs=$(ls_bugs | wc -l)
2.1 --- a/web/plugins/dashboard/dashboard.cgi Tue Feb 21 21:41:29 2017 +0000 2.2 +++ b/web/plugins/dashboard/dashboard.cgi Wed Feb 22 14:59:49 2017 +0100 2.3 @@ -12,8 +12,6 @@ 2.4 gettext "You must be logged in to view the dashboard" 2.5 exit 0 2.6 fi 2.7 - bugs=$(ls -1 $bugdir | wc -l) 2.8 - bugsize=$(du -sh $bugdir | awk '{print $1}') 2.9 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS 2.10 ADMIN_TOOLS="" 2.11 DASHBOARD_TOOLS="" 2.12 @@ -31,9 +29,9 @@ 2.13 </div> 2.14 <h2>Dashboard</h2> 2.15 <pre> 2.16 -Bugs count : $bugs 2.17 -Database size : $bugsize 2.18 -Server uptime :$(uptime | cut -d "," -f 1-2) 2.19 +Bugs count : $(ls_bugs | wc -l) 2.20 +Messages count : $(find $bugdir -name msg.* | wc -l) 2.21 +Database size : $(du -sh $bugdir | awk '{print $1}') 2.22 </pre> 2.23 EOT 2.24
3.1 --- a/web/plugins/debug/debug.cgi Tue Feb 21 21:41:29 2017 +0000 3.2 +++ b/web/plugins/debug/debug.cgi Wed Feb 22 14:59:49 2017 +0100 3.3 @@ -14,6 +14,7 @@ 3.4 cat << EOT 3.5 <div id="tools"> 3.6 <a href="$script?dashboard">Dashboard</a> 3.7 + <a href="$script?debug">Recheck</a> 3.8 </div> 3.9 <h2>Debug interface</h2> 3.10 <p> 3.11 @@ -23,6 +24,7 @@ 3.12 # Handle ?debug&del request 3.13 if [ "$(GET del)" ]; then 3.14 id="$(GET del)" 3.15 + set_bugdir "$id" 3.16 if [ -d "${bugdir}/${id}" ]; then 3.17 echo -n "<pre>Removing bug ID: $id... " 3.18 rm -rf ${bugdir}/${id} 3.19 @@ -32,8 +34,9 @@ 3.20 3.21 # Check for bug DB consistency 3.22 echo "<h3>Checking for bug.conf consistency</h3>" 3.23 - for id in $(ls $bugdir | sort -g) 3.24 + for id in $(ls_bugs | sort -g) 3.25 do 3.26 + set_bugdir "$id" 3.27 if [ $(cat ${bugdir}/${id}/bug.conf | wc -l) != 8 ]; then 3.28 echo "<pre>" 3.29 echo -n "ERROR: bug ID $id" 3.30 @@ -65,9 +68,10 @@ 3.31 echo "</pre>" 3.32 fi 3.33 fi 3.34 + bugdir=$(dirname $bugdir) 3.35 unset miss 3.36 done 3.37 - echo "$(ls -1 $bugdir | wc -l) bugs scanned" 3.38 + echo "$(ls_bugs | wc -l) bugs scanned" 3.39 3.40 # Check for messages consistency 3.41 echo "<h3>Checking for empty messages</h3>" 3.42 @@ -76,7 +80,7 @@ 3.43 if [ "$empty" ]; then 3.44 echo "<pre>" 3.45 cd ${bugdir} 3.46 - for msg in */msg.* 3.47 + for msg in */*/msg.* 3.48 do 3.49 if [ ! -s "$msg" ]; then 3.50 # Delete msg ?
4.1 --- a/web/plugins/packages/packages.cgi Tue Feb 21 21:41:29 2017 +0000 4.2 +++ b/web/plugins/packages/packages.cgi Wed Feb 22 14:59:49 2017 +0100 4.3 @@ -12,14 +12,14 @@ 4.4 pkg=$(GET pkg) 4.5 echo "<h2>Bugs for: $pkg</h2>" 4.6 echo "<pre>" 4.7 - for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf) 4.8 + for bug in $(fgrep -l "OPEN" $bugdir/open/*/bug.conf) 4.9 do 4.10 . ${bug} 4.11 if echo "$PKGS" | fgrep -q "$pkg"; then 4.12 dir=$(dirname $bug) 4.13 id=$(basename $dir) 4.14 - echo "ID: $id <a href='$script?id=$id'>$BUG</a> \ 4.15 -<span class='date'>$DATE</span>" 4.16 + echo "Bug $id: <a href='$script?id=$id'>$BUG</a> \ 4.17 +- <span class='date'>$DATE</span>" 4.18 fi 4.19 done 4.20 echo "</pre>" 4.21 @@ -27,14 +27,18 @@ 4.22 # List all pkgs affected by a bug 4.23 echo "<h2>Buggy packages</h2>" 4.24 echo "<pre>" 4.25 - for bug in $(fgrep -l "OPEN" $bugdir/*/bug.conf) 4.26 + for bug in $(ls $bugdir/open) 4.27 do 4.28 - . ${bug} 4.29 - pkgs="$pkgs $PKGS" 4.30 + . $bugdir/open/${bug}/bug.conf 4.31 + for pkg in ${PKGS}; do 4.32 + if ! echo "$pkgs" | grep -q -w "$pkg"; then 4.33 + pkgs="$pkgs $PKGS" 4.34 + fi 4.35 unset PKGS 4.36 + done 4.37 done 4.38 for pkg in $pkgs; do 4.39 - echo "<a href='?pkg=$pkg'>$pkg</a> " 4.40 + echo "Package: <a href='?pkg=$pkg'>$pkg</a>" 4.41 done 4.42 echo "</pre>" 4.43 fi
5.1 --- a/web/plugins/textmode/textmode.cgi Tue Feb 21 21:41:29 2017 +0000 5.2 +++ b/web/plugins/textmode/textmode.cgi Wed Feb 22 14:59:49 2017 +0100 5.3 @@ -13,12 +13,14 @@ 5.4 case " $(GET) " in 5.5 5.6 *\ stats\ *) 5.7 - echo "Bugs count : $(ls $bugdir | wc -l)" 5.8 + echo "Bugs count : $(ls_bugs | wc -l)" 5.9 + echo "Messages count : $(find $bugdir -name msg.* | wc -l)" 5.10 echo "Database size : $(du -sh $bugdir | awk '{print $1}')" ;; 5.11 5.12 *\ search\ *) 5.13 - for bug in $(ls $bugdir) 5.14 + for bug in $(ls_bugs) 5.15 do 5.16 + set_bugdir "$bug" 5.17 result=$(fgrep -i -h "$(GET search)" $bugdir/$bug/*) 5.18 if [ "$result" ]; then 5.19 found=$(($found + 1)) 5.20 @@ -35,6 +37,7 @@ 5.21 *\ id\ *) 5.22 # Show bug information and description 5.23 id=$(GET id) 5.24 + set_bugdir "$id" 5.25 if [ -f "$bugdir/$id/bug.conf" ]; then 5.26 . ${bugdir}/${id}/bug.conf 5.27 cat << EOT