tazbug annotate web/plugins/debug/debug.cgi @ rev 101

Add Tazbug debug plugin
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 16:51:58 2017 +0100 (2017-02-10)
parents
children 6f798394f27e
rev   line source
pankso@101 1 #!/bin/sh
pankso@101 2 #
pankso@101 3 # TazBug Plugin - Debug Tazbug :-)
pankso@101 4 #
pankso@101 5
pankso@101 6 if [ "$(GET debug)" ]; then
pankso@101 7 d="Debug"
pankso@101 8 header
pankso@101 9 html_header
pankso@101 10 user_box
pankso@101 11 if ! check_auth; then
pankso@101 12 gettext "You must be logged in to view the dashboard"
pankso@101 13 exit 0
pankso@101 14 fi
pankso@101 15 cat << EOT
pankso@101 16 <h2>Debug interface</h2>
pankso@101 17 <div id="tools">
pankso@101 18 <a href="$script?dashboard">Dashboard</a>
pankso@101 19 </div>
pankso@101 20 EOT
pankso@101 21 # Handle ?debug&del request
pankso@101 22 if [ "$(GET del)" ]; then
pankso@101 23 id="$(GET del)"
pankso@101 24 if [ -d "${bugdir}/${id}" ]; then
pankso@101 25 echo -n "<pre>Removing bug ID: $id... "
pankso@101 26 rm -rf ${bugdir}/${id}
pankso@101 27 echo "Done</pre>"
pankso@101 28 fi
pankso@101 29 fi
pankso@101 30
pankso@101 31 # Check for bug DB consitensy
pankso@101 32 echo "<h3>Checking for bug.conf consistency</h3>"
pankso@101 33 for id in $(ls $bugdir | sort -g)
pankso@101 34 do
pankso@101 35 if [ $(cat ${bugdir}/${id}/bug.conf | wc -l) != 8 ]; then
pankso@101 36 echo "<pre>"
pankso@101 37 echo -e "ERROR: bug ID $id - <a href='?debug&amp;del=$id'>Delete</a>\n"
pankso@101 38 cat ${bugdir}/${id}/bug.conf
pankso@101 39 echo "</pre>"
pankso@101 40 fi
pankso@101 41 done
pankso@101 42 echo "$(ls -1 $bugdir | wc -l) bugs scanned"
pankso@101 43
pankso@101 44 html_footer & exit 0
pankso@101 45 fi