Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/web-scripts/to-delete.php
blob: 3d732a163daa59a18ae319a0b1b2fac504f2a50d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<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 DISTINCT " .
  "`repositories`.`name` AS `repo`," .
  "`is_there`.`pkgname`," .
  "`is_there`.`epoch`," .
  "`is_there`.`pkgver`," .
  "`is_there`.`pkgrel`," .
  "`is_there`.`sub_pkgrel`," .
  "`architectures`.`name` AS `arch` " .
  "FROM `binary_packages`AS `is_there` " .
  "JOIN `binary_packages` AS `to_delete` ON `to_delete`.`pkgname`=`is_there`.`pkgname` " .
  "JOIN `architectures` ON `is_there`.`architecture`=`architectures`.`id` " .
  "JOIN `repositories` ON `is_there`.`repository`=`repositories`.`id` " .
  "WHERE `to_delete`.`repository`=10 " .
  "AND NOT `is_there`.`repository` IN (4,9,10)"
);
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>