From 7a23bb0333cc993290c6cfd525bb35b423e5bb7c Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 13 Jan 2016 07:13:59 +0000
Subject: [PATCH] upgrade: Support old config storage

Catch InconsistentModelException on config load to allow for fallback to old
config table when upgrade is pending.
---
 include/class.config.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/class.config.php b/include/class.config.php
index 8b7dde5d8..61b5012df 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -150,8 +150,19 @@ extends VerySimpleModel {
     );
 
     static function items($namespace, $column='namespace') {
-        return static::objects()
+
+        $items = static::objects()
             ->filter([$column => $namespace]);
+
+        try {
+            count($items);
+        }
+        catch (InconsistentModelException $ex) {
+            // Pending upgrade ??
+            $items = array();
+        }
+
+        return $items;
     }
 
     function save($refetch=false) {
-- 
GitLab