From 6d93913ca2893a7fc5499c0cb5d6e70831e7af50 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 11 Apr 2018 16:54:13 +0200 Subject: status quo --- scripts/todos.php | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 scripts/todos.php (limited to 'scripts/todos.php') diff --git a/scripts/todos.php b/scripts/todos.php new file mode 100644 index 0000000..99e991c --- /dev/null +++ b/scripts/todos.php @@ -0,0 +1,95 @@ +connect_error) { + die("Connection failed: " . $mysql->connect_error); +} + +$result = $mysql -> query( + "SELECT DISTINCT " . + "`todos`.`id`," . + "`todos`.`file`," . + "`todos`.`line`," . + "`todos`.`description` " . + "FROM `todos`;" +); + +if (isset($_GET["graph"])) { + + if ($result -> num_rows > 0) { + + while ($row = $result->fetch_assoc()) + $knot_rows[$row["id"]] = + $row["file"]. " (line ".$row["line"]."):\\n".str_replace("\"","\\\"",$row["description"]); + + unset($knots); + foreach ($knot_rows as $knot) + $knots=$knots . "\"" . $knot . "\";\n"; + + } + + $result = $mysql -> query( + "SELECT DISTINCT " . + "`todo_links`.`dependent`," . + "`todo_links`.`depending_on` " . + "FROM `todo_links`;" + ); + + if ($result -> num_rows > 0) { + $count = 0; + while ($row = $result->fetch_assoc()) { + $link_rows[$count]["dependent"] = + $knot_rows[$row["dependent"]]; + $link_rows[$count]["depending_on"] = + $knot_rows[$row["depending_on"]]; + $count++; + } + + unset($edges); + foreach ($link_rows as $link) + $edges=$edges . "\"" . $link["depending_on"] . "\" -> \"" . $link["dependent"] . "\";\n"; + } + + $knots = str_replace("\$","\\\$",$knots); + $edges = str_replace("\$","\\\$",$edges); + + header ("Content-type: image/png"); + passthru( + "dot -Tpng -o/dev/stdout /dev/stdin < num_rows > 0) { + + print "\n"; + print "\n"; + print "Todos in the build scripts\n"; + print "\n"; + print "\n"; + + while ($row = $result->fetch_assoc()) { + print "TODO #" . $row["id"] . ""; + print " - "; + print "" . $row["file"] . "(line " . $row["line"] . ")"; + print ":
\n"; + print str_replace("\\n","
\n",$row["description"]); + print "
\n"; + print "
\n"; + } + + print "\n"; + print "\n"; + + } + +} + +?> -- cgit v1.2.3-54-g00ecf