Hopefully re-greening the build.

This commit is contained in:
Dan Cryer 2014-12-22 15:48:35 +00:00
commit ead24da1a5
4 changed files with 34 additions and 26 deletions

View file

@ -123,11 +123,13 @@ class BuildStore extends BuildStoreBase
$select = '`bm`.`build_id`, `bm`.`meta_key`, `bm`.`meta_value`';
$and = $numResults > 1 ? ' AND (`bm`.`build_id` <= :buildId) ' : ' AND (`bm`.`build_id` = :buildId) ';
$where = '`bm`.`meta_key` = :key AND `bm`.`project_id` = :projectId ' . $and;
$from = ' `build_meta` AS `bm`';
if($branch !== null) {
$from = ' `build_meta` AS `bm`';
if ($branch !== null) {
$where .= ' AND `b`.`branch` = :branch AND `b`.`id`= `bm`.`build_id` ';
$from .= ', `build` AS `b`';
}
}
$query = 'SELECT '.$select.' FROM '.$from.' WHERE '.$where.' ORDER BY `bm`.id DESC LIMIT :numResults';
$stmt = Database::getConnection('read')->prepare($query);