summaryrefslogtreecommitdiff
path: root/web-scripts
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-11 11:45:22 +0200
committerErich Eckner <git@eckner.net>2018-04-11 11:45:22 +0200
commit9e24e58c2294547bb03b8b1ba7bcfbb899d41b27 (patch)
tree1c40ac09ad22025594327701ab246cfaf9b802f9 /web-scripts
parentf165f3e18ca41768917459b82e757bae066c463c (diff)
downloadbuilder-9e24e58c2294547bb03b8b1ba7bcfbb899d41b27.tar.xz
web-scripts/todos.php: generate text-todos from database, too
Diffstat (limited to 'web-scripts')
-rw-r--r--web-scripts/todos.php109
1 files changed, 69 insertions, 40 deletions
diff --git a/web-scripts/todos.php b/web-scripts/todos.php
index 49bb9ac..99e991c 100644
--- a/web-scripts/todos.php
+++ b/web-scripts/todos.php
@@ -14,53 +14,82 @@ $result = $mysql -> query(
"FROM `todos`;"
);
-if ($result -> num_rows > 0) {
+if (isset($_GET["graph"])) {
- while ($row = $result->fetch_assoc())
- $knot_rows[$row["id"]] =
- $row["file"]. " (line ".$row["line"]."):\\n".str_replace("\"","\\\"",$row["description"]);
+ if ($result -> num_rows > 0) {
- unset($knots);
- foreach ($knot_rows as $knot)
- $knots=$knots . "\"" . $knot . "\";\n";
+ 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++;
+ $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";
}
- unset($edges);
- foreach ($link_rows as $link)
- $edges=$edges . "\"" . $link["depending_on"] . "\" -> \"" . $link["dependent"] . "\";\n";
-}
+ $knots = str_replace("\$","\\\$",$knots);
+ $edges = str_replace("\$","\\\$",$edges);
-$knots = str_replace("\$","\\\$",$knots);
-$edges = str_replace("\$","\\\$",$edges);
-
-header ("Content-type: image/png");
-passthru(
- "dot -Tpng -o/dev/stdout /dev/stdin <<EOF\n" .
- "digraph dependencies {\n" .
- "rankdir=LR;\n" .
- "fontname=dejavu;\n" .
- $knots .
- $edges .
- "}\n" .
- "EOF\n"
-);
+ header ("Content-type: image/png");
+ passthru(
+ "dot -Tpng -o/dev/stdout /dev/stdin <<EOF\n" .
+ "digraph dependencies {\n" .
+ "rankdir=LR;\n" .
+ "fontname=dejavu;\n" .
+ $knots .
+ $edges .
+ "}\n" .
+ "EOF\n"
+ );
+
+} else { // isset($_GET["graph"])
+
+ if ($result -> num_rows > 0) {
+
+ print "<html>\n";
+ print "<head>\n";
+ print "<title>Todos in the build scripts</title>\n";
+ print "</head>\n";
+ print "<body>\n";
+
+ while ($row = $result->fetch_assoc()) {
+ print "<a href=\"#TODO" . $row["id"] . "\">TODO #" . $row["id"] . "</a>";
+ print " - ";
+ print "<a href=\"https://github.com/archlinux32/builder/blob/master/" . $row["file"] . "#L" . $row["line"] . "\">" . $row["file"] . "(line " . $row["line"] . ")</a>";
+ print ":<br>\n";
+ print str_replace("\\n","<br>\n",$row["description"]);
+ print "<br>\n";
+ print "<br>\n";
+ }
+
+ print "</body>\n";
+ print "</html>\n";
+
+ }
+
+}
?>