From 3250e5e37c27acf09d03c89270b5b8e98b7072fa Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 13 Jul 2010 07:43:53 -0400
Subject: [PATCH] Implemented: FS#1219 - Add support for incremental updates of the ispconfig database structure
---
install/lib/install.lib.php | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 3c2adc1..a4e3880 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -640,6 +640,43 @@
}
}
+/*
+ * Compare ISPConfig version number.
+ * return values:
+ * -1 $current version is newer then $new version (downgrade)
+ * 0 $current version = $new version
+ * 1 $current version is older then new version (update)
+
+*/
+function compare_ispconfig_version($current,$new) {
+ if( $current == $new) {
+ return 0;
+ }
+
+ $p = explode('.',$current);
+ $tmp = '';
+ $tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
+ $tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
+ $tmp .= (isset($p[2]))?str_pad(intval($p[2]), 3, '0', STR_PAD_LEFT):'000';
+ $tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
+ $current = $tmp;
+
+ $p = explode('.',$new);
+ $tmp = '';
+ $tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
+ $tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
+ $tmp .= (isset($p[2]))?str_pad(intval($p[2]), 3, '0', STR_PAD_LEFT):'000';
+ $tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
+ $new = $tmp;
+
+ if($new > $current) {
+ return 1;
+ } else {
+ return -1;
+ }
+
+}
+
?>
--
Gitblit v1.9.1