Rev 83 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 83 | Rev 84 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | */ |
19 | */ |
20 | 20 | ||
21 | function get_svn_revision($dir='') { |
21 | function get_svn_revision($dir='') { |
22 | if (!empty($dir)) $dir .= '/'; |
22 | if (!empty($dir)) $dir .= '/'; |
23 | if (!is_dir($dir)) return false; |
23 | if (!is_dir($dir)) return false; |
- | 24 | if (is_dir($dir.'/.svn')) $dir .= '/.svn/'; |
|
24 | 25 | ||
25 | // Try to find out the SVN version using the shell |
26 | // Try to find out the SVN version using the shell |
26 | $output = @shell_exec('svnversion '.escapeshellarg($dir).' 2>&1'); |
27 | $output = @shell_exec('svnversion '.escapeshellarg($dir).' 2>&1'); |
27 | $match = array(); |
28 | $match = array(); |
28 | if (preg_match('/\d+/', $output, $match)) { |
29 | if (preg_match('/\d+/', $output, $match)) { |
Line 64... | Line 65... | ||
64 | // Try parsing the binary file. It is a bit risky though... |
65 | // Try parsing the binary file. It is a bit risky though... |
65 | return get_svn_revision_without_sqlite3($dir); |
66 | return get_svn_revision_without_sqlite3($dir); |
66 | } |
67 | } |
67 | 68 | ||
68 | function get_svn_revision_without_sqlite3($svn_path, $base='trunk') { |
69 | function get_svn_revision_without_sqlite3($svn_path, $base='trunk') { |
- | 70 | if (!empty($svn_path)) $svn_path .= '/'; |
|
- | 71 | if (!is_dir($svn_path)) return false; |
|
- | 72 | if (!is_dir($svn_path.'/.svn')) $svn_path .= '/../'; |
|
- | 73 | ||
69 | $fil = file_get_contents($svn_path.'/.svn/wc.db'); |
74 | $fil = file_get_contents($svn_path.'/.svn/wc.db'); |
70 | preg_match_all('@('.preg_quote($base,'@').'/[a-z0-9!"#$%&\'()*+,.\/:;<=>?\@\[\] ^_`{|}~-]+)(..)normal(file|dir)@', $fil, $m, PREG_SET_ORDER); |
75 | preg_match_all('@('.preg_quote($base,'@').'/[a-z0-9!"#$%&\'()*+,.\/:;<=>?\@\[\] ^_`{|}~-]+)(..)normal(file|dir)@', $fil, $m, PREG_SET_ORDER); |
71 | 76 | ||
72 | $files = array(); |
77 | $files = array(); |
73 | foreach ($m as list($dummy, $fil, $revision)) { |
78 | foreach ($m as list($dummy, $fil, $revision)) { |