diff options
author | Manuel Hiebel <leuhmanu@mageia.org> | 2014-08-02 21:45:01 +0200 |
---|---|---|
committer | Manuel Hiebel <leuhmanu@mageia.org> | 2014-08-02 21:45:01 +0200 |
commit | a84f00afb1cde42f5cb9ba4088f1a9051f774481 (patch) | |
tree | 1cb8b02746f79af2785d97b8b462ca03a3b228d8 /rev.php | |
parent | 32ef8d3e78b998425f54233d87be8a56b2578925 (diff) | |
download | www-a84f00afb1cde42f5cb9ba4088f1a9051f774481.tar www-a84f00afb1cde42f5cb9ba4088f1a9051f774481.tar.gz www-a84f00afb1cde42f5cb9ba4088f1a9051f774481.tar.bz2 www-a84f00afb1cde42f5cb9ba4088f1a9051f774481.tar.xz www-a84f00afb1cde42f5cb9ba4088f1a9051f774481.zip |
switch to git
Diffstat (limited to 'rev.php')
-rw-r--r-- | rev.php | 27 |
1 files changed, 4 insertions, 23 deletions
@@ -15,7 +15,7 @@ $app_root = __DIR__; $vars = array( 'app' => $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'], - 'svn' => get_svn_info($app_root), + 'git' => get_git_info($app_root), 'status' => get_status($app_root), ); @@ -43,30 +43,11 @@ function get_status($app_root) * * @return array */ -function get_svn_info($app_root) +function get_git_info($app_root) { - exec(escapeshellcmd(sprintf('LC_ALL=C %s info %s', exec('which svn'), escapeshellarg($app_root))), + exec(escapeshellcmd(sprintf('LC_ALL=C %s show %s %s', exec('which git'), '-s --pretty="Revision: %H%nLast Author: %an%nDate Revision: %ar%nTitle: %s"', escapeshellarg($app_root))), $out, $ret); - $vars = array(); - $keys = array( - 'URL', - 'Revision', - 'Last Changed Author', - 'Last Changed Rev', - 'Last Changed Date' - ); - foreach ($out as $l) { - $l = explode(':', trim($l)); - $k = trim(array_shift($l)); - if (in_array($k, $keys)) - $vars[strtolower(str_replace(' ', '_', $k))] = trim(implode(':', $l)); - } - // remove scheme & user; keep it? - $u = $vars['url']; - $u = parse_url($u); - $vars['url'] = sprintf('%s%s', $u['host'], $u['path']); - - return $vars; + return $out; } |