Changeset:
        7f2f23d25675
        
https://sourceforge.net/p/mrbs/hg-code/ci/7f2f23d25675202aa1ba7677630d8eb10164fc94
Author:
        John Beranek <[email protected]>
Date:
        Fri Sep 30 08:00:02 2016 +0100
Log message:

Corrected uses of  in upgrade scripts

diffstat:

 web/upgrade/5/post.inc |  10 ++++++----
 web/upgrade/6/post.inc |   3 +--
 2 files changed, 7 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 1b4f33a41b63 -r 7f2f23d25675 web/upgrade/5/post.inc
--- a/web/upgrade/5/post.inc    Thu Sep 29 18:09:42 2016 +0100
+++ b/web/upgrade/5/post.inc    Fri Sep 30 08:00:02 2016 +0100
@@ -6,10 +6,12 @@
 global $admin_handle;
 global $tbl_users;
 
-$nusers = sql_query1("select count(*) from $tbl_users", array(), 
$admin_handle);
+$exists = $admin_handle->table_exists($tbl_users);
 
-if ($nusers == -1)   /* If the table does not exist */
-{         /* Then create it */
+/* If the table does not exist */
+if (!$exists)
+{
+  /* Then create it */
   $cmd = "
 CREATE TABLE $tbl_users
 (
@@ -25,5 +27,5 @@
 
   PRIMARY KEY (id)
 );";
-  sql_command($cmd, array(), $admin_handle);
+  $admin_handle->command($cmd);
 }
diff -r 1b4f33a41b63 -r 7f2f23d25675 web/upgrade/6/post.inc
--- a/web/upgrade/6/post.inc    Thu Sep 29 18:09:42 2016 +0100
+++ b/web/upgrade/6/post.inc    Fri Sep 30 08:00:02 2016 +0100
@@ -16,8 +16,7 @@
 {
   // Default is '0' because we want to play safe and give no rights.
   // In a moment we will go through the table and add users and admins.
-  sql_command("ALTER TABLE $tbl_users ADD COLUMN level smallint DEFAULT '0' 
NOT NULL ".sql_syntax_addcolumn_after("id"),
-              array(), $admin_handle);
+  $admin_handle->command("ALTER TABLE $tbl_users ADD COLUMN level smallint 
DEFAULT '0' NOT NULL ".sql_syntax_addcolumn_after("id"));
   
   // Assuming that all existing entries in the users table are at least users, 
   // make them all Level 1

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to