diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-09-04 17:04:21 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-09-04 17:04:21 +0000 |
commit | 32a5e12669c01d4bce6c28835eb24bd410d7e5a9 (patch) | |
tree | 4154eeab0805c143e2abf3c4d8cdcefd9a477c4f | |
parent | b6a1bffd90a5f5fd38bb7208bc79e210ff6030ae (diff) | |
download | pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.gz pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.bz2 pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.xz pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.zip |
new get_submitted_packages()
-rw-r--r-- | lib.php | 20 | ||||
-rw-r--r-- | test_index.php | 12 |
2 files changed, 24 insertions, 8 deletions
@@ -19,6 +19,26 @@ */ /** + * List all packages submitted to the BS. + * + * @param string $upload_dir + * + * @return array +*/ +function get_submitted_packages($upload_dir) +{ + chdir($upload_dir); + + $matches = array(); + $all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.lock' -o -name '*.done' -o -name '*.upload' \) -ctime -$max_modified -printf \"%p\t%T@\\n\""); + $re = "!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.*)(\.src\.rpm(?:\.info)?|\.lock|\.done|\.upload)\s+(\d+\.\d+)$!m"; + $r = preg_match_all($re, + $all_files, + $matches, + PREG_SET_ORDER); +} + +/** * Return a human-readable label for this package build status. * * @param array $pkg package information diff --git a/test_index.php b/test_index.php index 87100b5..40a523b 100644 --- a/test_index.php +++ b/test_index.php @@ -45,15 +45,9 @@ if ($g_user) { $tz = new DateTimeZone('UTC'); $date_gen = date('c'); -chdir($upload_dir); +$matches = get_submitted_packages($upload_dir); -$matches = array(); -$all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.lock' -o -name '*.done' -o -name '*.upload' \) -ctime -$max_modified -printf \"%p\t%T@\\n\""); -$re = "!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.*)(\.src\.rpm(?:\.info)?|\.lock|\.done|\.upload)\s+(\d+\.\d+)$!m"; -$r = preg_match_all($re, - $all_files, - $matches, - PREG_SET_ORDER); +// next block: INPUT: $matches, $_GET['package'] if set $pkgs = array(); $hosts = array(); @@ -142,6 +136,8 @@ ksort($build_dates); $build_count = count($buildtime_total); $buildtime_total = array_sum($buildtime_total); +// above block. OUTPUT: $pkgs, $build_dates, $buildtime_total, $hosts + list($stats, $users, $total, $pkgs) = build_stats($pkgs); $last_pkg = (isset($_GET['last']) && $total > 0) ? reset($pkgs) : null; |