summaryrefslogtreecommitdiff
path: root/buildmaster/to-delete.php
blob: f287ce52e540f8f7fd2aab2dfce31881c9935e28 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once "../init.php";
require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";

abort_iff_webspider();

  $result = mysql_run_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`," .
    "IF(`upstream_packages`.`id` IS NULL, 0, 1) AS `exists_upstream`" .
    " FROM `binary_packages`" .
    mysql_join_binary_packages_architectures() .
    mysql_join_binary_packages_binary_packages_in_repositories() .
    mysql_join_binary_packages_in_repositories_repositories() .
    " LEFT JOIN `upstream_packages`" .
    " ON `upstream_packages`.`pkgname`=`binary_packages`.`pkgname`" .
    " WHERE `binary_packages_in_repositories`.`is_to_be_deleted`" .
    " AND `repositories`.`is_on_master_mirror`" .
    " GROUP BY CONCAT(`binary_packages_in_repositories`.`id`,\"-\",IFNULL(`upstream_packages`.`pkgname`,0))"
  );

?>
<html>
<head>
<title>List of packages to be deleted</title>
<link rel="stylesheet" type="text/css" href="/static/style.css">
</head>
<body>
<?php

show_warning_on_offline_slave();

if ($result -> num_rows > 0) {

  $count = 0;

  while ($row = $result->fetch_assoc()) {

    if ($row['exists_upstream'] == 1)
      $color = "#FF0000";
    else
      $color = "#00FF00";

    $rows[$count] =
      "<font color=\"" . $color . "\">" .
      $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</font>";
    $count++;
  }

  sort($rows);

  foreach ($rows as $row) {
    print $row."<br>\n";
  }
} else {
  print "No packages are to be deleted.\n";
}

?>
</body>
</html>