mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
only run database schema update when running svn and actually have something to update
git-svn-id: http://www.observium.org/svn/observer/trunk@699 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+21
-2
@@ -38,8 +38,27 @@ if(!$where) {
|
||||
exit;
|
||||
}
|
||||
|
||||
echo("Applying database updates...\n");
|
||||
shell_exec("scripts/update-sql.php database-update.sql");
|
||||
if (file_exists('.svn'))
|
||||
{
|
||||
list(,$dbu_rev) = split(': ',@shell_exec('svn info database-update.sql|grep ^Revision'));
|
||||
|
||||
$device_query = mysql_query("SELECT revision FROM `dbSchema`");
|
||||
if ($rev = @mysql_fetch_array($device_query))
|
||||
{
|
||||
$db_rev = $rev['revision'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$db_rev = 0;
|
||||
}
|
||||
|
||||
if ($dbu_rev+0 > $db_rev)
|
||||
{
|
||||
echo("Applying database updates to from r$db_rev to r" . trim($dbu_rev) . "...\n");
|
||||
shell_exec("scripts/update-sql.php database-update.sql");
|
||||
mysql_query("INSERT INTO dbSchema VALUES ($dbu_rev) ON DUPLICATE KEY UPDATE revision=$dbu_rev");
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user