diff options
author | Erich Eckner <git@eckner.net> | 2018-04-11 16:54:13 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-11 16:54:13 +0200 |
commit | 6d93913ca2893a7fc5499c0cb5d6e70831e7af50 (patch) | |
tree | 2e3b2e0a9779f75200648857852a9bc8171750ef /scripts/to-delete.php | |
download | archweb32-6d93913ca2893a7fc5499c0cb5d6e70831e7af50.tar.xz |
status quo
Diffstat (limited to 'scripts/to-delete.php')
-rw-r--r-- | scripts/to-delete.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/scripts/to-delete.php b/scripts/to-delete.php new file mode 100644 index 0000000..dfa5a39 --- /dev/null +++ b/scripts/to-delete.php @@ -0,0 +1,61 @@ +<html> +<head> +<title>List of packages to be deleted</title> +<link rel="stylesheet" type="text/css" href="/static/style.css"> +</head> +<body> +<?php + +$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster"); +if ($mysql->connect_error) { + die("Connection failed: " . $mysql->connect_error); +} + +$result = $mysql -> query( + "SELECT " . + "`repositories`.`name` AS `repo`," . + "`binary_packages`.`pkgname`," . + "`binary_packages`.`epoch`," . + "`binary_packages`.`pkgver`," . + "`binary_packages`.`pkgrel`," . + "`binary_packages`.`sub_pkgrel`," . + "`architectures`.`name` AS `arch` " . + "FROM `binary_packages` " . + "JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id` " . + "JOIN `repositories` ON `binary_packages`.`repository`=`repositories`.`id` " . + "WHERE `binary_packages`.`is_to_be_deleted` " . + "AND NOT `repositories`.`name` IN (\"build-support\",\"build-list\",\"deletion-list\")" +); +if ($result -> num_rows > 0) { + + $count = 0; + + while ($row = $result->fetch_assoc()) { + $rows[$count] = + $row["repo"] . "/" . + $row["pkgname"] . "-"; + if ($row["epoch"] != "0") + $rows[$count] = + $rows[$count] . + $row["epoch"] . ":"; + $rows[$count] = + $rows[$count] . + $row["pkgver"] . "-" . + $row["pkgrel"] . "." . + $row["sub_pkgrel"] . "-" . + $row["arch"] . ".pkg.tar.xz"; + $count++; + } + + sort($rows); + + foreach ($rows as $row) { + print $row."<br>\n"; + } +} else { + print "No packages are to be deleted.\n"; +} + +?> +</body> +</html> |