[geeklog-cvs] geeklog: "tab" column needs special handling to avoid problems w...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Feb 26 15:14:13 EST 2011


changeset 8137:dbfd1e49f193
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/dbfd1e49f193
user: Dirk Haun <dirk at haun-online.de>
date: Sat Feb 26 21:13:31 2011 +0100
description:
"tab" column needs special handling to avoid problems when upgrading from older Geeklog versions which didn't have it

diffstat:

 system/classes/config.class.php |  46 ++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 19 deletions(-)

diffs (60 lines):

diff -r 314792d0ee43 -r dbfd1e49f193 system/classes/config.class.php
--- a/system/classes/config.class.php	Sat Feb 26 21:06:26 2011 +0100
+++ b/system/classes/config.class.php	Sat Feb 26 21:13:31 2011 +0100
@@ -486,29 +486,37 @@
                        $subgroup,
                        $group,
                        ($selection_array === null ?
-                        -1 : $selection_array),
+                            -1 : $selection_array),
                        $sort,
-                       ($tab === null ?
-                        'NULL' : $tab), // Let it be NULL for plugins that support the older config
                        ($fieldset === null ?
-                        0 : $fieldset),
-                       serialize($default_value));
+                             0 : $fieldset),
+                       serialize($default_value)
+                      );
+
+        $columns = 'name, value, type, subgroup, group_name, selectionArray, sort_order, fieldset, default_value';
+
+        // special handling of $tab for backward compatibility
+        if ($tab !== null) {
+            $columns .= ', tab';
+            $Qargs[9] = $tab;
+        }
         $Qargs = array_map('addslashes', $Qargs);
-        
+
         // Now add in config item
-        $sql = "INSERT INTO {$_TABLES['conf_values']} (name, value, type, " .
-            "subgroup, group_name, selectionArray, sort_order, tab,".
-            " fieldset, default_value) VALUES ("
-            ."'{$Qargs[0]}',"
-            ."'{$Qargs[1]}',"
-            ."'{$Qargs[2]}',"
-            ."{$Qargs[3]},"
-            ."'{$Qargs[4]}',"
-            ."{$Qargs[5]},"
-            ."{$Qargs[6]},"
-            ."{$Qargs[7]},"
-            ."'{$Qargs[8]}',"
-            ."'{$Qargs[9]}')";
+        $sql = "INSERT INTO {$_TABLES['conf_values']} ($columns) VALUES ("
+             . "'{$Qargs[0]}',"
+             . "'{$Qargs[1]}',"
+             . "'{$Qargs[2]}',"
+             . "{$Qargs[3]},"
+             . "'{$Qargs[4]}',"
+             . "{$Qargs[5]},"
+             . "{$Qargs[6]},"
+             . "'{$Qargs[7]}',"
+             . "'{$Qargs[8]}'";
+        if ($tab !== null) {
+            $sql .= ",{$Qargs[9]}";
+        }
+        $sql .= ')';
 
         $this->_DB_escapedQuery($sql);
 



More information about the geeklog-cvs mailing list