config/deployments: collect uncollected stages...

...if any when refreshing the history

refs #11979
This commit is contained in:
Thomas Gelf 2016-09-09 07:21:32 +00:00
parent 4d34a8ade1
commit 29231ef8c8
2 changed files with 15 additions and 1 deletions

View File

@ -19,7 +19,9 @@ class ConfigController extends ActionController
{ {
$this->setAutorefreshInterval(5); $this->setAutorefreshInterval(5);
try { try {
if ($this->getRequest()->getUrl()->shift('checkforchanges')) { if ($this->db()->hasUncollectedDeployments()
|| $this->getRequest()->getUrl()->shift('checkforchanges')
) {
$this->api()->collectLogFiles($this->db()); $this->api()->collectLogFiles($this->db());
} }
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -689,4 +689,16 @@ class Db extends DbConnection
return DirectorDeploymentLog::loadAll($this, $query, 'stage_name'); return DirectorDeploymentLog::loadAll($this, $query, 'stage_name');
} }
public function hasUncollectedDeployments()
{
$db = $this->db();
$query = $db->select()
->from('director_deployment_log', array('cnt' => 'COUNT(*)'))
->where('stage_name IS NOT NULL')
->where('stage_collected IS NULL')
->where('startup_succeeded IS NULL');
return $db->fetchOne($query) > 0;
}
} }