Revision: 1225
http://mrbs.svn.sourceforge.net/mrbs/?rev=1225&view=rev
Author: cimorrison
Date: 2009-10-21 20:43:03 +0000 (Wed, 21 Oct 2009)
Log Message:
-----------
Ensured that the private settings in the area table are always not NULL, by
converting existing areas and setting the private fields when creating new
areas. (It will make ensuring that Search and Report respect the private
settings easier if the settings can be guaranteed to be not NULL).
Modified Paths:
--------------
mrbs/trunk/web/add.php
mrbs/trunk/web/dbsys.inc
Added Paths:
-----------
mrbs/trunk/web/upgrade/7/
mrbs/trunk/web/upgrade/7/mysql.sql
mrbs/trunk/web/upgrade/7/pgsql.sql
mrbs/trunk/web/upgrade/7/post.inc
Modified: mrbs/trunk/web/add.php
===================================================================
--- mrbs/trunk/web/add.php 2009-10-21 18:26:48 UTC (rev 1224)
+++ mrbs/trunk/web/add.php 2009-10-21 20:43:03 UTC (rev 1225)
@@ -44,7 +44,15 @@
// If so, insert the area into the database
else
{
- $sql = "insert into $tbl_area (area_name) values ('$area_name_q')";
+ // Convert booleans to 1 or 0, as the fields are tinyints/smallints
+ $private_enabled = ($private_enabled) ? 1 : 0;
+ $private_default = ($private_default) ? 1 : 0;
+ $private_mandatory = ($private_mandatory) ? 1 : 0;
+ // Need to make sure the private settings are not NULL. We can't specify
a default
+ // in the SQL when creating the table because the default is a variable in
the config file
+ $sql = "INSERT INTO $tbl_area
+ (area_name, private_enabled, private_default, private_mandatory,
private_override)
+ VALUES ('$area_name_q', $private_enabled, $private_default,
$private_mandatory, '$private_override')";
if (sql_command($sql) < 0)
{
fatal_error(1, sql_error());
Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc 2009-10-21 18:26:48 UTC (rev 1224)
+++ mrbs/trunk/web/dbsys.inc 2009-10-21 20:43:03 UTC (rev 1225)
@@ -15,7 +15,7 @@
$tbl_variables = $db_tbl_prefix . "variables";
-$db_schema_version = 6;
+$db_schema_version = 7;
$local_db_schema_version = 1;
Added: mrbs/trunk/web/upgrade/7/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/7/mysql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/7/mysql.sql 2009-10-21 20:43:03 UTC (rev 1225)
@@ -0,0 +1 @@
+# $Id$
Property changes on: mrbs/trunk/web/upgrade/7/mysql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Property changes on: mrbs/trunk/web/upgrade/7/pgsql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/7/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/7/post.inc (rev 0)
+++ mrbs/trunk/web/upgrade/7/post.inc 2009-10-21 20:43:03 UTC (rev 1225)
@@ -0,0 +1,33 @@
+<?php
+
+// $Id$
+
+// Update the area table getting rid of NULLs for the private settings and
replacing them
+// with the default settings.
+
+global $tbl_area;
+global $private_enabled, $private_default, $private_mandatory,
$private_override;
+
+// Convert booleans to 1 or 0, as the fields are tinyints/smallints
+$private_enabled = ($private_enabled) ? 1 : 0;
+$private_default = ($private_default) ? 1 : 0;
+$private_mandatory = ($private_mandatory) ? 1 : 0;
+
+if (sql_command("UPDATE $tbl_area SET private_enabled=$private_enabled WHERE
private_enabled IS NULL") < 0)
+{
+ fatal_error(0, "Error updating table. " . sql_error());
+}
+if (sql_command("UPDATE $tbl_area SET private_default=$private_default WHERE
private_default IS NULL") < 0)
+{
+ fatal_error(0, "Error updating table. " . sql_error());
+}
+if (sql_command("UPDATE $tbl_area SET private_mandatory=$private_mandatory
WHERE private_mandatory IS NULL") < 0)
+{
+ fatal_error(0, "Error updating table. " . sql_error());
+}
+if (sql_command("UPDATE $tbl_area SET private_override='$private_override'
WHERE private_override IS NULL") < 0)
+{
+ fatal_error(0, "Error updating table. " . sql_error());
+}
+
+?>
Property changes on: mrbs/trunk/web/upgrade/7/post.inc
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits