Create default config even when called remotely
authorJamie Cameron <jcameron@webmin.com>
Thu, 3 May 2007 18:02:22 +0000 (18:02 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 3 May 2007 18:02:22 +0000 (18:02 +0000)
webalizer/index.cgi
webalizer/webalizer-lib.pl

index 8bf7846..55ab3f5 100755 (executable)
@@ -43,10 +43,6 @@ if ($webalizer_version < 2) {
        }
 
 # Check if the config file exists
-if (!-r $config{'webalizer_conf'} && -r $config{'alt_conf'}) {
-       # No, but the sample one does
-       system("cp '$config{'alt_conf'}' '$config{'webalizer_conf'}' >/dev/null 2>&1");
-       }
 if (!-r $config{'webalizer_conf'}) {
        &main_header();
        print &text('index_econf', "<tt>$config{'webalizer_conf'}</tt>",
index c539700..76e9496 100644 (file)
@@ -9,6 +9,11 @@ $cron_cmd = "$module_config_directory/webalizer.pl";
 $custom_logs_file = "$module_config_directory/custom-logs";
 %access = &get_module_acl();
 
+# Use sample config if needed
+if (!-r $config{'webalizer_conf'} && -r $config{'alt_conf'}) {
+       &copy_source_dest($config{'alt_conf'}, $config{'webalizer_conf'});
+       }
+
 # get_config([logfile])
 # Parse the webalizer config file for a single logfile or global
 sub get_config