error_log konfigurierbar
bernd

bernd commited on 2007-10-04 17:44:35
Zeige 3 geänderte Dateien mit 11 Einfügungen und 4 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@680 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -70,6 +70,7 @@ else
70 70
   $docroot = substr($vhost['docroot'], strlen($vhost['homedir'])+1);
71 71
 
72 72
 $s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : '');
73
+$errorlog = (strstr($vhost['errorlog'], 'on') ? ' checked="checked" ' : '');
73 74
 $form = "
74 75
   <table>
75 76
     <tr><th>Einstellung</th><th>aktueller Wert</th><th>System-Standard</th></tr>
... ...
@@ -104,7 +105,8 @@ $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" valu
104 105
       <option value=\"none\" ".($vhost['logtype'] == NULL ? 'selected="selected"' : '')." >keine Logfiles</option>
105 106
       <option value=\"anonymous\" ".($vhost['logtype'] == 'anonymous' ? 'selected="selected"' : '')." >anonymisiert</option>
106 107
       <option value=\"default\" ".($vhost['logtype'] == 'default' ? 'selected="selected"' : '')." >vollständige Logfile</option>
107
-    </select>
108
+    </select><br />
109
+    <input type=\"checkbox\" id=\"errorlog\" name=\"errorlog\" value=\"1\" ".($vhost['errorlog'] == 1 ? ' checked="checked" ' : '')." />&nbsp;<label for=\"errorlog\">Fehlerprotokoll (error_log) einschalten</label>
108 110
     </td>
109 111
     <td id=\"defaultlogtype\">keine Logfiles</td></tr>
110 112
     ";
... ...
@@ -138,15 +138,16 @@ function save_vhost($vhost)
138 138
   $php = maybe_null($vhost['php']);
139 139
   $ssl = maybe_null($vhost['ssl']);
140 140
   $logtype = maybe_null($vhost['logtype']);
141
+  $errorlog = (int) $vhost['errorlog'];
141 142
   $options = mysql_real_escape_string( $vhost['options'] );
142 143
 
143 144
   if ($id != 0) {
144 145
     logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Updating vhost #'.$id.' ('.$vhost['hostname'].'.'.$vhost['domain'].')');
145
-    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, options='{$options}' WHERE id={$id} LIMIT 1");
146
+    db_query("UPDATE vhosts.vhost SET hostname={$hostname}, domain={$domain}, docroot={$docroot}, php={$php}, `ssl`={$ssl}, logtype={$logtype}, errorlog={$errorlog}, options='{$options}' WHERE id={$id} LIMIT 1");
146 147
   }
147 148
   else {
148 149
     logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
149
-    db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, '{$options}')");
150
+    db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, '{$options}')");
150 151
   }
151 152
 }
152 153
 
... ...
@@ -84,6 +84,10 @@ if ($_GET['action'] == 'edit')
84 84
     /* Wenn etwas anderes kommt, ist das "kein Logging". So einfach ist das. */
85 85
   }
86 86
 
87
+  $errorlog = 0;
88
+  if (isset($_POST['errorlog']) and ($_POST['errorlog'] == 1))
89
+    $errorlog = 1;
90
+
87 91
   DEBUG("PHP: {$php} / Logging: {$logtype}");
88 92
 
89 93
   $old_options = explode(',', $vhost['options']);
... ...
@@ -107,7 +111,7 @@ if ($_GET['action'] == 'edit')
107 111
   $vhost['php'] = $php;
108 112
   $vhost['ssl'] = $ssl;
109 113
   $vhost['logtype'] = $logtype;
110
-    
114
+  $vhost['errorlog'] = $errorlog; 
111 115
   $vhost['options'] = $options;
112 116
     
113 117
   save_vhost($vhost);
114 118