Revision: 2960
          https://sourceforge.net/p/mrbs/code/2960/
Author:   cimorrison
Date:     2015-01-18 16:41:06 +0000 (Sun, 18 Jan 2015)
Log Message:
-----------
Added better error handling for the case when the MRBS tables have not been 
installed or cannot be accessed (possibly because of permission problems).

Modified Paths:
--------------
    mrbs/trunk/web/dbsys.inc
    mrbs/trunk/web/lang/lang.en

Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc    2015-01-18 16:34:16 UTC (rev 2959)
+++ mrbs/trunk/web/dbsys.inc    2015-01-18 16:41:06 UTC (rev 2960)
@@ -799,6 +799,13 @@
 $f = "sql_${dbsys}_default_connect";
 $f();
 
+// Sanity check:  check that we can access the MRBS tables.  If we can't, it's
+// either because they don't exist or we don't have permission.
+if (!sql_table_exists($tbl_entry))
+{
+  fatal_error(FALSE, get_vocab('fatal_no_tables'), FALSE);
+}
+
 // Default version is 0, before we had schema versions
 $current_db_schema_version = 0;
 $current_local_db_schema_version = 0;
@@ -819,11 +826,8 @@
 
 // If either of the database schema version numbers are out of date, then 
 // upgrade the database - provided of course that the entry table exists.
-// (We check that the entry table exists just in case this is a new 
installation
-// and they've forgotten to create the database tables)
-if ((($current_db_schema_version < $db_schema_version) || 
-     ($current_local_db_schema_version < $local_db_schema_version)) &&
-    sql_table_exists($tbl_entry))
+if (($current_db_schema_version < $db_schema_version) || 
+    ($current_local_db_schema_version < $local_db_schema_version))
 {
   // Upgrade needed
 

Modified: mrbs/trunk/web/lang/lang.en
===================================================================
--- mrbs/trunk/web/lang/lang.en 2015-01-18 16:34:16 UTC (rev 2959)
+++ mrbs/trunk/web/lang/lang.en 2015-01-18 16:41:06 UTC (rev 2960)
@@ -517,5 +517,6 @@
  
 // General
 $vocab["fatal_db_error"]     = "Fatal error: unfortunately the database is not 
available at the moment.";
+$vocab["fatal_no_tables"]    = "Fatal error: the MRBS tables do not exist or 
cannot be accessed.";
 $vocab["back"]               = "Back";
 
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to