Revision: 1151
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1151&view=rev
Author:   cimorrison
Date:     2009-07-14 08:58:22 +0000 (Tue, 14 Jul 2009)

Log Message:
-----------
Fixed problem that meant that the correct database connection wasn't being used 
when upgrading the database (ie MRBS was using the ordinary username/password 
specified in the config file rather than the admin username/password entered 
during the upgrade process).

Modified Paths:
--------------
    mrbs/trunk/web/dbsys.inc
    mrbs/trunk/web/upgrade.inc

Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc    2009-07-08 12:04:50 UTC (rev 1150)
+++ mrbs/trunk/web/dbsys.inc    2009-07-14 08:58:22 UTC (rev 1151)
@@ -667,12 +667,12 @@
   // Do any MRBS upgrades first
   if ($current_db_schema_version < $db_schema_version)
   {
-    $ok = upgrade_database(FALSE, $current_db_schema_version, 
$db_schema_version);
+    $ok = upgrade_database(FALSE, $current_db_schema_version, 
$db_schema_version, $admin_handle);
   }
   // Then any local upgrades
   if ($ok && $current_local_db_schema_version < $local_db_schema_version)
   {
-    $ok = upgrade_database(TRUE, $current_local_db_schema_version, 
$local_db_schema_version);
+    $ok = upgrade_database(TRUE, $current_local_db_schema_version, 
$local_db_schema_version, $admin_handle);
   }
   
   // close the database connection that has admin rights

Modified: mrbs/trunk/web/upgrade.inc
===================================================================
--- mrbs/trunk/web/upgrade.inc  2009-07-08 12:04:50 UTC (rev 1150)
+++ mrbs/trunk/web/upgrade.inc  2009-07-14 08:58:22 UTC (rev 1151)
@@ -6,10 +6,12 @@
 // Upgrade between database schema versions.
 //
 // Returns FALSE on error, TRUE is successful
-function upgrade_database($local, $from, $to)
+function upgrade_database($local, $from, $to, $upgrade_handle)
 {
   // $local is a boolean specifying whether the upgrades are global MRBS ones 
($local == FALSE)
   // or local upgrades ($local == TRUE);
+  // $upgrade_handle is the database handle to use for the upgrade.   It will 
typically
+  // have admin rights (eg CREATE and ALTER)
   global $dbsys;
   global $db_tbl_prefix;
   global $tbl_variables;
@@ -55,7 +57,7 @@
       // an empty command)
       if (preg_match("/\S/", $command))
       {
-        $res = sql_command($command);
+        $res = sql_command($command, $upgrade_handle);
         if ($res == -1)
         {
           // No need to localise, should hopefully never happen


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to