Code

Updated logging attribute
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Dec 2009 09:10:42 +0000 (09:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Dec 2009 09:10:42 +0000 (09:10 +0000)
-It is now bool.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14971 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/contrib/gosa.conf
gosa-core/include/class_log.inc
gosa-core/setup/class_setupStep_Config2.inc
gosa-core/setup/setup_config2.tpl

index 25513647fb730ef5a940a29c3cfc146f3ca36864..da0df2c9a0c15ddb7c22043e48da1f14ebfabb0d 100644 (file)
 
   -->
   <main default="{$cv.location}"
+{if $cv.generic_settings.logging}
+        logging="true"
+{else}
+        logging="false"
+{/if}
 {if $cv.optional.list_summary}
         listSummary="true"
 {else}
index 24ee43237a267f9b4af9c8236191eb7cc8037444..ebaeff5a611b0eaf079a05c1f0ed3c178a1336aa 100644 (file)
@@ -77,8 +77,9 @@ class log {
     if(!isset($this->config) && empty($entry['user'])){
       $entry['user']  = "unknown";
     }
+
     /* Check if all given values are valid */
+    global $config;
     $msgs = @log::check($entry);
     if(count($msgs)){
       foreach($msgs as $msg){
@@ -86,7 +87,9 @@ class log {
         msg_dialog::display(_("Internal error"), sprintf(_("Logging failed: %s"), $msg), ERROR_DIALOG);
       }
     }else{
-      $this->log_into_syslog($entry);
+      if(is_object($config) && preg_match("/true/i",$config->get_cfg_value("logging",""))){
+        $this->log_into_syslog($entry);
+      }
     }
   }
 
index 2ec4ede3349fdad879f48aaad3b8508a57c23610..1bf1d2ff5c13f3d81c4a7dbced193141a828edfb 100644 (file)
@@ -40,7 +40,7 @@ class Step_Config2 extends setup_step
                                   "snapshot_base"       => "ou=snapshots,%base%",
                                   "snapshot_user"       => "%admin%",
                                   "snapshot_password"   => "",
-                                  "logging"             => "syslog,mysql",
+                                  "logging"             => TRUE,
                                   "snapshot_server"     => "%connection%");
 
   var $samba_settings    = array( "samba_sid"        => "0-815-4711",
@@ -131,8 +131,7 @@ class Step_Config2 extends setup_step
     $smarty->assign("mail_methods",      reverse_html_entities($this->mail_methods));
     $smarty->assign("samba_settings",    reverse_html_entities($this->samba_settings));
 
-    $smarty->assign("logging_mysql" ,preg_match("/mysql/",$this->generic_settings['logging']));
-    $smarty->assign("logging_syslog",preg_match("/syslog/",$this->generic_settings['logging']));
+    $smarty->assign("logging",$this->generic_settings['logging']);
    
     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
     foreach($this->attributes as $attr){
@@ -161,14 +160,7 @@ class Step_Config2 extends setup_step
       }
 
       /* Get logging */
-      $logging = "";
-      if(isset($_POST['logging_syslog'])){
-        $logging.= "syslog,";
-      }
-      if(isset($_POST['logging_mysql'])){
-        $logging.= "mysql,";
-      }
-      $this->generic_settings['logging'] = trim($logging,",");
+      $this->generic_settings['logging'] =  isset($_POST['logging']);
 
       /* Mail settings */
       if(isset($_POST['vacationdir_active'])){
index f815366403bb61e94e04dd556b26c714c5eb0fc4..1cf915a178e8e97f8df042f4d3861b80cb517e11 100644 (file)
 
     <div class='step4_container'>
         <div class='step4_name'>
-            {t}Logging options{/t}
+            {t}GOsa logging{/t}
         </div>
         <div class='step4_value'>
-                       <input type='checkbox' name='logging_syslog' value='1' 
-                               {if $logging_syslog} checked {/if} class='center'>{t}Syslog{/t} 
-                       <input type='checkbox' name='logging_mysql' value='1' 
-                               {if $logging_mysql} checked {/if} class='center'>{t}MySQL{/t}
+          {if $logging} 
+            <input checked type='checkbox' name='logging' value='1' class='center'>
+          {else}
+            <input type='checkbox' name='logging' value='1' class='center'>
+          {/if}
         </div>
     </div>