Index: /extensions/CommentEditor/classes/ce_config.class.php
===================================================================
--- /extensions/CommentEditor/classes/ce_config.class.php	(revision 3479)
+++ /extensions/CommentEditor/classes/ce_config.class.php	(revision 3480)
@@ -9,6 +9,6 @@
   var $config_values;
   var $default_config;
-  var $db_key;
-  var $db_comment;
+  var $db_key = null;
+  var $db_comment = null;
 
   /* ************************ */
@@ -18,6 +18,4 @@
   function CE_Config($default_config = array()) {
     $this->default_config = $default_config;
-    $this->db_key = CE_CFG_DB_KEY;
-    $this->db_comment = CE_CFG_DB_COMMENT;
   }
 
@@ -33,14 +31,17 @@
   }
 
+  function setValue($key, $value) {
+      $this->config_values[$key] = $value;
+  }
+
+  function getVersion() {
+    if (isset($this->config_values[CE_CFG_VERSION])) {
+      return $this->config_values[CE_CFG_VERSION];
+    }
+    return CE_VERSION;
+  }
+
   function setDBKey($key) {
     $this->db_key = $key;
-  }
-
-  function setDBComment($comment) {
-    $this->db_comment = $comment;
-  }
-
-  function setValue($key, $value) {
-      $this->config_values[$key] = $value;
   }
 
@@ -50,14 +51,16 @@
 
   function loadConfig() {
-    $query = '
-        SELECT value
-        FROM '.CONFIG_TABLE.'
-        WHERE param = \''.CE_CFG_DB_KEY.'\'
-        ;';
-    $result = pwg_query($query);
-    if($result) {
-      $row = mysql_fetch_row($result);
-      if(is_string($row[0])) {
-        $this->config_values = unserialize($row[0]);
+    if (null != $this->db_key) {
+      $query = '
+          SELECT value
+          FROM '.CONFIG_TABLE.'
+          WHERE param = \''. $this->db_key .'\'
+          ;';
+      $result = pwg_query($query);
+      if($result) {
+        $row = mysql_fetch_row($result);
+        if(is_string($row[0])) {
+          $this->config_values = unserialize($row[0]);
+        }
       }
     }
@@ -78,4 +81,10 @@
 
   function saveConfig() {
+    if (null == $this->db_key) {
+      return false;
+    }
+    $db_comment = sprintf($this->config_values[CE_CFG_COMMENT],
+                          $this->db_key,
+                          $this->getVersion());
     $query = '
         REPLACE INTO '.CONFIG_TABLE.'
@@ -83,5 +92,5 @@
           \''. $this->db_key .'\',
           \''.serialize($this->config_values).'\',
-          \''. $this->db_comment . '\')
+          \''. $db_comment . '\')
         ;';
     $result = pwg_query($query);
@@ -99,7 +108,14 @@
   static function install($plugin_id, $default_config = array()) {
     $config = new CE_Config($default_config);
-    $config->setDBComment('Factory settings for '. $plugin_id);
     $config->setDBKey($plugin_id);
     $config->loadConfig();
+    if (isset($default_config[CE_CFG_VERSION])) {
+      // Override version
+      $config->config_values[CE_CFG_VERSION] = $default_config[CE_CFG_VERSION];
+    }
+    if (isset($default_config[CE_CFG_COMMENT])) {
+      // Override comment
+      $config->config_values[CE_CFG_COMMENT] = $default_config[CE_CFG_COMMENT];
+    }
     $result = $config->saveConfig();
     return $result;
Index: /extensions/CommentEditor/classes/ce_plugin.class.php
===================================================================
--- /extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3479)
+++ /extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3480)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_plugin.class.php,v 1.13 2009/06/30 19:01:50 Criss Exp $ */
+/* $Id: ce_plugin.class.php,v 1.14 2009/06/30 21:36:20 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -20,5 +20,7 @@
     $this->config = $config;
     if (null != $this->config) {
+      $this->config->setDBKey(CE_CFG_DB_KEY);
       $this->config->loadConfig();
+      $this->config->setValue(CE_CFG_COMMENT, CE_CFG_DB_COMMENT);
     }
   }
@@ -118,8 +120,5 @@
 
   function getVersion() {
-    if (isset($this->config->config_values[CE_CFG_VERSION])) {
-      return $this->config->config_values[CE_CFG_VERSION];
-    }
-    return CE_VERSION;
+    return $this->config->getVersion();
   }
 
Index: /extensions/CommentEditor/include/ce_common.inc.php
===================================================================
--- /extensions/CommentEditor/include/ce_common.inc.php	(revision 3479)
+++ /extensions/CommentEditor/include/ce_common.inc.php	(revision 3480)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_common.inc.php,v 1.14 2009/06/30 19:22:06 Criss Exp $ */
+/* $Id: ce_common.inc.php,v 1.15 2009/06/30 21:36:20 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -42,8 +42,10 @@
 if (isset($plugin)) {
   define('CE_CFG_DB_KEY',       $plugin['id']);
-  define('CE_CFG_DB_COMMENT',   'Configuration of plugin ' . $plugin['id']);
 }
+define('CE_CFG_DB_FACTORY',     'Factory settings for plugin %s [%s]');
+define('CE_CFG_DB_COMMENT',     'Configuration of plugin %s [%s]');
 define('CE_CFG_DISPLAY_ERROR',  'display_error');
 define('CE_CFG_DISPLAY_INFO',   'display_info');
+define('CE_CFG_COMMENT',        'comment');
 define('CE_CFG_VERSION',        'version');
 
Index: /extensions/CommentEditor/maintain.inc.php
===================================================================
--- /extensions/CommentEditor/maintain.inc.php	(revision 3479)
+++ /extensions/CommentEditor/maintain.inc.php	(revision 3480)
@@ -11,4 +11,12 @@
 
 function plugin_install($plugin_id, $version, &$errors) {
+  include_once(CE_PATH . 'include/ce_common.inc.php');
+  // Include language advices
+  load_language('plugin.lang', CE_PATH);
+  if ($version != CE_VERSION) {
+    array_push($errors, sprintf(l10n('ce_inconsistent_version'), $plugin_id));
+    return;
+  }
+  $ce_config_default[CE_CFG_COMMENT] = CE_CFG_DB_FACTORY;
   update_config($plugin_id, $version, $errors);
 }
@@ -29,12 +37,6 @@
 function update_config($plugin_id, $version, &$errors) {
   include_once(CE_PATH . 'include/ce_common.inc.php');
-  // Include language advices
-  load_language('plugin.lang', CE_PATH);
-  if ($version != CE_VERSION) {
-    array_push($errors, sprintf(l10n('ce_inconsistent_version'), $plugin_id));
-    return;
-  }
   $clean = ce_clean_obsolete_files(CE_OBSOLETE);
-  $ce_config_default[CE_CFG_VERSION] = $version;
+  $ce_config_default[CE_CFG_VERSION] = CE_VERSION;
   $install = CE_Config::install($plugin_id, $ce_config_default);
 }
