diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:25:47 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:25:47 +0100 |
commit | 1421a2207c0130030233e901d6f5055f54417e68 (patch) | |
tree | 03430f49dee73ef462eb5e6a4df53a210db6d87e /rpm.php | |
parent | 5cd7540f6d5aa824106ab7e9171fd36ed380bacd (diff) |
use TableRpm in rpm.php
Diffstat (limited to 'rpm.php')
-rw-r--r-- | rpm.php | 58 |
1 files changed, 25 insertions, 33 deletions
@@ -61,14 +61,15 @@ function report($db, $type) { global $what, $smarty; $packages = null; - $rpmrepo = new TableRpmRepo($db); - $uptable = new TableUpstream($db); + $rpmrepo = new TableRpmRepo($db); + $rpmtable = new TableRpm($db); + $uptable = new TableUpstream($db); $repos = $rpmrepo->getAllRepoHash(); $smarty->assign('repos', $repos); $i=0; - foreach($uptable->request(array('type'=>$type, 'ORDER'=>'name')) as $up) { + foreach ($uptable->request(array('type'=>$type, 'ORDER'=>'name')) as $up) { $package = null; $rpmname = $up['name']; @@ -83,15 +84,14 @@ function report($db, $type) } } - $sql = "SELECT * FROM rpm WHERE name = '$rpmname'"; + $package['name'] = $rpmname; + $rpms = array(); + foreach ($rpmtable->request(array('name'=>$rpmname)) as $rpm) { + $rpms[$rpm['repo_main'].'-'.$rpm['repo_sub']] = $rpm; - $res=$db->query($sql); - $rpm = ($res ? $res->fetchObject() : false); - $rpms=array(); - if ( $rpm ) { - do { - $rpms[$rpm->repo_main."-".$rpm->repo_sub]=$rpm; - } while ($rpm = $res->fetchObject()); + $package['name'] = '<a href="zoom.php?rpm=' . $rpmname . + '" title="' . htmlentities($rpm['summary'], ENT_QUOTES) . + '">' . $rpmname . '</a>'; } switch ($what) { @@ -99,7 +99,7 @@ function report($db, $type) $display = false; if (count($rpms) && isset($rpms['devel-']) - && $rpms['devel-']->ver != $verup + && $rpms['devel-']['ver'] != $verup ) { $display = true; } @@ -119,13 +119,6 @@ function report($db, $type) } if ($display) { - if ($rpm) { - $package['name'] = '<a href="zoom.php?rpm=' . $rpmname . - '" title="' . htmlentities($rpm->summary) . '">' . - $rpmname . '</a>'; - } else { - $package['name'] = $rpmname; - } if ($up['channel'] != $up['type']) { $package['channel'] = $up['channel']; } @@ -136,8 +129,7 @@ function report($db, $type) $package['upstream_stable'] = $up['stable']; } if ($up['unstable'] - && (!$up['stable'] - || $up['stable']!=$up['unstable']) + && (!$up['stable'] || $up['stable']!=$up['unstable']) ) { $package['upstream_unstable'] = $up['unstable'] . ' <small>(' . $up['state'] . ')</small>'; @@ -151,9 +143,9 @@ function report($db, $type) if ( isset($rpms[$repo['main']."-".$repo['sub']]) ) { $rpm=$rpms[$repo['main']."-".$repo['sub']]; - $verpm=$rpm->ver; + $verpm = $rpm['ver']; $pat = "/\.((beta|RC)\d*)\./i"; - if (preg_match($pat, $rpm->rel, $res)) { + if (preg_match($pat, $rpm['rel'], $res)) { $verpm .= strtolower($res[1]); } @@ -162,14 +154,14 @@ function report($db, $type) if ( isset($rpms[$repo['main']."-updates"]) ) { $display .= sprintf( "%s-%s<br/>", - $rpm->ver, - $rpm->rel + $rpm['ver'], + $rpm['rel'] ); } else { $display .= sprintf( "<strong>%s</strong>-%s<br/>", - $rpm->ver, - $rpm->rel + $rpm['ver'], + $rpm['rel'] ); } if ( $verup==$verpm ) { @@ -179,8 +171,8 @@ function report($db, $type) case "": $display .= sprintf( "<strong>%s</strong>-%s<br/>", - $rpm->ver, - $rpm->rel + $rpm['ver'], + $rpm['rel'] ); if ( $verup==$verpm ) { $class="check"; @@ -190,8 +182,8 @@ function report($db, $type) $display .= sprintf( "<strong>%s</strong>-%s ". "<small>(updates)</small><br/>", - $rpm->ver, - $rpm->rel + $rpm['ver'], + $rpm['rel'] ); if ( $verup==$verpm ) { $class="check"; @@ -200,8 +192,8 @@ function report($db, $type) case "testing": $display .= sprintf( "%s-%s <small>(testing)</small><br/>", - $rpm->ver, - $rpm->rel + $rpm['ver'], + $rpm['rel'] ); if ( $verup==$verpm ) { $class="info"; |