[geeklog-cvs] geeklog: Make sure formerly optional config items can be disable...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Apr 12 05:12:08 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/4f787c061bda
changeset: 6925:4f787c061bda
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Apr 12 11:11:10 2009 +0200
description:
Make sure formerly optional config items can be disabled (bug #0000846)

diffstat:

2 files changed, 38 insertions(+), 1 deletion(-)
public_html/admin/install/lib-upgrade.php |   38 ++++++++++++++++++++++++++++-
public_html/docs/history                  |    1 

diffs (71 lines):

diff -r 19b279c51458 -r 4f787c061bda public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php	Sun Apr 12 09:21:52 2009 +0200
+++ b/public_html/admin/install/lib-upgrade.php	Sun Apr 12 11:11:10 2009 +0200
@@ -375,7 +375,8 @@
 
                 $tmp_path = $_CONF['path']; // We'll need this to remember what the correct path is.
                                             // Including config.php will overwrite all our $_CONF values.
-                require($tmp_path . 'config.php');
+                require $tmp_path . 'config.php';
+
                 // Load some important values from config.php into conf_values
                 foreach ($_CONF as $key => $val) {
                     $config->set($key, $val);
@@ -466,6 +467,8 @@
             update_ConfValues();
             upgrade_addNewPermissions();
             upgrade_addIsoFormat();
+
+            INST_fixOptionalConfig();
 
             $current_gl_version = '1.6.0';
             $_SQL = '';
@@ -863,4 +866,37 @@
     return $failed;
 }
 
+/**
+* Make sure optional config options can be disabled
+*
+* Back when Geeklog used a config.php file, some of the comment options were
+* commented out, i.e. they were optional. Make sure those options can still be
+* disabled from the Configuration admin panel.
+*
+* @return void
+*
+*/
+function INST_fixOptionalConfig()
+{
+    global $_TABLES;
+
+    // list of optional config options
+    $optional_config = array(
+        'copyrightyear', 'debug_image_upload', 'default_photo',
+        'force_photo_width', 'gravatar_rating', 'ip_lookup', 'language_files',
+        'languages', 'path_to_mogrify', 'path_to_netpbm'
+    );
+
+    foreach ($optional_config as $name) {
+        $result = DB_query("SELECT value, default_value FROM {$_TABLES['conf_values']} WHERE name = '$name'");
+        list($value, $default_value) = DB_fetchArray($result);
+        if ($value != 'unset') {
+            if (substr($default_value, 0, 6) != 'unset:') {
+                $unset = addslashes('unset:' . $default_value);
+                DB_query("UPDATE {$_TABLES['conf_values']} SET default_value = '$unset' WHERE name = '$name'");
+            }
+        }
+    }
+}
+
 ?>
diff -r 19b279c51458 -r 4f787c061bda public_html/docs/history
--- a/public_html/docs/history	Sun Apr 12 09:21:52 2009 +0200
+++ b/public_html/docs/history	Sun Apr 12 11:11:10 2009 +0200
@@ -11,6 +11,7 @@
 + Comment moderation and editable comments, by Jared Wenerd
 
 Other changes:
+- Make sure formerly optional config items can be disabled (bug #0000846) [Dirk]
 - Re-introduced function get_SPX_Ver in the install script, which is still
   needed when upgrading from old Geeklog releases (reported by Sheila) [Dirk]
 - New plugin API function PLG_getDocumentationUrl (feature request #0000848)



More information about the geeklog-cvs mailing list