BugFix [master] system information git (#2499)
fix for if the .git folder is present but corrupt
This commit is contained in:
@@ -132,6 +132,17 @@ $text['label-git_info']['uk'] = "Гіт інформація";
|
|||||||
$text['label-git_info']['de-at'] = "Git Informationen";
|
$text['label-git_info']['de-at'] = "Git Informationen";
|
||||||
$text['label-git_info']['it-it'] = "Informazioni Git";
|
$text['label-git_info']['it-it'] = "Informazioni Git";
|
||||||
|
|
||||||
|
$text['label-git_corrupted']['en-us'] = "Git data is corrupt";
|
||||||
|
$text['label-git_corrupted']['es-cl'] = "Git datos es corrupto";
|
||||||
|
$text['label-git_corrupted']['pt-pt'] = "Dados Git é corrupto";
|
||||||
|
$text['label-git_corrupted']['fr-fr'] = "Données Git est corrompu";
|
||||||
|
$text['label-git_corrupted']['pt-br'] = "Dados Git é corrupto";
|
||||||
|
$text['label-git_corrupted']['pl'] = "Git danych jest uszkodzony";
|
||||||
|
$text['label-git_corrupted']['sv-se'] = "Git uppgifter är korrupt";
|
||||||
|
$text['label-git_corrupted']['uk'] = "Гіт дані пошкоджені";
|
||||||
|
$text['label-git_corrupted']['de-at'] = "Git Daten ist beschädigt" ;
|
||||||
|
$text['label-git_corrupted']['it-it'] = "Dati Git è corrotto";
|
||||||
|
|
||||||
$text['label-switch']['en-us'] = "Switch";
|
$text['label-switch']['en-us'] = "Switch";
|
||||||
$text['label-switch']['es-cl'] = "Cambiar";
|
$text['label-switch']['es-cl'] = "Cambiar";
|
||||||
$text['label-switch']['pt-pt'] = "Interruptor";
|
$text['label-switch']['pt-pt'] = "Interruptor";
|
||||||
|
|||||||
+36
-25
@@ -89,31 +89,42 @@ $document['title'] = $text['title-sys-status'];
|
|||||||
if(file_exists($git_path)){
|
if(file_exists($git_path)){
|
||||||
$git_exe = 'git';
|
$git_exe = 'git';
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { $git_exe = shell_exec('which git'); }
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { $git_exe = shell_exec('which git'); }
|
||||||
shell_exec($git_exe.' --git-dir='.$git_path.' fetch');
|
exec($git_exe.' --git-dir='.$git_path.' fetch', $dummy, $returnCode);
|
||||||
$git_branch = shell_exec($git_exe.' --git-dir='.$git_path.' name-rev --name-only HEAD');
|
if($returnCode){
|
||||||
rtrim($git_branch);
|
echo "<tr>\n";
|
||||||
$git_commit = shell_exec($git_exe.' --git-dir='.$git_path.' rev-parse HEAD');
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||||
rtrim($git_commit);
|
echo " ".$text['label-git_info']."\n";
|
||||||
$git_origin = shell_exec($git_exe.' --git-dir='.$git_path.' config --get remote.origin.url');
|
echo " </td>\n";
|
||||||
rtrim($git_origin);
|
echo " <td class=\"row_style1\">\n";
|
||||||
$git_origin = preg_replace('/\.git$/','',$git_origin);
|
echo " ".$text['label-git_corrupted']."\n";
|
||||||
$git_status = shell_exec($git_exe.' --git-dir='.$git_path.' status | grep "Your branch"');
|
echo " </td>\n";
|
||||||
rtrim($git_status);
|
echo "</tr>\n";
|
||||||
$git_age = shell_exec($git_exe.' --git-dir='.$git_path.' log --pretty=format:%at HEAD^!');
|
}else{
|
||||||
rtrim($git_age);
|
$git_branch = shell_exec($git_exe.' --git-dir='.$git_path.' name-rev --name-only HEAD');
|
||||||
$git_date = DateTime::createFromFormat('U', $git_age);
|
rtrim($git_branch);
|
||||||
$git_age = $git_date->diff(new DateTime('now'));
|
$git_commit = shell_exec($git_exe.' --git-dir='.$git_path.' rev-parse HEAD');
|
||||||
echo "<tr>\n";
|
rtrim($git_commit);
|
||||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
$git_origin = shell_exec($git_exe.' --git-dir='.$git_path.' config --get remote.origin.url');
|
||||||
echo " ".$text['label-git_info']."\n";
|
rtrim($git_origin);
|
||||||
echo " </td>\n";
|
$git_origin = preg_replace('/\.git$/','',$git_origin);
|
||||||
echo " <td class=\"row_style1\">\n";
|
$git_status = shell_exec($git_exe.' --git-dir='.$git_path.' status | grep "Your branch"');
|
||||||
echo " ".$text['label-git_branch'].": ".$git_branch."<br>\n";
|
rtrim($git_status);
|
||||||
echo " ".$text['label-git_commit'].": <a href='$git_origin/commit/$git_commit'>".$git_commit."</a><br>\n";
|
$git_age = shell_exec($git_exe.' --git-dir='.$git_path.' log --pretty=format:%at HEAD^!');
|
||||||
echo " ".$text['label-git_origin'].": ".$git_origin."<br>\n";
|
rtrim($git_age);
|
||||||
echo " ".$text['label-git_status'].": ".$git_status.$git_age->format(' %R%a days ago')."<br>\n";
|
$git_date = DateTime::createFromFormat('U', $git_age);
|
||||||
echo " </td>\n";
|
$git_age = $git_date->diff(new DateTime('now'));
|
||||||
echo "</tr>\n";
|
echo "<tr>\n";
|
||||||
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||||
|
echo " ".$text['label-git_info']."\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " <td class=\"row_style1\">\n";
|
||||||
|
echo " ".$text['label-git_branch'].": ".$git_branch."<br>\n";
|
||||||
|
echo " ".$text['label-git_commit'].": <a href='$git_origin/commit/$git_commit'>".$git_commit."</a><br>\n";
|
||||||
|
echo " ".$text['label-git_origin'].": ".$git_origin."<br>\n";
|
||||||
|
echo " ".$text['label-git_status'].": ".$git_status.$git_age->format(' %R%a days ago')."<br>\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user