summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-10-31 18:02:59 +0100
committerRemi Collet <fedora@famillecollet.com>2010-10-31 18:02:59 +0100
commitefc4cbd224958735e5673507c2acd4efe43ffc65 (patch)
tree3d178d14c4d77d15dcd245d7f0024adb86609737
parent13f5a889da9cd6fcb864ae0b84eb31e4e97a9d10 (diff)
create TableUpstream class and use it everywhere
-rw-r--r--class/TableUpstream.php110
-rw-r--r--refresh.php172
-rw-r--r--rpm.php271
-rw-r--r--smarty/templates/rpmphp/rpm.tpl2
-rw-r--r--testdb.php22
-rw-r--r--zoom.php33
6 files changed, 329 insertions, 281 deletions
diff --git a/class/TableUpstream.php b/class/TableUpstream.php
new file mode 100644
index 0000000..5d076c2
--- /dev/null
+++ b/class/TableUpstream.php
@@ -0,0 +1,110 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Class for "repo" Table management
+ *
+ * PHP version 5
+ *
+ * Copyright © 2010 Remi Collet
+ *
+ * This file is part of rpmphp.
+ *
+ * rpmphp is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * rpmphp is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with rpmphp. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Main
+ * @package RPMPHP
+ *
+ * @author Remi Collet <unknown@unknwown.com>
+ * @author Johan Cwiklinski <johan@x-tnd.be>
+ * @copyright 2010 Remi Collet
+ * @license http://www.gnu.org/licenses/agpl-3.0-standalone.html AGPL License 3.0 or (at your option) any later version
+ * @link http://github.com/remicollet/rpmphp/
+ * @since The begining of times.
+*/
+class TableUpstream extends CommonTable
+{
+
+ /**
+ * Instanciate a TablePearRepo to manage pearrepo table
+ *
+ * @param object $db PDO instance of the DB connection
+ */
+ function __construct($db)
+ {
+ parent::__construct($db, 'upstream');
+ }
+
+ /**
+ * Create the table and populate it with known repo
+ *
+ * @return void
+ */
+ protected function createTable()
+ {
+ // Table schema
+ $sql = "CREATE TABLE IF NOT EXISTS `upstream` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `type` varchar(20) NOT NULL,
+ `channel` varchar(20) NOT NULL,
+ `stable` varchar(20) DEFAULT NULL,
+ `unstable` varchar(20) DEFAULT NULL,
+ `state` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_type` (`name`,`type`),
+ KEY `type` (`type`),
+ KEY `channel` (`channel`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
+ $this->exec($sql);
+ }
+
+ /**
+ * Add or update an upstream record
+ *
+ * @param string $type of package (R, pear, pecl, ...)
+ * @param string $channel providing this package
+ * @param string $name of the RPM
+ * @param string $ver version
+ * @param boolean $stable true if stable version, else unstable
+ * @param string $statename additional comment (alpha, beta, ...)
+ *
+ * @return integer id of the created/updatedrecord
+ */
+ public function record($type, $channel, $name, $ver, $stable, $statename='')
+ {
+ $key = array(
+ 'name' => $name,
+ 'type' => $type
+ );
+ $input = array(
+ 'channel' => $channel,
+ );
+ $input[$stable ? 'stable' : 'unstable'] = $ver;
+ if ($statename) {
+ $input['state'] = $statename;
+ }
+
+ $data = $this->find($key);
+ if ($data) {
+ if ($this->update($data['id'], $input)) {
+ return $data['id'];
+ }
+ return false;
+ }
+ return $this->add(array_merge($key, $input));
+ }
+}
+?> \ No newline at end of file
diff --git a/refresh.php b/refresh.php
index 4026f68..539e1a5 100644
--- a/refresh.php
+++ b/refresh.php
@@ -46,39 +46,6 @@ if (isset($_SERVER["SERVER_NAME"])) {
require "include/main.php";
require "class/CommonTable.php";
-/**
-* To document
-*
-* @param Object $db Database reference
-* @param string $type type
-* @param string $channel channel
-* @param string $name name
-* @param string $state state
-* @param string $ver version
-* @param string $statename state name
-*
-* @return rows updated
-*/
-function addUpstream ($db, $type, $channel, $name, $state, $ver, $statename="")
-{
-
- $sql1 = "INSERT INTO `upstream` SET type='$type', name='$name'";
- $db->exec($sql1);
-
- $sql2 = "UPDATE `upstream` SET channel='$channel', $state='$ver'";
- if ($statename) {
- $sql2 .= ", state='$statename'";
- }
- $sql2 .= " WHERE type='$type' AND name='$name'";
- $nb = $db->exec($sql2);
- if ($nb===false) {
- echo date("r : ") . "SQL ERROR($sql2) = " .
- implode(" ", $db->errorInfo()) . "\n";
- }
-
- return $nb;
-}
-
if ($_SERVER['argc']>1 && in_array('help', $_SERVER['argv'])) {
echo "Options in: repo owner R pear pecl old\n";
echo "Defaults: repo owner R pear pecl\n";
@@ -197,23 +164,7 @@ try {
// -------------------------------------------------------------------
// Upstream Version
// -------------------------------------------------------------------
- $sql="CREATE TABLE IF NOT EXISTS `upstream` (
- `name` varchar(100) NOT NULL,
- `type` varchar(20) NOT NULL,
- `channel` varchar(20) NOT NULL,
- `stable` varchar(20) DEFAULT NULL,
- `unstable` varchar(20) DEFAULT NULL,
- `state` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`name`,`type`),
- KEY `name` (`name`),
- KEY `type` (`type`),
- KEY `channel` (`channel`))";
-
- if ($db->exec($sql)!==false) {
- echo date("r : ") . "Check table 'upstream' ok\n";
- } else {
- echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
- }
+ $uptable = new TableUpstream($db);
// -------------------------------------------------------------------
if ($_SERVER['argc']==1 || in_array('pecl', $_SERVER['argv'])) {
@@ -236,27 +187,23 @@ try {
echo date("r : ") .
"ERROR xmlrpc: $stable[faultString] ($stable[faultCode])";
} else {
- $sql = "DELETE FROM upstream WHERE type='pecl' AND channel='pecl'";
- $nb=$db->exec($sql);
- if ($nb===false) {
- echo date("r : ") . "SQL ERROR = " .
- implode(" ", $db->errorInfo()) . "\n";
- } else {
- echo date("r : ") . "Delete $nb packages\n";
- }
+ $nb = $uptable->delete(array('type'=>'pecl', 'channel'=>'pecl'));
+ echo date("r : ") . "Delete $nb packages\n";
$nb=0;
foreach ($stable as $name => $info) {
$rpmname="php-pecl-".str_replace("_", "-", $name);
- $nb += addUpstream(
- $db,
- "pecl",
- "pecl",
+ $id = $uptable->record(
+ 'pecl',
+ 'pecl',
$rpmname,
- "stable",
- $info["version"]
+ $info["version"],
+ true
);
+ if ($id) {
+ $nb++;
+ }
}
echo date("r : ") . "Write $nb packages\n";
}
@@ -285,20 +232,19 @@ try {
foreach ($unstable as $name => $info) {
$rpmname="php-pecl-".str_replace("_", "-", $name);
- $nb += addUpstream(
- $db,
- "pecl",
- "pecl",
+ $id = $uptable->record(
+ 'pecl',
+ 'pecl',
$rpmname,
- "unstable",
$info["version"],
+ true,
$info["state"]
);
+ if ($id) {
+ $nb++;
+ }
}
echo date("r : ") . "Write $nb packages\n";
- //echo date("r : ") . "saved " .
- // file_put_contents("cache/pecl-unstable", serialize($unstable)) .
- // " bytes\n";
}
} // if in options
@@ -327,17 +273,9 @@ try {
throw new Exception("can't read PEAR site (categories)");
}
- $sql = "DELETE FROM upstream WHERE type='pear' AND channel='".
- $channelname."'";
- $nb=$db->exec($sql);
- if ($nb===false) {
- echo date("r : ") . "SQL ERROR = " . implode(
- " ",
- $db->errorInfo()
- ) . "\n";
- } else {
- echo date("r : ") . "Delete $nb packages\n";
- }
+ $crit = array('type'=>'pear', 'channel'=>$channelname);
+ $nb = $uptable->delete($crit);
+ echo date("r : ") . "Delete $nb packages\n";
$nb=0;
if (!isset($categories->c[0])) {
@@ -367,43 +305,39 @@ try {
//echo $rpmname ."/".(string)$pi->r[0]->v."/".
// (string)$pi->r[0]->s."\n";
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname1,
- "unstable",
(string)$pi->r[0]->v,
+ false,
(string)$pi->r[0]->s
);
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname2,
- "unstable",
(string)$pi->r[0]->v,
+ false,
(string)$pi->r[0]->s
);
foreach ($pi->r as $rev) {
if ($rev->s=='stable') {
//echo $rpmname ."/".(string)$rev->v."/".
// (string)$rev->s."\n";
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname1,
- "stable",
- (string)$rev->v
+ (string)$rev->v,
+ true
);
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname2,
- "stable",
- (string)$rev->v
+ (string)$rev->v,
+ true
);
break;
}
@@ -450,40 +384,37 @@ try {
}
$rpmname2="php-".$channelname."-".$name;
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname1,
- "unstable",
(string)$ps->a->r[0]->v,
+ false,
(string)$ps->a->r[0]->s
);
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname2,
- "unstable",
(string)$ps->a->r[0]->v,
+ false,
(string)$ps->a->r[0]->s
);
foreach ($ps->a->r as $rev) {
if ($rev->s=='stable') {
- addUpstream(
- $db, "pear",
+ $uptable->record(
+ "pear",
$channelname,
$rpmname1,
- "stable",
- (string)$rev->v
+ (string)$rev->v,
+ true
);
- addUpstream(
- $db,
+ $uptable->record(
"pear",
$channelname,
$rpmname2,
- "stable",
- (string)$rev->v
+ (string)$rev->v,
+ true
);
break;
}
@@ -518,17 +449,9 @@ try {
continue;
}
if ($repo["state"]=="stable") {
- $sql = sprintf(
- "DELETE FROM upstream WHERE type='R' AND channel='%s'",
- $repo["name"]
- );
- $nb=$db->exec($sql);
- if ($nb===false) {
- echo date("r : ") . "SQL ERROR = " .
- implode(" ", $db->errorInfo()) . "\n";
- } else {
- echo date("r : ") . "Delete $nb packages\n";
- }
+ $crit = array('type'=>'R', 'channel'=>$repo['name']);
+ $nb = $uptable->delete($crit);
+ echo date("r : ") . "Delete $nb packages\n";
}
$results=array();
$pat = '/Package: *(.*)\nVersion: *(.*)\n/i';
@@ -538,13 +461,12 @@ try {
//echo $result[1]." = ".$result[2]."\n";
$rpmname = "R-".$result[1];
$ver = str_replace('-', '.', $result[2]);
- $add_upstream = addUpstream(
- $db,
+ $add_upstream = $uptable->record(
"R",
$repo["name"],
$rpmname,
- $repo["state"],
$ver,
+ $repo["state"]=='stable',
($repo["state"]=="stable"?"":"devel")
);
diff --git a/rpm.php b/rpm.php
index b223130..93f6308 100644
--- a/rpm.php
+++ b/rpm.php
@@ -62,170 +62,167 @@ function report($db, $type)
global $what, $smarty;
$packages = null;
$rpmrepo = new TableRpmRepo($db);
+ $uptable = new TableUpstream($db);
+
$repos = $rpmrepo->getAllRepoHash();
$smarty->assign('repos', $repos);
$i=0;
- $resup=$db->query("SELECT * FROM upstream WHERE type='$type' ORDER BY name");
- if ($resup) {
- while ($upstream = $resup->fetchObject()) {
- $package = null;
- $rpmname = $upstream->name;
+ foreach($uptable->request(array('type'=>$type, 'ORDER'=>'name')) as $up) {
+ $package = null;
+ $rpmname = $up['name'];
- $verup = strtolower(
- $upstream->stable ? $upstream->stable : $upstream->unstable
- );
+ $verup = strtolower($up['stable'] ? $up['stable'] : $up['unstable']);
- $sql2="SELECT DISTINCT owner FROM acls WHERE name = '$rpmname'";
- $res2=$db->query($sql2);
- $owners=array();
- if ( $res2 ) {
- while ($owner= $res2->fetchObject()) {
- $owners[] = $owner->owner;
- }
+ $sql2="SELECT DISTINCT owner FROM acls WHERE name = '$rpmname'";
+ $res2=$db->query($sql2);
+ $owners=array();
+ if ( $res2 ) {
+ while ($owner= $res2->fetchObject()) {
+ $owners[] = $owner->owner;
}
+ }
- $sql = "SELECT * FROM rpm WHERE name = '$rpmname'";
+ $sql = "SELECT * FROM rpm WHERE name = '$rpmname'";
- $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());
- }
+ $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());
+ }
- switch ($what) {
- case '%work':
- $display = false;
- if (count($rpms)
- && isset($rpms['devel-'])
- && $rpms['devel-']->ver != $verup
- ) {
- $display = true;
- }
- break;
- case '%fedora':
- $display = (count($rpms));
- break;
- case '%stable':
- $display = !empty($upstream->stable);
- break;
- case '%all':
+ switch ($what) {
+ case '%work':
+ $display = false;
+ if (count($rpms)
+ && isset($rpms['devel-'])
+ && $rpms['devel-']->ver != $verup
+ ) {
$display = true;
- break;
- default: // owner
- $display = (array_search($what, $owners) !== false);
- break;
}
+ break;
+ case '%fedora':
+ $display = (count($rpms));
+ break;
+ case '%stable':
+ $display = !empty($up['stable']);
+ break;
+ case '%all':
+ $display = true;
+ break;
+ default: // owner
+ $display = (array_search($what, $owners) !== false);
+ break;
+ }
- if ($display) {
- if ($rpm) {
- $package['name'] = '<a href="zoom.php?rpm=' . $rpmname .
- '" title="' . htmlentities($rpm->summary) . '">' .
- $rpmname . '</a>';
- } else {
- $package['name'] = $rpmname;
- }
- if ( $upstream->channel != $upstream->type ) {
- $package['channel'] = $upstream->channel;
- }
+ 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'];
+ }
- $dispowner="";
- $package['owners'] = $owners;
- if ( $upstream->stable ) {
- $package['upstream_stable'] = $upstream->stable;
- }
- if ( $upstream->unstable
- && (!$upstream->stable
- || $upstream->stable!=$upstream->unstable)
- ) {
- $package['upstream_unstable'] = $upstream->unstable .
- ' <small>(' . $upstream->state . ')</small>';
- }
+ $dispowner="";
+ $package['owners'] = $owners;
+ if ($up['stable']) {
+ $package['upstream_stable'] = $up['stable'];
+ }
+ if ($up['stable']
+ && (!$up['unstable']
+ || $up['stable']!=$up['unstable'])
+ ) {
+ $package['upstream_unstable'] = $up['unstable'] .
+ ' <small>(' . $up['state'] . ')</small>';
+ }
- $versions = null;
- foreach ( $repos as $repomain ) {
- $display="";
- $class="";
- foreach ( $repomain as $k=>$repo ) {
- if ( isset($rpms[$repo['main']."-".$repo['sub']]) ) {
- $rpm=$rpms[$repo['main']."-".$repo['sub']];
+ $versions = null;
+ foreach ( $repos as $repomain ) {
+ $display="";
+ $class="";
+ foreach ( $repomain as $k=>$repo ) {
+ if ( isset($rpms[$repo['main']."-".$repo['sub']]) ) {
+ $rpm=$rpms[$repo['main']."-".$repo['sub']];
- $verpm=$rpm->ver;
- $pat = "/\.((beta|RC)\d*)\./i";
- if (preg_match($pat, $rpm->rel, $res)) {
- $verpm .= strtolower($res[1]);
- }
+ $verpm=$rpm->ver;
+ $pat = "/\.((beta|RC)\d*)\./i";
+ if (preg_match($pat, $rpm->rel, $res)) {
+ $verpm .= strtolower($res[1]);
+ }
- switch ($repo['sub']) {
- case "base":
- if ( isset($rpms[$repo['main']."-updates"]) ) {
- $display .= sprintf(
- "%s-%s<br/>",
- $rpm->ver,
- $rpm->rel
- );
- } else {
- $display .= sprintf(
- "<strong>%s</strong>-%s<br/>",
- $rpm->ver,
- $rpm->rel
- );
- }
- if ( $verup==$verpm ) {
- $class="check";
- }
- break;
- case "":
+ switch ($repo['sub']) {
+ case "base":
+ if ( isset($rpms[$repo['main']."-updates"]) ) {
$display .= sprintf(
- "<strong>%s</strong>-%s<br/>",
+ "%s-%s<br/>",
$rpm->ver,
$rpm->rel
);
- if ( $verup==$verpm ) {
- $class="check";
- }
- break;
- case "updates":
+ } else {
$display .= sprintf(
- "<strong>%s</strong>-%s ".
- "<small>(updates)</small><br/>",
- $rpm->ver,
- $rpm->rel
- );
- if ( $verup==$verpm ) {
- $class="check";
- }
- break;
- case "testing":
- $display .= sprintf(
- "%s-%s <small>(testing)</small><br/>",
+ "<strong>%s</strong>-%s<br/>",
$rpm->ver,
$rpm->rel
);
- if ( $verup==$verpm ) {
- $class="info";
- }
- break;
}
- } // RPM exists
- } // sub repo
- if ( $display && empty($class) ) {
- $class="attn";
- }
- $versions[] = array(
- 'class' => $class,
- 'display' => $display
- );
- $package['versions'] = $versions;
- } // mainrepo
+ if ( $verup==$verpm ) {
+ $class="check";
+ }
+ break;
+ case "":
+ $display .= sprintf(
+ "<strong>%s</strong>-%s<br/>",
+ $rpm->ver,
+ $rpm->rel
+ );
+ if ( $verup==$verpm ) {
+ $class="check";
+ }
+ break;
+ case "updates":
+ $display .= sprintf(
+ "<strong>%s</strong>-%s ".
+ "<small>(updates)</small><br/>",
+ $rpm->ver,
+ $rpm->rel
+ );
+ if ( $verup==$verpm ) {
+ $class="check";
+ }
+ break;
+ case "testing":
+ $display .= sprintf(
+ "%s-%s <small>(testing)</small><br/>",
+ $rpm->ver,
+ $rpm->rel
+ );
+ if ( $verup==$verpm ) {
+ $class="info";
+ }
+ break;
+ }
+ } // RPM exists
+ } // sub repo
+ if ( $display && empty($class) ) {
+ $class="attn";
+ }
+ $versions[] = array(
+ 'class' => $class,
+ 'display' => $display
+ );
+ $package['versions'] = $versions;
+ } // mainrepo
- $i++;
- $packages[] = $package;
- }
- } // each $unstable
+ $i++;
+ $packages[] = $package;
+ }
}
return $packages;
}
diff --git a/smarty/templates/rpmphp/rpm.tpl b/smarty/templates/rpmphp/rpm.tpl
index 9f9d94f..b0d942f 100644
--- a/smarty/templates/rpmphp/rpm.tpl
+++ b/smarty/templates/rpmphp/rpm.tpl
@@ -66,7 +66,7 @@
{foreach from=$packages item=p name=plist}
<tr class="{if $smarty.foreach.plist.iteration % 2 eq 0}even{else}odd{/if}">
<td>
- {$p.name}
+ <a href="zoom.php?rpm={$p.name}" title="{$p.name}">{$p.name}</a>
{if $p.channel}
<br/><small>channel: {$p.channel}</small>
{/if}
diff --git a/testdb.php b/testdb.php
index 85c78e3..3523fff 100644
--- a/testdb.php
+++ b/testdb.php
@@ -66,4 +66,26 @@ if ($row = $rpm->get(888)) {
} else {
echo "not found\n";
}
+$up = new TableUpstream($db);
+$up->delete(array('name'=>'foo','type'=>'test'));
+$rec = $up->record('test','bar','foo','1.0',true);
+echo "record(foo-1.0) : $rec\n";
+echo "find(foo,test):";
+if ($row = $up->find(array('name'=>'foo','type'=>'test'))) {
+ print_r($row);
+} else {
+ echo "not found\n";
+}
+$up->record('test','bar','foo','1.2',false,'beta');
+echo "record(foo-1.2) : $rec\n";
+echo "find(foo,test):";
+if ($row = $up->find(array('name'=>'foo','type'=>'test'))) {
+ print_r($row);
+} else {
+ echo "not found\n";
+}
+echo "request(test) : ";
+foreach($up->request(array('type'=>'test', 'ORDER'=>'name')) as $upstr) {
+ print_r($upstr);
+}
?>
diff --git a/zoom.php b/zoom.php
index c36c2c5..56e8e8c 100644
--- a/zoom.php
+++ b/zoom.php
@@ -93,6 +93,8 @@ if ( !isset($name) || !$name ) {
try {
$db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
+ $uptable = new TableUpstream($db);
+
$sql = "SELECT rpm.*,
CONCAT(repo.url,rpm.name,'-',rpm.ver,'-',rpm.rel,'.src.rpm') as rpmurl
FROM rpm
@@ -102,9 +104,7 @@ if ( !isset($name) || !$name ) {
$resrpm = $db->query($sql);
$rpm = ($resrpm ? $resrpm->fetchObject() : false);
- $sql = "SELECT * FROM upstream WHERE name = '$name'";
- $resup=$db->query($sql);
- $up = ($resup ? $resup->fetchObject() : false);
+ $up = $uptable->find(array('name'=>$name));
$sql = "SELECT * FROM acls WHERE name = '$name'";
$resown=$db->query($sql);
@@ -133,28 +133,25 @@ if ( !isset($name) || !$name ) {
if ( $rpm->url ) {
$summary['URL'] = $rpm->url;
}
- if ($up && $up->type) {
- $summary['Type'] = $up->type;
+ if ($up && $up['type']) {
+ $summary['Type'] = $up['type'];
}
- if ($up && $up->channel) {
- $summary['Channel'] = $up->channel;
+ if ($up && $up['channel']) {
+ $summary['Channel'] = $up['channel'];
}
- if ($up && $up->stable) {
- $summary['Stabe version'] = $up->stable;
+ if ($up && $up['stable']) {
+ $summary['Stabe version'] = $up['stable'];
}
- if ($up && $up->unstable && $up->stable!=$up->unstable) {
- if ($up->state) {
- $summary['Unstable version'] = $up->unstable . ' (' .
- $up->state . ')';
- } else {
- $summary['Unstable version'] = $up->unstable;
+ if ($up && $up['stable'] && $up['stable']!=$up['unstable']) {
+ $summary['Unstable version'] = $up['unstable'];
+ if ($up['state']) {
+ $summary['Unstable version'] .= ' (' . $up['state'] . ')';
}
}
if ($owner && $owner->owner) {
+ $summary['Owner'] = $owner->owner;
if ($owner->cc) {
- $summary['Owner'] = $owner->owner . ' (' . $owner->cc . ')';
- } else {
- $summary['Owner'] = $owner->owner;
+ $summary['Owner'] .= ' (' . $owner->cc . ')';
}
// Only when owner (so we have the exact name)