From 7f3b24be03d597147b1a87d7413e3c2cb5ad7d6b Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 26 Sep 2010 14:05:14 -0400
Subject: [PATCH] - Fixed a problem with dbversionioning.

---
 install/lib/update.lib.php |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index 69de044..8faff1a 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -151,6 +151,21 @@
 		} else {
 			system("mysql --default-character-set=".$conf['mysql']['charset']." --force -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' ".$conf['mysql']['database']." < existing_db.sql");
 		}
+		
+		//** Get the database version number based on the patchfile
+		$found = true;
+		while($found == true) {
+			$next_db_version = intval($current_db_version + 1);
+			$patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
+			if(is_file($patch_filename)) {
+				$current_db_version = $next_db_version;
+			} else {
+				$found = false;
+			}
+		}
+		
+		//* update the database version in server table
+		$inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 
 		if ($conf['powerdns']['installed']) {
                                                  

--
Gitblit v1.9.1