Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

store time of execution for all commands

  • Loading branch information...
commit 12f1ffb7024519a80279cb83c5fa6f82f3f3f1f0 1 parent 254229c
@juzna authored
Showing with 9 additions and 4 deletions.
  1. +7 −4 app/models/Generator.php
  2. +2 −0  db-dump.sql
View
11 app/models/Generator.php
@@ -104,6 +104,7 @@ private function git($cmd) {
* @return bool Finished sucessfully?
*/
private function exec($cmd, &$result = null) {
+ $timeStarted = microtime(true);
echo "$cmd\n";
exec($cmd, $output, $retval);
@@ -114,10 +115,12 @@ private function exec($cmd, &$result = null) {
// Store results
$result = $this->db->table('result')->insert(array(
- 'repo_id' => $this->itemId,
- 'cmd' => $cmd,
- 'ok' => $retval == 0,
- 'output' => $data, // remove local paths from output,
+ 'repo_id' => $this->itemId,
+ 'cmd' => $cmd,
+ 'ok' => $retval == 0,
+ 'output' => $data, // remove local paths from output,
+ 'executedAt' => new \Nette\Database\SqlLiteral('NOW()'),
+ 'duration' => microtime(true) - $timeStarted,
));
return $retval == 0;
View
2  db-dump.sql
@@ -34,6 +34,8 @@ CREATE TABLE `result` (
`cmd` varchar(255) NOT NULL,
`ok` tinyint(1) NOT NULL,
`output` text NOT NULL,
+ `executedAt` datetime default NULL,
+ `duration` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Please sign in to comment.
Something went wrong with that request. Please try again.