mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 16:26:55 +02:00
fix new version of svn (#40 from Mike Stupalov)
git-svn-id: http://www.observium.org/svn/observer/trunk@3095 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -55,6 +55,7 @@ $config['dot'] = "/usr/bin/dot";
|
|||||||
$config['unflatten'] = "/usr/bin/unflatten";
|
$config['unflatten'] = "/usr/bin/unflatten";
|
||||||
$config['neato'] = "/usr/bin/neato";
|
$config['neato'] = "/usr/bin/neato";
|
||||||
$config['sfdp'] = "/usr/bin/sfdp";
|
$config['sfdp'] = "/usr/bin/sfdp";
|
||||||
|
$config['svn'] = "/usr/bin/svn";
|
||||||
|
|
||||||
### Memcached - Keep immediate statistics
|
### Memcached - Keep immediate statistics
|
||||||
|
|
||||||
|
|||||||
@@ -1096,11 +1096,20 @@ if (isset($config['enable_printers']) && $config['enable_printers'])
|
|||||||
|
|
||||||
$config['version'] = "0.11.5.2245";
|
$config['version'] = "0.11.5.2245";
|
||||||
|
|
||||||
if (file_exists('.svn/entries'))
|
if (file_exists($config['install_dir'] . '/.svn/entries'))
|
||||||
{
|
{
|
||||||
$svn = File('.svn/entries');
|
$svn = File($config['install_dir'] . '/.svn/entries');
|
||||||
$svn_rev = trim($svn[3]);
|
if ((int)$svn[0] < 12)
|
||||||
list($svn_date) = explode("T", trim($svn[9]));
|
{
|
||||||
|
// SVN version < 1.7
|
||||||
|
$svn_rev = trim($svn[3]);
|
||||||
|
list($svn_date) = explode("T", trim($svn[9]));
|
||||||
|
} else {
|
||||||
|
// SVN version >= 1.7
|
||||||
|
$xml = simplexml_load_string(shell_exec($config['svn'] . ' info --xml'));
|
||||||
|
$svn_rev = $xml->entry->commit->attributes()->revision;
|
||||||
|
$svn_date = $xml->entry->commit->date;
|
||||||
|
}
|
||||||
list($svn_year, $svn_month, $svn_day) = explode("-", $svn_date);
|
list($svn_year, $svn_month, $svn_day) = explode("-", $svn_date);
|
||||||
$config['version'] = "0." . ($svn_year-2000) . "." . ($svn_month+0) . "." . $svn_rev;
|
$config['version'] = "0." . ($svn_year-2000) . "." . ($svn_month+0) . "." . $svn_rev;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user