From 6329ab488b4718005fec84c46cab340f6f750fba Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Fri, 13 Apr 2012 10:11:08 -0400
Subject: [PATCH] Add pending upgrade check and auto offline when upgrade is
 pending

---
 include/class.config.php | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index c51814beb..e54c0d739 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -67,22 +67,35 @@ class Config {
         return !$this->isSystemOnline();
     }
 
+    function isHelpDeskOnline() {
+        return $this->isSystemOnline();
+    }
+
     function isSystemOnline() {
-        return ($this->config['isonline']);
+        return ($this->config['isonline'] && !$this->isUpgradePending());
     }
 
-    function isKnowledgebaseEnabled() {
+    function isUpgradePending() {
+        return (defined('SCHEMA_SIGNATURE') && strcasecmp($this->getSchemaSignature(), SCHEMA_SIGNATURE));
+    }
 
+    function isKnowledgebaseEnabled() {
         require_once(INCLUDE_DIR.'class.faq.php');
         return ($this->config['enable_kb'] && FAQ::countPublishedFAQs());
     }
 
     function getVersion() {
-        return '1.7-DPR2';
+        return THIS_VERSION;
     }
 
     function getSchemaSignature() {
-        return $this->config['schema_signature'];
+
+        if($this->config['schema_signature'])
+            return $this->config['schema_signature'];
+        elseif($this->config['ostversion']) //old version 1.6 st.
+            return md5($this->config['ostversion']);
+
+        return null;
     }
 
     function setMysqlTZ($tz) {
-- 
GitLab