Fixed ticket 208, added more logging in GitServe and Scm backend.

This commit is contained in:
Loic d'Anterroches
2010-02-17 21:57:28 +01:00
parent 8da6fe7287
commit 3a28fe9d28
5 changed files with 118 additions and 66 deletions

View File

@@ -87,6 +87,42 @@ class IDF_Scm
return call_user_func(array($scms[$scm], 'factory'), $project);
}
/**
* Run exec and log some information.
*
* @param $caller Calling method
* @param $cmd Command to run
* @param &$out Array of output
* @param &$return Return value
* @return string Last line of the command
*/
public static function exec($caller, $cmd, &$out=null, &$return=null)
{
Pluf_Log::stime('timer');
$ret = exec($cmd, $out, $return);
Pluf_Log::perf(array($caller, $cmd, Pluf_Log::etime('timer', 'total_exec')));
Pluf_Log::debug(array($caller, $cmd, $out));
Pluf_Log::inc('exec_calls');
return $ret;
}
/**
* Run shell_exec and log some information.
*
* @param $caller Calling method
* @param $cmd Command to run
* @return string The output
*/
public static function shell_exec($caller, $cmd)
{
Pluf_Log::stime('timer');
$ret = shell_exec($cmd);
Pluf_Log::perf(array($caller, $cmd, Pluf_Log::etime('timer', 'total_exec')));
Pluf_Log::debug(array($caller, $cmd, $ret));
Pluf_Log::inc('exec_calls');
return $ret;
}
/**
* Return the size of the repository in bytes.
*