Created
April 17, 2012 18:54
-
-
Save deyvin/2408240 to your computer and use it in GitHub Desktop.
Brincando com shell_exec do php com git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function limpa_array($array) { | |
foreach($array as $arr) | |
if($arr != '') | |
$retorno[] = $arr; | |
return $retorno; | |
} | |
echo "<h1>Colaboradores</h1>"; | |
echo "<pre>"; | |
echo shell_exec('git log --format=\'%an\' |sort -u'); | |
echo "</pre>"; | |
$shell = shell_exec('git log --date=relative --pretty=format:"quebralinha%ad||%s||%an||" --stat'); | |
$array = explode("quebralinha", $shell); | |
foreach($array as $arr) { | |
if($arr != '') { | |
$dados = explode("||", $arr); | |
$files_arr = explode("|", str_replace("\n", "|", $dados[3])); | |
$files_arr = limpa_array($files_arr); | |
$retorno[] = array('funcionario' => $dados[2], 'descricao' => utf8_decode($dados[1]), 'data' => $dados[0], 'str_files' => $files_arr); | |
} | |
} | |
echo count($retorno) . " Commits"; | |
echo "<h1>Ultimas Alteracoes</h1>"; | |
echo "<pre>"; | |
print_r($retorno); | |
echo "</pre>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment