Add field to enable lang file pre-caching
authorJamie Cameron <jcameron@webmin.com>
Thu, 9 Dec 2010 18:41:39 +0000 (10:41 -0800)
committerJamie Cameron <jcameron@webmin.com>
Thu, 9 Dec 2010 18:41:39 +0000 (10:41 -0800)
webmin/change_advanced.cgi
webmin/edit_advanced.cgi
webmin/lang/en

index 6e98d41..92206e6 100755 (executable)
@@ -85,6 +85,18 @@ if (defined($in{'preload'})) {
        &save_preloads(\%miniserv, [ ]);
        }
 
+# Save pre-cache option
+if ($in{'precache_mode'} == 0) {
+       $miniserv{'precache'} = 'none';
+       }
+elsif ($in{'precache_mode'} == 1) {
+       $miniserv{'precache'} = '';
+       }
+else {
+       $in{'precache'} =~ /\S/ || &error($text{'advanced_eprecache'});
+       $miniserv{'precache'} = $in{'precache'};
+       }
+
 # Save password pass option
 $miniserv{'pass_password'} = $in{'pass'};
 
index e23dcc0..b953aa9 100755 (executable)
@@ -52,6 +52,17 @@ elsif ($preloads[0]->[0] eq "main" && $preloads[0]->[1] eq "web-lib-funcs.pl") {
                            &ui_yesno_radio("preload", 1));
        }
 
+# Files to pre-cache
+$mode = $miniserv{'precache'} eq 'none' ? 0 :
+        $miniserv{'precache'} eq '' ? 1 : 2;
+print &ui_table_row($text{'advanced_precache'},
+       &ui_radio("precache_mode", $mode,
+                 [ [ 0, $text{'advanced_precache0'}."<br>" ],
+                   [ 1, $text{'advanced_precache1'}."<br>" ],
+                   [ 2, &text('advanced_precache2',
+                         &ui_textbox("precache",
+                          $mode == 2 ? $miniserv{'precache'} : "", 40)) ] ]));
+
 # Show call stack on error
 print &ui_table_row($text{'advanced_stack'},
                    &ui_yesno_radio("stack", int($gconfig{'error_stack'})));
index 134cae6..214a2fa 100644 (file)
@@ -771,6 +771,11 @@ advanced_tempdelete=Maximum age of temporary files
 advanced_nodelete=Unlimited
 advanced_days=days
 advanced_preload=Pre-load Webmin functions library?
+advanced_precache=Text files to pre-cache?
+advanced_precache0=None
+advanced_precache1=English language text files
+advanced_precache2=Files matching shell patterns $1
+advanced_eprecache=Missing list of shell patterns to pre-cache
 advanced_err=Failed to save advanced options
 advanced_etemp=Missing or non-existant temporary files directory
 advanced_etdir=Missing or non-existant temporary files directory for $1