tazbug 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 bcaad2bc76c8
children 6254414d1424
files web/plugins/debug/debug.cgi web/plugins/debug/debug.conf
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/web/plugins/debug/debug.cgi	Fri Feb 10 16:51:58 2017 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# TazBug Plugin - Debug Tazbug :-)
     1.7 +#
     1.8 +
     1.9 +if [ "$(GET debug)" ]; then
    1.10 +	d="Debug"
    1.11 +	header
    1.12 +	html_header
    1.13 +	user_box
    1.14 +	if ! check_auth; then
    1.15 +		gettext "You must be logged in to view the dashboard"
    1.16 +		exit 0
    1.17 +	fi
    1.18 +	cat << EOT
    1.19 +<h2>Debug interface</h2>
    1.20 +<div id="tools">
    1.21 +	<a href="$script?dashboard">Dashboard</a>
    1.22 +</div>
    1.23 +EOT
    1.24 +	# Handle ?debug&del request
    1.25 +	if [ "$(GET del)" ]; then
    1.26 +		id="$(GET del)"
    1.27 +		if [ -d "${bugdir}/${id}" ]; then
    1.28 +			echo -n "<pre>Removing bug ID: $id... "
    1.29 +			rm -rf ${bugdir}/${id}
    1.30 +			echo "Done</pre>"
    1.31 +		fi
    1.32 +	fi
    1.33 +
    1.34 +	# Check for bug DB consitensy
    1.35 +	echo "<h3>Checking for bug.conf consistency</h3>"
    1.36 +	for id in $(ls $bugdir | sort -g)
    1.37 +	do
    1.38 +		if [ $(cat ${bugdir}/${id}/bug.conf | wc -l) != 8 ]; then
    1.39 +			echo "<pre>"
    1.40 +			echo -e "ERROR: bug ID $id - <a href='?debug&amp;del=$id'>Delete</a>\n"
    1.41 +			cat ${bugdir}/${id}/bug.conf
    1.42 +			echo "</pre>"
    1.43 +		fi
    1.44 +	done
    1.45 +	echo "$(ls -1 $bugdir | wc -l) bugs scanned"
    1.46 +	
    1.47 +	html_footer & exit 0
    1.48 +fi
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/web/plugins/debug/debug.conf	Fri Feb 10 16:51:58 2017 +0100
     2.3 @@ -0,0 +1,9 @@
     2.4 +# TinyCM/TazBug Plugin configuration
     2.5 +
     2.6 +PLUGIN="Debug Tazbug"
     2.7 +SHORT_DESC="Debug and clean-up Tazbug database"
     2.8 +MAINTAINER="devel@slitaz.org"
     2.9 +PLUGINS_TOOLS="${PLUGINS_TOOLS}"
    2.10 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?debug'>Debug</a>"
    2.11 +
    2.12 +# Configurable variables used in plugin.cgi