Revision: 1541
http://mrbs.svn.sourceforge.net/mrbs/?rev=1541&view=rev
Author: cimorrison
Date: 2010-10-23 13:10:24 +0000 (Sat, 23 Oct 2010)
Log Message:
-----------
Update the area table replacing any NULLs with the per-area settings defaults.
This is the second and final part of a fix to a bug which caused Search and
Report not to find all the results that they should have done if you were not
logged in as an admin.
Modified Paths:
--------------
mrbs/trunk/tables.my.sql
mrbs/trunk/tables.pg.pre73.sql
mrbs/trunk/tables.pg.sql
mrbs/trunk/web/dbsys.inc
Added Paths:
-----------
mrbs/trunk/web/upgrade/15/
mrbs/trunk/web/upgrade/15/mysql.sql
mrbs/trunk/web/upgrade/15/pgsql.sql
mrbs/trunk/web/upgrade/15/post.inc
Modified: mrbs/trunk/tables.my.sql
===================================================================
--- mrbs/trunk/tables.my.sql 2010-10-23 12:25:13 UTC (rev 1540)
+++ mrbs/trunk/tables.my.sql 2010-10-23 13:10:24 UTC (rev 1541)
@@ -129,6 +129,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ( 'db_version', '14');
+ VALUES ( 'db_version', '15');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ( 'local_db_version', '1');
Modified: mrbs/trunk/tables.pg.pre73.sql
===================================================================
--- mrbs/trunk/tables.pg.pre73.sql 2010-10-23 12:25:13 UTC (rev 1540)
+++ mrbs/trunk/tables.pg.pre73.sql 2010-10-23 13:10:24 UTC (rev 1541)
@@ -120,6 +120,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '14');
+ VALUES ('db_version', '15');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/tables.pg.sql
===================================================================
--- mrbs/trunk/tables.pg.sql 2010-10-23 12:25:13 UTC (rev 1540)
+++ mrbs/trunk/tables.pg.sql 2010-10-23 13:10:24 UTC (rev 1541)
@@ -133,6 +133,6 @@
);
INSERT INTO mrbs_variables (variable_name, variable_content)
- VALUES ('db_version', '14');
+ VALUES ('db_version', '15');
INSERT INTO mrbs_variables (variable_name, variable_content)
VALUES ('local_db_version', '1');
Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc 2010-10-23 12:25:13 UTC (rev 1540)
+++ mrbs/trunk/web/dbsys.inc 2010-10-23 13:10:24 UTC (rev 1541)
@@ -15,7 +15,7 @@
$tbl_variables = $db_tbl_prefix . "variables";
-$db_schema_version = 14;
+$db_schema_version = 15;
$local_db_schema_version = 1;
Added: mrbs/trunk/web/upgrade/15/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/15/mysql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/15/mysql.sql 2010-10-23 13:10:24 UTC (rev 1541)
@@ -0,0 +1 @@
+# $Id$
Property changes on: mrbs/trunk/web/upgrade/15/mysql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/15/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/15/pgsql.sql (rev 0)
+++ mrbs/trunk/web/upgrade/15/pgsql.sql 2010-10-23 13:10:24 UTC (rev 1541)
@@ -0,0 +1 @@
+-- $Id$
Property changes on: mrbs/trunk/web/upgrade/15/pgsql.sql
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: mrbs/trunk/web/upgrade/15/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/15/post.inc (rev 0)
+++ mrbs/trunk/web/upgrade/15/post.inc 2010-10-23 13:10:24 UTC (rev 1541)
@@ -0,0 +1,40 @@
+<?php
+
+// $Id$
+
+// Go through the area table and if any of the per-area settings are NULL then
+// set them to the area defaults
+
+require_once "standard_vars.inc.php"; // won't have been included yet and we
need it for $area_defaults
+
+global $tbl_area, $area_defaults, $boolean_fields;
+
+$fields = sql_field_info($tbl_area);
+foreach ($fields as $field)
+{
+ $key = $field['name'];
+ if (array_key_exists($key, $area_defaults))
+ {
+ if (in_array($key, $boolean_fields['area']))
+ {
+ $sql_val = ($area_defaults[$key]) ? 1 : 0;
+ }
+ elseif ($field['nature'] == 'integer')
+ {
+ $sql_val = $area_defaults[$key];
+ }
+ else
+ {
+ $sql_val = "'" . addslashes($area_defaults[$key]) . "'";
+ }
+ $sql = "UPDATE $tbl_area SET $key=$sql_val WHERE $key IS NULL";
+ }
+ $res = sql_command($sql);
+ if ($res == -1)
+ {
+ // No need to localise, should never happen
+ print "<span class=\"error\">Failed to set default value for column '$key'
in area table.</span><br>";
+ }
+}
+
+?>
\ No newline at end of file
Property changes on: mrbs/trunk/web/upgrade/15/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.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits