Skip to content

Commit

Permalink
Homepage|Build Repository: Determine the number of installables
Browse files Browse the repository at this point in the history
A build may not yield an installable package so now we must count
the number of non zero-length download URIs...
  • Loading branch information
danij-deng committed Feb 15, 2012
1 parent 428d3e4 commit 632cb67
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion web/plugins/buildrepository/buildrepository.php
Expand Up @@ -987,6 +987,23 @@ private function outputPackageRedirect(&$pack)
$FrontController->endPage();
}

private function countInstallablePackages(&$build)
{
$count = 0;
if($build instanceof BuildEvent)
{
foreach($build->packages as &$pack)
{
$downloadUri = $pack->downloadUri();
if($downloadUri && strlen($downloadUri) > 0)
{
$count++;
}
}
}
return $count;
}

private function genBuildOverview(&$build)
{
$html = '';
Expand All @@ -1000,7 +1017,7 @@ private function genBuildOverview(&$build)
$html .= '<h2><a class="link-definition" href="'.$releaseTypeLink.'" title="'.$releaseTypeLinkTitle.'">'. htmlspecialchars(ucfirst($releaseTypeLabel)). '</a></h2>'
.'<p>The build event was started on '. date(DATE_RFC2822, $build->startDate()) .'. '
.'It contains '. count($build->commits) .' commits and produced '
. count($build->packages) .' installable binary packages.</p>';
. $this->countInstallablePackages($build) .' installable binary packages.</p>';
}
return $html;
}
Expand Down

0 comments on commit 632cb67

Please sign in to comment.